# Get a treatment

`GET https://app.pozyskajpacjenta.pl/api/v1/services/{slug}` · operationId `getService` · since 1.1.0 · tag Entities

One published treatment with its content blocks, questions and answers, and related treatments. Responses are private to the key: `Cache-Control: private, max-age=60`, so cache them on your side for up to a minute.

## Request

Authorization: `Bearer <the clinic's key>`.

### Path parameters

- `slug` (`string`, required): Slug of the treatment (lower-case letters, digits, hyphens).

### cURL

```bash
curl "https://app.pozyskajpacjenta.pl/api/v1/services/higienizacja" \
  -H "Authorization: Bearer $PP_API_KEY"
```

### TypeScript

```ts
import { PozyskajPacjentaClient } from "@pozyskajpacjenta/sdk";

const client = new PozyskajPacjentaClient({
  apiKey: process.env.PP_API_KEY ?? "",
  baseUrl: "https://app.pozyskajpacjenta.pl",
});

const { service } = await client.getService("higienizacja");
```

### PHP

```php
<?php
$response = wp_remote_get(
    'https://app.pozyskajpacjenta.pl/api/v1/services/higienizacja',
    array(
        'headers' => array( 'Authorization' => 'Bearer ' . getenv( 'PP_API_KEY' ) ),
        'timeout' => 10,
    )
);
if ( is_wp_error( $response ) ) {
    error_log( $response->get_error_message() );
    return;
}
$status = wp_remote_retrieve_response_code( $response );
$data   = json_decode( wp_remote_retrieve_body( $response ), true );
```

## Response

### 200: The treatment.

- `service` (`ServiceDetail`, required): The treatment.
  - `id` (`string`, required): Treatment id.
  - `slug` (`string`, required): Slug from the treatment's address.
  - `path` (`string`, required): Path on the clinic's site, e.g. /zabiegi/implanty.
  - `name` (`string`, required): Treatment name.
  - `category` (`string | null`): Category the clinic groups the treatment under; null when none.
  - `shortDesc` (`string | null`): One-sentence description for lists; null when empty.
  - `priceFromLabel` (`string | null`): Price label, e.g. od 290 zł; null when the clinic shows no price.
  - `durationLabel` (`string | null`): Duration label, e.g. zabieg 60 min; null when empty.
  - `bookingServiceId` (`string | null`, required, since 1.3.0): Id of the active booking service this treatment is booked as: an entry of GET /booking/catalog and the `service` parameter of /booking/slots. null when the treatment is not linked to booking or the linked service is inactive.
  - `hero` (`MediaRef | null`): Main image of the treatment page; null when none.
    - `url` (`string`, required): Absolute address of the file.
    - `focalX` (`integer | null`): Horizontal focal point in percent (0 to 100) to keep when cropping, e.g. as object-position.
    - `focalY` (`integer | null`): Vertical focal point in percent (0 to 100).
    - `alt` (`string | null`): Alternative text; null when the clinic left it empty.
    - `width` (`integer`, since 1.4.0): Width of the original in px (library files, when known), for width/height attributes without layout shift.
    - `height` (`integer`, since 1.4.0): Height of the original in px.
    - `aiGenerated` (`boolean`, since 1.4.0): The image was generated by AI: label it next to the image (e.g. in a caption).
    - `caption` (`string`, since 1.4.0): Caption to show under the image.
  - `bodyBlocks` (`Block[]`, required): Content blocks of the treatment page.
    - `id` (`string`, required): Block id, stable within the page.
    - `type` (`string`, required): Block type with its version, e.g. hero.v1, faq.v1.
    - `props` (`object`, required): The block's fields; their shape depends on `type`.
  - `faq` (`object[]`, required): Questions and answers about the treatment.
    - `question` (`string`, required): The question.
    - `answer` (`string`, required): The answer, plain text.
  - `related` (`RelatedService[]`, required): Other published treatments the clinic links from this one.
    - `id` (`string`, required): Treatment id.
    - `slug` (`string`, required): Treatment slug.
    - `path` (`string`, required): Path of the treatment page.
    - `name` (`string`, required): Treatment name.
    - `priceFromLabel` (`string | null`): Price label, e.g. od 290 zł; null when the clinic shows no price.
  - `updatedAt` (`string (date-time)`, required): Last change, ISO 8601.

Example (A treatment page):

```json
{
  "service": {
    "id": "svc_higienizacja",
    "slug": "higienizacja",
    "path": "/zabiegi/higienizacja",
    "name": "Higienizacja",
    "category": "Profilaktyka",
    "shortDesc": "Skaling ultradźwiękowy, piaskowanie i fluoryzacja z instruktażem higieny, zalecana co 6 miesięcy.",
    "priceFromLabel": "290 zł",
    "durationLabel": "zabieg 60 min",
    "bookingServiceId": "bsvc_higienizacja",
    "hero": null,
    "bodyBlocks": [
      {
        "id": "svc-hig-body",
        "type": "rich-text.v1",
        "props": {
          "variant": "narrow",
          "heading": "Najtańsze leczenie, jakie istnieje",
          "body": "Regularna higienizacja usuwa kamień, zanim wywoła stan zapalny dziąseł, i pozwala wychwycić próchnicę na etapie małego wypełnienia."
        }
      },
      {
        "id": "svc-hig-cta",
        "type": "booking.v1",
        "props": {
          "heading": "Umów higienizację",
          "subheading": "Zabieg wykonuje lek. dent. Maria Zielińska.",
          "preselectedServiceId": "bsvc_higienizacja"
        }
      }
    ],
    "faq": [
      {
        "question": "Czy higienizacja boli?",
        "answer": "Nie, przy wrażliwych zębach możemy zastosować znieczulenie powierzchniowe. Po zabiegu nadwrażliwość mija w ciągu doby."
      },
      {
        "question": "Jak często powtarzać higienizację?",
        "answer": "Standardowo co 6 miesięcy; przy aparatach ortodontycznych i implantach co 3–4 miesiące."
      }
    ],
    "related": [
      {
        "id": "svc_kontrola",
        "slug": "wizyta-kontrolna",
        "path": "/zabiegi/wizyta-kontrolna",
        "name": "Wizyta kontrolna",
        "priceFromLabel": "150 zł"
      },
      {
        "id": "svc_konsultacja",
        "slug": "konsultacja-stomatologiczna",
        "path": "/zabiegi/konsultacja-stomatologiczna",
        "name": "Konsultacja stomatologiczna",
        "priceFromLabel": "200 zł"
      }
    ],
    "updatedAt": "2026-09-30T14:21:55.000Z"
  }
}
```

## Errors

| Status | code | When |
| --- | --- | --- |
| 401 |  | No Authorization header |
| 401 |  | Unknown or rotated key |
| 404 |  | No published treatment with this slug |
| 429 |  | Over 120 requests in this minute |

401 (No Authorization header):

```json
{
  "error": "missing Authorization: Bearer <klucz z panelu Ustawienia>"
}
```

401 (Unknown or rotated key):

```json
{
  "error": "invalid key"
}
```

404 (No published treatment with this slug):

```json
{
  "error": "nie znaleziono"
}
```

429 (Over 120 requests in this minute):

```json
{
  "error": "przekroczono limit 120 zapytań/min"
}
```

## Rate limit

- 120 requests per minute per key, shared by every endpoint.

## SDK method

`client.getService(slug: string): Promise<{ service: ServiceDetail }>`
