Skip to the content
Kusties
PhysiotherapistsTrainersClientsClinicsPricingBlog
Overview Booking API referenceReference
Log in
PhysiotherapistsTrainersClientsClinicsPricingBlog
Overview Booking API referenceReference
Log in

Kusties API · for developers

Kusties API: a guide for developers

Booking Show free times and book clients from a website's server: the flows for a specialist's and an organisation's website, with curl, Node and PHP. API reference Every operation, field and error of version 1, generated from the API itself.

The OpenAPI file for code generators and API tools: openapi.yaml (Swagger 2.0).

Contents
  • Kopsavilkums latviski
  • 1. What the API offers
  • 2. Addresses and the sandbox
  • 3. Keys and scopes
  • 4. Authentication and errors
  • 5. Conventions
  • 6. Limits and error codes
  • 7. Versioning
  • 8. Your security duties

The Kusties API connects a specialist's or an organisation's own website or system to their Kusties account. Version 1 covers booking: the account's specialists, locations and services, the free times, and the bookings the website makes, lists, reads, cancels and reschedules. Kusties applies the same rules, limits and e-mails as on its own booking page. The API is for servers only: every request carries an API key, and a browser never calls it.

This guide covers what every part of the API shares: addresses, keys and scopes, authentication, errors, conventions, limits and versioning. The booking guide walks through the booking flows, with examples in curl, Node and PHP.

You need:

  • an API key from the account holder (the specialist, or a manager of the organisation), made in Kusties under «API un integrācijas»;
  • a server that keeps the key secret and calls Kusties over HTTPS;
  • this guide and the booking guide, online at https://kusties.com/developers, and the API reference with every operation and field, at https://kusties.com/developers/reference. The OpenAPI (Swagger 2.0) file behind it, for code generators and API tools, is at https://kusties.com/developers/openapi.yaml.

API version 1. This guide: 21 November 2026. Questions: info@kusties.com (quote the X-Request-ID of the request in question).

Kopsavilkums latviski#

Kusties API savieno speciālista vai organizācijas mājaslapu vai sistēmu ar Kusties kontu. Pirmā versija ir par pierakstu: mājaslapas serveris var rādīt speciālistus, vietas, pakalpojumus un brīvos laikus, pierakstīt klientu un vēlāk skatīt, atcelt vai pārcelt caur API veiktos pierakstus. Kusties piemēro tos pašus noteikumus, ierobežojumus un e-pastus kā savā pieraksta lapā. Pieraksta plūsmas ar piemēriem ir aprakstītas pieraksta ceļvedī.

  • Adreses. Darba vide: https://api.kusties.app/v1 (atslēgas kst_live_…). Testa vide: https://api-sandbox.kusties.app/v1 (atslēgas kst_test_…); tajā netiek sūtīti atgādinājumi, un e-pasti pacientiem tiek sūtīti tikai uz testētāju adresēm.
  • Atslēga. To izveido speciālists vai organizācijas pārvaldnieks Kusties sadaļā «API un integrācijas». Atslēgai izvēlas atļaujas un pēc vajadzības derīguma termiņu, atļautās IP adreses un (organizācijas atslēgai) speciālistus. Atslēga ir redzama tikai vienreiz. Glabājiet to tikai serverī (piemēram, vides mainīgajā KUSTIES_API_KEY), nekad kodā, ko redz pārlūks: pieprasījumu ar galveni Origin Kusties atraida. Sūtiet to katra pieprasījuma galvenē Authorization: Bearer <atslēga>. Ja ir aizdomas par noplūdi, nekavējoties atsauciet atslēgu.
  • Laiks. Visi laiki ir UTC (…Z). Lauks time_zone (pagaidām vienmēr Europe/Riga) norāda laika joslu, kurā ir datumi un dienas daļas.
  • Saraksti. Saraksts ir {data, next_cursor}; nākamo lapu saņem ar cursor=<next_cursor>.
  • Ierobežojumi. Katrai atslēgai: ne vairāk kā 120 pieprasījumu minūtē, 1200 lasīšanas pieprasījumu stundā, 60 pieraksta pieprasījumu stundā un 60 atcelšanas vai pārcelšanas pieprasījumu stundā. Kontam: ne vairāk kā 100 pierakstu caur API 24 stundās. Ja atbildē 429 ir galvene Retry-After, nogaidiet tajā norādīto laiku.
  • Versijas. Versijā 1 izmaiņas API tikai papildina: laukus un vērtības, ko nepazīstat, ignorējiet. Nesaderīgas izmaiņas būs versijā /v2, un versija 1 pēc tās izziņošanas darbosies vēl vismaz 12 mēnešus.

