Skip to content
Documentation
pozyskajpacjentaDocs

Resources

Errors

HTTP statuses, error codes and what to do about each.

This page lists every status and error code API v1 answers with, and what your code should do about each. Errors are JSON objects with a human-readable error; where an endpoint knows more, it adds a machine-readable code.

Error
{
  "error": "wymagany kontakt: telefon (pole phone/tel/telefon/phone_number/numer, min. 6 cyfr) albo e-mail (pole email/e-mail/mail)",
  "code": "missing_contact"
}

Branch on the status and the code

error is written in Polish for people and may change; code and the HTTP status do not. Match on them, never on the text. The one exception is 409 on booking, where error is the code itself: "slot_taken".

Statuses

StatusMeaningWhat to do
200, 201Done. 201 means something was created.Read the body.
400The request is not valid; nothing was stored.Fix the request; code says what, when present.
401The key is missing or not valid.Check the header and the key; after a rotation, use the new key.
404Nothing is published at this path or slug, or the clinic's site is not published.Show your own 404.
409The slot was taken in the meantime (booking).Offer one of the slots in the body.
413The upload is larger than 10 MB.Send a smaller file.
415The upload is not a JPEG, PNG, WebP or AVIF image.Convert it.
429Too many requests.Wait Retry-After seconds, then retry. See Rate limits.
5xxSomething failed on our side.Retry later with backoff; nothing is guaranteed to be stored.

Codes

codeStatusWhereMeaning
invalid_json400createLead, sendFeedbackThe body is not JSON. Nothing was stored.
invalid_body400createLead, sendFeedbackThe JSON is not an object, or a field is not valid (the message names it).
missing_contact400createLeadOnly with ?strict=1: the lead has neither a phone nor an e-mail.
invalid_time_request400createLeadOnly with ?strict=1: the request for a time failed validation.
nfz_phone_only400getSlots, createAppointmentThe service is an NFZ one: booking by phone only.
slot_taken409createAppointmentThe slot was taken in the meantime; the body lists that day's free slots.
feedback_rate_limited429sendFeedbackThe hourly limit of remarks for this source is used up.

With the SDK

The SDK throws ApiError for every non-2xx answer, with status, body and code. A taken slot throws SlotTakenError, whose slots are that day's free slots.

TypeScript
import { ApiError } from "@pozyskajpacjenta/sdk";

try {
  await client.createLead(lead, { strict: true });
} catch (error) {
  if (error instanceof ApiError && error.code === "missing_contact") askForPhoneOrEmail();
  else throw error;
}