# Get a case study

`GET https://app.pozyskajpacjenta.pl/api/v1/case-studies/{slug}` · operationId `getCaseStudy` · since 1.1.0 · tag Entities

One published case study with before and after images, content blocks and linked 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 case study (lower-case letters, digits, hyphens).

### cURL

```bash
curl "https://app.pozyskajpacjenta.pl/api/v1/case-studies/pelna-odbudowa-usmiechu" \
  -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 { caseStudy } = await client.getCaseStudy("pelna-odbudowa-usmiechu");
```

### PHP

```php
<?php
$response = wp_remote_get(
    'https://app.pozyskajpacjenta.pl/api/v1/case-studies/pelna-odbudowa-usmiechu',
    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 case study.

- `caseStudy` (`CaseStudyDetail`, required): The case study.
  - `id` (`string`, required): Case study id.
  - `slug` (`string`, required): Slug from the case study's address.
  - `path` (`string`, required): Path of the case study page.
  - `title` (`string`, required): Title.
  - `summary` (`string | null`): Short summary; null when empty.
  - `before` (`MediaRef | null`): Image before the treatment; 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.
  - `after` (`MediaRef | null`): Image after the treatment; null when none.
    - fields as in `MediaRef` above
  - `bodyBlocks` (`Block[]`, required): Content blocks of the case study.
    - `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`.
  - `services` (`RelatedService[]`, required): Treatments linked to the case study (published ones only).
    - `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.
  - `publishedAt` (`string (date-time) | null`): Publication date, ISO 8601; null when unknown.
  - `updatedAt` (`string (date-time)`, required): Last change, ISO 8601.

Example (A case study (body trimmed to one block)):

```json
{
  "caseStudy": {
    "id": "cs_odbudowa",
    "slug": "pelna-odbudowa-usmiechu",
    "path": "/realizacje/pelna-odbudowa-usmiechu",
    "title": "Pełna odbudowa uśmiechu na implantach",
    "summary": "Pacjent, 58 lat, po latach unikania dentysty: sześć implantów, korony pełnoceramiczne i nowy zgryz w cztery miesiące, bez jednego dnia bez zębów.",
    "before": null,
    "after": null,
    "bodyBlocks": [
      {
        "id": "cs-odb-wyzwanie",
        "type": "rich-text.v1",
        "props": {
          "variant": "narrow",
          "heading": "Wyzwanie",
          "body": "Pan Andrzej trafił do nas po kilkunastu latach przerwy w leczeniu: brakujące zęby boczne, starte zęby przednie i zgryz obniżony tak, że zmieniał rysy twarzy. Najbardziej bał się nie zabiegów, a tego, że na czas leczenia zostanie bez zębów."
        }
      }
    ],
    "services": [],
    "publishedAt": "2026-06-20T00:00:00.000Z",
    "updatedAt": "2026-09-30T14:21:58.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.getCaseStudy(slug: string): Promise<{ caseStudy: CaseStudyDetail }>`