1. What the API offers#

Method and pathScopeWhat it does
GET /meanythe key (its scopes, expiry, IP restriction and specialists) and the account it acts for (a specialist or an organisation, its time zone, the privacy notice's address)
GET /specialistsspecialists:readthe specialists the key reaches: for a specialist's key, the specialist; for an organisation's key, its specialists who take online bookings from anyone
GET /locationslocations:readwhere visits take place: a specialist's main address and practice places, an organisation's branches
GET /servicesservices:readwhat can be booked: a specialist's visit types, an organisation's services
GET /availabilityavailability:readthe free start times of a service over a range of days
POST /bookingsbookings:createbooks a free start for the person who filled in your form
GET /bookingsbookings:readthe bookings the account made through the API, a page at a time
GET /bookings/{id}bookings:readone of them
POST /bookings/{id}/cancelbookings:updatecancels it
GET /bookings/{id}/availabilitybookings:updatethe times it can be rescheduled to
POST /bookings/{id}/reschedulebookings:updatereschedules it

A specialist's key and an organisation's key use the same routes: the key decides the account, and no path names it. A specialist's key books that specialist; an organisation's key books its team, a chosen specialist or any free one. The catalog, the free times and new bookings follow the account's online booking settings (booking guide → Before you start).

New areas will come to version 1 under paths and scopes of their own, without changing these (§7).

2. Addresses and the sandbox#

EnvironmentBase URLKeys
Livehttps://api.kusties.app/v1kst_live_…
Sandboxhttps://api-sandbox.kusties.app/v1kst_test_…

Each environment accepts only its own keys, and refuses the other's with 401 invalid_token, whose message names the prefix it expects. GET /me answers "sandbox": true on the sandbox. On these hosts only /v1 is the API: any other address redirects to this documentation.

The sandbox is Kusties' test environment: it runs the same code as live, gets new releases first, and really sends e-mail. For your tests Kusties sets up a sandbox specialist and a sandbox organisation, both taking online bookings from anyone and allowing online cancelling, and sends you kst_test_ keys for them through a one-time secret link.

  • Bookings made with sandbox keys schedule no reminders (no SMS).
  • Their patient e-mails go only to the addresses on the sandbox's list, whoever changes the booking (the sandbox specialist in Kusties too): tell Kusties your address (or your company's @domain) to see them. E-mails to any other address are not sent.
  • Use only your own name, e-mail address and phone number there; never real patients' data.

3. Keys and scopes#

Who makes them. The specialist, in Kusties on the profile page under «API un integrācijas»; for an organisation, its managers, on the organisation's page under «API un integrācijas» (a receptionist cannot).

