# List appointments

`GET https://app.pozyskajpacjenta.pl/api/v1/booking/appointments` · operationId `listAppointments` · since 1.2.0 · tag Booking

The clinic's appointments with the names of the service and the specialist, up to 500, earliest first. `from` and `to` are days (YYYY-MM-DD, inclusive), counted as UTC days. The list holds patient data (name, phone, e-mail): call it from your server only and never show it to the public. Responses are never cached.

## Request

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

### Query parameters

- `from` (`string (date)`): First day, YYYY-MM-DD (inclusive).
- `to` (`string (date)`): Last day, YYYY-MM-DD (inclusive).

### cURL

```bash
curl "https://app.pozyskajpacjenta.pl/api/v1/booking/appointments?from=2026-10-05&to=2026-10-05" \
  -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 { appointments } = await client.listAppointments({
  from: "2026-10-05",
  to: "2026-10-05",
});
```

### PHP

```php
<?php
$response = wp_remote_get(
    'https://app.pozyskajpacjenta.pl/api/v1/booking/appointments?from=2026-10-05&to=2026-10-05',
    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 appointments.

- `appointments` (`Appointment[]`, required): The appointments.
  - `id` (`string`, required): Appointment id.
  - `startAt` (`integer`, required): Start, epoch seconds (UTC).
  - `endAt` (`integer`, required): End, epoch seconds (UTC).
  - `status` (`string`, required): confirmed, cancelled, completed or no_show. One of `confirmed`, `cancelled`, `completed`, `no_show`.
  - `patientName` (`string`, required): Patient's full name.
  - `patientPhone` (`string`, required): Patient's phone, digits and +.
  - `patientEmail` (`string | null`): Patient's e-mail; null when none.
  - `note` (`string | null`): Note from the booking; null when none.
  - `leadId` (`string`, required): The patient's lead in the clinic's CRM.
  - `serviceId` (`string`, required): The booking service.
  - `serviceName` (`string`, required): Name of the booking service.
  - `resourceId` (`string`, required): The specialist.
  - `resourceName` (`string`, required): Name of the specialist.
  - `source` (`string`, required): Where it was booked: site, widget, panel or api. One of `site`, `widget`, `panel`, `api`.

Example (Appointments on one day):

```json
{
  "appointments": [
    {
      "id": "Onqp5yPLKb3IFff2WKfnV",
      "startAt": 1791181800,
      "endAt": 1791183600,
      "status": "confirmed",
      "patientName": "Jan Nowak",
      "patientPhone": "+48600100200",
      "patientEmail": "jan.nowak@example.com",
      "note": "Pierwsza wizyta, ząb boli przy zimnym.",
      "leadId": "lead_1",
      "serviceId": "bsvc_konsultacja",
      "serviceName": "Konsultacja stomatologiczna",
      "resourceId": "bres_piotr",
      "resourceName": "Piotr Nowicki",
      "source": "api"
    }
  ]
}
```

## Errors

| Status | code | When |
| --- | --- | --- |
| 400 |  | from or to is not YYYY-MM-DD |
| 401 |  | No Authorization header |
| 401 |  | Unknown or rotated key |
| 429 |  | Over 120 requests in this minute |

400 (from or to is not YYYY-MM-DD):

```json
{
  "error": "from/to muszą być datami YYYY-MM-DD"
}
```

401 (No Authorization header):

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

401 (Unknown or rotated key):

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

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.listAppointments(params?: { from?, to? }): Promise<{ appointments: Appointment[] }>`
