Skip to content
Documentation
pozyskajpacjentaDocs

API referenceBooking

List free slots

GET/api/v1/booking/slots

Since
1.2.0
Auth
Bearer key
operationId
getSlots

Free slots of a service, counted live from schedules, time off and booked visits; optionally of one specialist. The range is at most 31 days. Without resource you get the slots of every specialist who performs the service. Responses are never cached (Cache-Control: no-store): availability changes live.

Request

Send the clinic's key in Authorization: Bearer (see API keys).

Query parameters

  • servicestringrequired

    The booking service id (catalog services[].id).

  • resourcestring

    The specialist id (catalog resources[].id); omit for any specialist.

  • fromstring (date)required

    First day, a local date YYYY-MM-DD (inclusive).

  • tostring (date)required

    Last day, a local date YYYY-MM-DD (inclusive).

curl "https://app.pozyskajpacjenta.pl/api/v1/booking/slots?service=bsvc_konsultacja&resource=bres_piotr&from=2026-10-05&to=2026-10-05" \
  -H "Authorization: Bearer $PP_API_KEY"
import { PozyskajPacjentaClient } from "@pozyskajpacjenta/sdk";

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

const { slots } = await client.getSlots({
  serviceId: "bsvc_konsultacja",
  resourceId: "bres_piotr",
  from: "2026-10-05",
  to: "2026-10-05",
});
<?php
$response = wp_remote_get(
    'https://app.pozyskajpacjenta.pl/api/v1/booking/slots?service=bsvc_konsultacja&resource=bres_piotr&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

200Free slots, earliest first.

  • slotsSlot[]required

    The slots.

    Fields of each item (5)
    • resourceIdstringrequired

      The specialist, an id from the catalog's resources.

    • startAtintegerrequired

      Start, epoch seconds (UTC). Send it as startAt to book.

    • endAtintegerrequired

      End, epoch seconds (UTC).

    • localDatestringrequired

      Local date, YYYY-MM-DD.

    • localStartMinintegerrequired

      Local minute of the day (e.g. 570 = 9:30).

Free slots of one specialist on one day (trimmed to three)

{
  "slots": [
    {
      "resourceId": "bres_piotr",
      "startAt": 1791180000,
      "endAt": 1791181800,
      "localDate": "2026-10-05",
      "localStartMin": 480
    },
    {
      "resourceId": "bres_piotr",
      "startAt": 1791180900,
      "endAt": 1791182700,
      "localDate": "2026-10-05",
      "localStartMin": 495
    },
    {
      "resourceId": "bres_piotr",
      "startAt": 1791181800,
      "endAt": 1791183600,
      "localDate": "2026-10-05",
      "localStartMin": 510
    }
  ]
}

Errors

StatuscodeWhen
400A required parameter is missing
400More than 31 days
400Unknown service or specialist
400nfz_phone_onlyAn NFZ service (phone booking only)
401No Authorization header
401Unknown or rotated key
429Over 120 requests in this minute

Branch on the status and code, never on the Polish error text. All statuses in Errors.

400 · A required parameter is missing
{
  "error": "wymagane parametry: service, from (YYYY-MM-DD), to (YYYY-MM-DD)"
}
400 · More than 31 days
{
  "error": "nieprawidłowy zakres dat (max 31 dni)"
}
400 · Unknown service or specialist
{
  "error": "nie znaleziono usługi lub specjalisty"
}
400 · An NFZ service (phone booking only)
{
  "error": "usługa NFZ — rejestracja telefoniczna",
  "code": "nfz_phone_only"
}
401 · No Authorization header
{
  "error": "missing Authorization: Bearer <klucz z panelu Ustawienia>"
}
401 · Unknown or rotated key
{
  "error": "invalid key"
}
429 · Over 120 requests in this minute
{
  "error": "przekroczono limit 120 zapytań/min"
}

Rate limit

  • 120 requests per minute per key, shared by every endpoint.
  • Every response to a valid key carries RateLimit-Remaining and RateLimit-Reset; see Rate limits.

SDK method

client.getSlots(params: { serviceId, resourceId?, from, to }): Promise<{ slots: Slot[] }>

Throws ApiError 400; code: "nfz_phone_only" for an NFZ service.

The TypeScript tab above uses it. Install and errors: TypeScript SDK.