Making a key («Izveidot atslēgu»):

  • Name (1–60 characters), so the keys can be told apart, e.g. the website's name.

  • What the key may do («Ko atslēga drīkst darīt»): four groups of scopes. A new key has «Skatīt pakalpojumus un brīvos laikus» and «Pierakstīt» ticked: the four reads and bookings:create, but not bookings:read.

    In KustiesScopesOpens
    «Skatīt pakalpojumus un brīvos laikus»specialists:read, locations:read, services:read, availability:readGET /specialists, /locations, /services, /availability
    «Skatīt pierakstus»bookings:readGET /bookings, /bookings/{id}
    «Pierakstīt»bookings:createPOST /bookings
    «Atcelt un pārcelt pierakstus»bookings:updatePOST /bookings/{id}/cancel, /bookings/{id}/reschedule; GET /bookings/{id}/availability

    GET /me works with any key and lists its scopes. A website that only shows free times and books needs the default; one that later shows a booking's status or lists bookings also needs «Skatīt pierakstus», and one that cancels or reschedules needs «Atcelt un pārcelt pierakstus». The last two reach only the bookings made through the API. Give each key only what the website uses: a call without its scope is refused with 403 api_key_scope_missing, and metadata.scope names the scope it needs.

  • Valid until («Derīga līdz», optional): the key works until the end of the chosen day in Riga time (Europe/Riga) and then stops (401 invalid_token, as for an unknown key). Without a date, it works until it is revoked. Kusties e-mails the specialist, or for an organisation's key its owner and the manager who made the key (while they still manage the organisation), about a week before that day (for a key made at least a week before it) and on the day (if that e-mail goes out only after the key has expired, it says the key has stopped working): the key's name, its hint and the date, never the key. To keep the website working, make a new key, deploy it and revoke the old one before then.

  • Specialists (an organisation's key, optional): «Visi speciālisti» (the default, also those who join the team later) or «Tikai izvēlētie speciālisti» (up to 50). A key limited to some specialists reaches only them: GET /specialists, GET /services and the free times show only them, a booking with any free specialist picks only among them, a request that names another specialist is refused with 403 api_key_specialist_not_allowed (metadata.specialist_id), and the other specialists' bookings answer 404 and are left out of the list. A chosen specialist who leaves the organisation is no longer reached.

  • Allowed IP addresses (optional): up to 10 public IPv4 or IPv6 addresses or networks (CIDR), one per line; a network may be no wider than /16 (IPv4) or /48 (IPv6); private and local addresses are refused. With a list, the key works only from those addresses; a request from anywhere else, or one whose address Kusties cannot tell, is refused (403 api_key_ip_not_allowed). Use it only for a server with a fixed outgoing address, not for serverless functions or hosting whose outgoing address changes.

Making a key needs a sign-in to Kusties within the last 10 minutes (Kusties asks to sign in again otherwise). An account may have at most 10 keys that are not revoked (an expired key counts until it is revoked), and one person may make at most 20 keys in 24 hours (for their own account and the organisations they manage, together). Every new key sends the account a security e-mail (the key's name and hint, who made it and when; never the key).

The key is kst_live_ and 43 more characters (52 in all; kst_test_… on the sandbox). Kusties shows it once, when it is made; it keeps only a fingerprint of the key and its hint (the prefix and the last 4 characters), and cannot show the key again. «API un integrācijas» later shows the hint (kst_live_…Wx3k), the scopes, the expiry (its day in Riga time), the specialists, who made the key and when, and when it was last used and from which IP address (updated at most once a minute).

Keep it safe:

  • Put it in a server environment variable (KUSTIES_API_KEY) or your host's secret store, and read it from there.
  • Never put it in code the browser loads, in the repository, in a URL, in logs, in analytics or error trackers, or in a support ticket. Its fixed prefix kst_ lets secret scanners find a leaked key.
  • Send it only in the Authorization header, only over HTTPS.

Rotate or change a key. A key cannot be edited. To change its scopes, expiry, specialists or addresses, or to rotate it: make a new key, deploy it, check it with GET /me, then revoke the old one. The bookings made with the old key stay readable, cancellable and reschedulable with any other key of the same account that has the scopes.

Revoke a key in «API un integrācijas» («Atsaukt»): it stops at its next request (401 invalid_token). Revoke at once when the key may have leaked, when a developer or agency who had it leaves, or when the website moves to another server. A password change in Kusties does not revoke keys (so a routine password change never breaks the website): revoke a key yourself when in doubt.

What else stops a key: its expiry; the specialist's Kusties account being blocked, closed or no longer a specialist's account (401 invalid_token); an organisation that is not approved (also while Kusties reviews it again after a change of its name or details) or is suspended: its catalog, free times and new bookings answer 404, while GET /me and the reading, listing, cancelling and rescheduling of the bookings made with its keys keep working; Kusties switching the API off (404 on every route).

4. Authentication and errors#

  • The key goes in Authorization: Bearer <key> on every request (the word Bearer in any case). No header: 401 authentication_required. A header in another form, or a key that does not work (malformed, unknown, revoked, expired, or the other environment's): 401 invalid_token. Every 401 carries WWW-Authenticate: Bearer realm="kusties-api". A sign-in token of the Kusties app is not a key and is refused the same way.
  • Browsers are refused. A request that carries an Origin header, which browsers send, is refused with 403 api_browser_not_allowed before the key is read (§8).
  • The order of the checks: a route Kusties has switched off answers 404 not_found; then the limit per calling address, the browser check, the key, the key's limit per minute, the route's scope and the route's own limit. A refused request never counts against a route's limit.
  • Errors answer one JSON shape. Act on code; message is English text for developers, not for patients. fields[] names each refused field of a validation_failed with a code of its own (§6); metadata carries what a code says (scope, specialist_id, limit, retry_after); request_id is the request's X-Request-ID; timestamp is in UTC. A booking with a mistyped phone number, for example:
{
        "success": false,
        "error": "validation",
        "message": "client.phone must be a Latvian number or start with + and the country code",
        "fields": [
          {
            "field": "client.phone",
            "code": "phone",
            "message": "client.phone must be a Latvian number or start with + and the country code"
          }
        ],
        "code": "validation_failed",
        "timestamp": "2026-11-21T21:13:24.64212Z",
        "request_id": "87dacb0a-8e1c-474e-80df-8ecc536abe4b",
        "path": "/v1/bookings",
        "method": "POST"
      }
      

5. Conventions#

  • JSON in UTF-8. Send Content-Type: application/json with a request body. A body over 1 MB is refused (413 request_too_large).
  • Times are RFC 3339 in UTC, ending in Z: 2026-11-24T07:00:00Z. A time you send may carry any offset (2026-11-24T09:00:00+02:00 is the same moment); send a start back exactly as the API gave it. Times count in whole minutes.
  • Time zones, days and parts of the day. The account, specialists, locations, free times and bookings carry time_zone, an IANA time zone, always Europe/Riga today. Days (from, to, next_available.date) are YYYY-MM-DD in that zone, and so are the parts of the day (part: morning before 12:00, day 12:00–17:00, evening from 17:00). Show times to patients in time_zone, e.g. with Intl.DateTimeFormat and its timeZone option, or PHP's DateTimeImmutable::setTimezone().
  • A time in a query string (start_from, start_to): write it in UTC with Z (2026-11-24T00:00:00Z), or encode the offset's + as %2B (2026-11-24T00:00:00%2B02:00). An unencoded + arrives as a space; Kusties reads a space right before the offset as the + it was. A time that does not parse is refused (400 validation_failed, invalid).
  • Ids are UUIDs. A specialist is named by their id (specialist_id), a location by its id (location_id; a specialist's main address has the specialist's own id), a service by its id (service_id: a visit type's for a specialist, a service's for an organisation).
  • Lists answer {"data": […], "next_cursor": …}. While next_cursor is not null, ask for the next page with cursor=<next_cursor>, passed back as it is, and the other parameters unchanged. GET /bookings takes limit (1–100, default 20); the catalog lists (/specialists, /locations, /services) come in one page today, but read next_cursor there too. A cursor that is not one Kusties gave is refused (400, field cursor, code invalid). A single object is answered as it is, without data.
  • Prices are euro cents (price_cents: 4500 is €45.00).
  • Optional fields are left out when they have no value; lists are always present, possibly empty. Ignore fields and values you do not know (§7).
  • Retries of a booking: send an Idempotency-Key header with every POST /bookings, a new one for every booking attempt; a retry with the same key and the same request is answered with the first booking, and nothing is booked twice (booking guide → Retries).
  • X-Request-ID: every answer carries one. Send your own (up to 64 letters, digits, -, _ or .) and Kusties uses it; otherwise it makes one. Log it with your own request and quote it when you contact Kusties.
  • Caching. Kusties never lets its answers be cached (Cache-Control: no-store). Cache the reads yourself, the catalog and each range of free times, for up to 60 seconds, never longer: a cached free time may already be taken. After a 409 booking_slot_taken, drop the cached free times and read them again.
  • Retry-After (seconds) comes with every 429 that can be retried (rate_limited, api_daily_limit_reached); booking_limit_reached has none.

6. Limits and error codes#

Limits. A 429 with Retry-After can be retried after that many seconds; tell the patient to try later or to call the practice rather than wait in the request.

LimitHow muchWhat countsAnswer
Per key: all requests120 a minuteevery request with the key429 rate_limited
Per key: reads1,200 an hourevery GET429 rate_limited
Per key: booking requests60 an hourevery POST /bookings, refused ones too429 rate_limited
Per key: cancels and reschedules60 an hourevery POST …/cancel and …/reschedule429 rate_limited
Per calling address6,000 an hourevery request to the API, all keys together (IPv6: per /64), before the key is checked429 rate_limited
Per account100 bookings in 24 hoursbookings made through the API with all the account's keys; refused requests and replays do not count429 api_daily_limit_reached (metadata.limit, metadata.retry_after)
The booking page's limits3 open future bookings per e-mail address or phone number with one specialist; 30 online bookings per specialist per dayshared with Kusties' own booking page, its booking widget and organisation pages429 booking_limit_reached (no Retry-After)
The specialist's settingsthe booking window (max_days_ahead), the earliest notice, the step between start times, a daily cap of online bookingsthe free times leave those starts outa booking of one: 409 booking_slot_taken
Making keys (in «API un integrācijas», not through the API)20 new keys in 24 hours per personevery key one person makes, for their own account and the organisations they manage togetherKusties makes no further key until then

Error codes.

StatuscodeWhenWhat your website does
400validation_faileda field or query parameter is wrong (fields[], below); privacy_notice_shown not true; a service that cannot be booked online (service_id, oneof)correct the request; show the patient the field (e.g. the phone)
401authentication_requiredno Authorization headerfix your configuration
401invalid_tokenthe key is malformed, unknown, revoked, expired, the other environment's, or a specialist's key whose account is blocked, closed or no longer a specialist'sstop and alert your administrator; do not retry
403api_browser_not_allowedthe request carried an Origin header (a browser, or a proxy that forwarded it)call from your server; do not forward Origin (§8)
403api_key_ip_not_allowedthe request did not come from the key's allowed addresses (or Kusties could not tell its address)check your server's outgoing address and the key's list
403api_key_scope_missingthe key lacks the scope; metadata.scope names ita new key with that scope
403api_key_specialist_not_allowedthe request names a specialist the key does not reach: another specialist than a specialist's key's own, or one an organisation's key is not limited to; metadata.specialist_idleave that specialist out, or use a key that reaches them
404booking_unavailablethe specialist does not take online bookings from anyone now; the service is not offered online; the organisation is not approved, or is suspended (its free times and bookings); an organisation's key while Kusties' organisations are offshow "Online booking is not available; please contact the practice"
404organization_unavailablean organisation's GET /specialists, /locations or /services while it is not approved, or is suspendedas above
404booking_not_foundnot a booking the account made through the API, or one the key does not reach (also a malformed id; for an organisation, its specialist has left)stop showing it
404not_foundKusties has switched the API (or rescheduling) offtreat as unavailable
409booking_slot_takenthe time is no longer free, no specialist (or not the chosen one) is free then, the chosen specialist does not offer the service, or the start is no longer at location_idread the free times again and let the patient choose
409idempotency_key_reusedthe Idempotency-Key was used before with another requesta bug: one key per booking attempt
409booking_cancel_closedpast the cancelling deadline, cancelling online is off, or the visit is overtell the patient to contact the specialist
409booking_move_closedpast the deadline, rescheduled 3 times, rescheduling online is off, or the booking is cancelled, declined or pastas above
413request_too_largethe body is over 1 MBa bug
429rate_limited, api_daily_limit_reached, booking_limit_reachedthe limits abovewait for Retry-After where given; tell the patient
500, 502, 503, 504nonea fault at Kusties or on the wayretry a booking with the same Idempotency-Key, a few times at most, with a pause

Field codes. A 400 validation_failed names each field in fields[] with its own code: required, email, max, oneof (not one of the values allowed, or a service that cannot be booked), phone, uuid, date (not YYYY-MM-DD), range (limit outside 1–100; to before from, or more than 31 days in all), invalid (a start_from, start_to or cursor that does not parse), characters, or type (a JSON value of the wrong type, such as "privacy_notice_shown": "true"). The patient's fields are named as the request nests them: client.first_name, client.phone. A body that cannot be read is reported on the field body: json (not valid JSON), required (no body) or invalid (a value that does not parse, such as a start_time without its offset, or a service_id that is not a UUID; the answer's message says which). Ids and times sent back exactly as the API gave them never fail this way.

7. Versioning#

  • The version is in the path (/v1). Within version 1, changes only add: new fields in answers, new optional request fields, new values in a list of values (a new status, format or scope), new error codes, and new routes and areas. Your code must ignore what it does not know, treat an unknown status sensibly (for example as "please check with the practice"), and not depend on the order of fields.
  • A change that would break a working integration (a removed or renamed field, or a changed meaning) comes as a new version under a new path (/v2), and version 1 keeps working for at least 12 months after the new one is announced.
  • The API reference and its OpenAPI file always describe version 1 as it is; they are updated when something is added.

8. Your security duties#

Your website or system collects patients' data before Kusties does, and acts for the specialist (or the organisation), who answers for it: agree the processing of patients' data with the account holder (GDPR Article 28).

  1. Call from your server, never from a browser. The key stays on your server. Kusties refuses every request that carries an Origin header (403 api_browser_not_allowed), so a key put into a web page's code fails at its first use; a server that passes the browser's requests on must not forward Origin (nor cookies).
  2. TLS only. Call https:// only, and do not follow redirects with the key (the booking guide's examples refuse both). A key that has crossed the network once over plain http:// has to be revoked.
  3. No patient data in logs. Never log names, contacts, comments or request bodies, in your logs, analytics or error trackers. Log the booking's id, the error code and the X-Request-ID instead.
  4. Kusties' privacy notice before a booking. Your form shows Kusties' short notice with a link to privacy_notice_url (from GET /me) before it sends a booking, and says so with privacy_notice_shown: true (booking guide → Your website's duties).
  5. Only bookings people make themselves. Send only the bookings people make through your website or app: no imports, no bookings for someone who did not ask, no test bookings on live. Staff who book on someone's behalf do so in Kusties itself.
  6. Your own bot check and limits. Kusties does not see your visitors and does not run its bot check on this path; it limits each key and account (§6). Protect your form yourself (for example Cloudflare Turnstile, hCaptcha or reCAPTCHA) and limit bookings per visitor, or one abusive visitor can use up your website's budget for everyone.
  7. Look after the key (§3): only the scopes the website uses, an IP list for a server with a fixed address, an expiry for a temporary integration; revoke it at once on any suspicion and when people who had it leave.
Kusties

Exercise programmes that patients actually do. Built for physiotherapists, coaches and clinics.

Product

  • Home page (in Latvian)
  • Pricing (in Latvian)
  • Developers
  • Create your first programme

Solutions (in Latvian)

  • Physiotherapists
  • Clinics and medical centres
  • Personal trainers
  • Clients and patients

Contact

  • info@kusties.com
  • +371 22 322 885
  • Log in

Legal

  • Security
  • Terms of Service
  • Privacy Policy
  • Data Processing Agreement
  • For patients
  • Client cabinet terms
  • Latviski

© 2026 Kusties. All rights reserved.

SIA “Kusties.com”, reg. No. 50203259371, VAT LV50203259371, Ābolu iela 14C, Mārupe, Mārupes nov., LV-2167