Skip to the content
Language: English

Referral API · v1

Refer a patient and book the first appointment — from your own system

For insurers and other referrers. See a clinic’s available times, send the referral with the case number and the number of sessions granted, and book the first appointment in the same call. The patient gets the clinic’s own invitation and fills in the rest themselves; you get the status back, and never anything clinical.

Get a key Collect your live key

Quick start

Your first referral in five minutes

Three calls against the test clinic — a built-in, made-up clinic that every test key can use at once. Nothing is stored, nobody gets a message, and every response is marked "test": true. You need a terminal with curl and your test key.

Terminal
export ANOTERA_KEY="ah_test_…"      # paste your test key
  1. See the clinic

    Who works there, which services you can book, and the rules that apply to you.

    Request
    curl https://anotera.clinic/api/referral/v1/clinics/kl_testclinic01 \
      -H "Authorization: Bearer $ANOTERA_KEY"
    Response · 200
    {
      "id": "kl_testclinic01",
      "name": "Anotera Test Clinic",
      "address": "Eksempelvej 1, 2000 Frederiksberg, Denmark",
      "time_zone": "Europe/Copenhagen",
      "api_base": "https://anotera.clinic/api/referral/v1",
      "practitioners": [
        {
          "id": "pr_test_anna",
          "name": "Anna Test",
          "title": "Authorised psychologist",
          "languages": ["da", "en"]
        },
        {
          "id": "pr_test_omar",
          "name": "Omar Example",
          "title": "Authorised psychologist",
          "languages": ["da", "en", "ar"]
        }
      ],
      "services": [
        {
          "id": "sv_test_first",
          "name": "First session",
          "duration_minutes": 60,
          "mode": "in_person_or_video"
        },
        {
          "id": "sv_test_session",
          "name": "Individual session",
          "duration_minutes": 50,
          "mode": "in_person_or_video"
        },
        {
          "id": "sv_test_video",
          "name": "Video session",
          "duration_minutes": 50,
          "mode": "video"
        }
      ],
      "cancellation_notice_hours": 24,
      "booking": "immediate",
      "booking_horizon_days": 60,
      "permissions": ["refer", "status", "sessions"],
      "test": true
    }
  2. See the available times

    Ask for one of the services from step 1. Without from and to you get the next 14 days.

    Request
    curl -G https://anotera.clinic/api/referral/v1/clinics/kl_testclinic01/availability \
      -d service_id=sv_test_first \
      -H "Authorization: Bearer $ANOTERA_KEY"
    Response · 200
    {
      "clinic_id": "kl_testclinic01",
      "from": "2026-11-14",
      "to": "2026-11-27",
      "time_zone": "Europe/Copenhagen",
      "slots": [
        {
          "start": "2026-11-16T09:00:00+01:00",
          "end": "2026-11-16T10:00:00+01:00",
          "practitioner_id": "pr_test_anna",
          "service_id": "sv_test_first",
          "mode": "in_person_or_video"
        },
        {
          "start": "2026-11-16T09:00:00+01:00",
          "end": "2026-11-16T10:00:00+01:00",
          "practitioner_id": "pr_test_omar",
          "service_id": "sv_test_first",
          "mode": "in_person_or_video"
        },
        …
      ],
      "test": true
    }

    Your dates will differ — the test clinic’s calendar is calculated from today.

  3. Refer and book

    Copy one start from step 2 into the first line. The three values in appointment come straight from a slot.

    Request
    START="2026-11-16T09:00:00+01:00"       # paste a "start" from step 2
    
    curl -X POST https://anotera.clinic/api/referral/v1/clinics/kl_testclinic01/referrals \
      -H "Authorization: Bearer $ANOTERA_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: quickstart-001" \
      --data @- <<EOF
    {
      "external_id": "CASE-2026-001",
      "patient": {
        "first_name": "Anna",
        "last_name": "Berg",
        "phone": "+4520123456",
        "email": "anna@example.com"
      },
      "case_number": "S-2026-0457",
      "sessions_granted": 8,
      "appointment": {
        "start": "$START",
        "practitioner_id": "pr_test_anna",
        "service_id": "sv_test_first"
      }
    }
    EOF
    Response · 201
    {
      "id": "ref_VgU4FxBtxqGNVAn4xksMVA",
      "clinic_id": "kl_testclinic01",
      "external_id": "CASE-2026-001",
      "status": "booked",
      "appointment": {
        "start": "2026-11-16T09:00:00+01:00",
        "end": "2026-11-16T10:00:00+01:00",
        "practitioner_id": "pr_test_anna",
        "service_id": "sv_test_first",
        "mode": "in_person",
        "booked_by": "referrer"
      },
      "first_appointment_booked": true,
      "patient_invited": true,
      "patient_completed": false,
      "case_number": "S-2026-0457",
      "invoice_reference": null,
      "created_at": "2026-11-14T04:58:31+01:00",
      "updated_at": "2026-11-14T04:58:31+01:00",
      "sessions": {
        "granted": 8,
        "used": 0,
        "remaining": 8,
        "valid_until": null
      },
      "test": true
    }

That is the whole integration: a referral exists, the first appointment is booked, and id is your handle on it from here. Two things worth trying before you move on:

  • Run step 3 again, unchanged. You get the same response back — not a second referral. That is the Idempotency-Key header at work.
  • Book 12:00. In the test clinic, 12:00 is always taken. Change START to a weekday at T12:00:00+01:00, and give external_id and Idempotency-Key new values (it is a new request): you get 409 slot_taken with five alternatives.

Going live is the same three calls with your live key (ah_live_…) and a real clinic’s id instead of kl_testclinic01. If you use webhooks, set the address once more with the live key.

Getting access

One key for your organisation. Each clinic says yes for itself.

The key says who you are. The clinic says what you may do. An organisation with agreements with 300 clinics holds one key, not 300 — and a clinic id alone opens nothing: the clinic must have connected your organisation in its own settings, and can disconnect it with one click.

  1. Sign up — and get a test key at once

    Fill in the sign-up page: your organisation’s name, registration number, website and a technical contact. You get a test key (ah_test_…) that works immediately against the test clinic, and a claim code. Both are shown once; we keep only a fingerprint. A person at Anotera then checks that the organisation is who it says it is — and when you are approved, you collect your live key (ah_live_…) yourself with the claim code. The live key never passes through an email, and never through us.

    Get a key

  2. Each clinic connects you — and gives you its clinic id

    A clinic you work with switches your organisation on under Setup → Referrers in Anotera and gives you its clinic id (kl_ + 12 characters). You can also look the ids up: GET /clinics lists every clinic that has connected you. Not connected yet? Ask from your side with POST /clinics/{clinic_id}/connection — the clinic’s administrator gets the request and answers it. And a clinic you have no agreement with can apply to work with you; nothing opens until you accept.

  3. Call

    Send the key as a Bearer token and the clinic id in the path. That is all the configuration there is.

Test key

ah_test_… — works only against the test clinic kl_testclinic01. Validates everything, stores nothing, messages nobody.

Live key

ah_live_… — works only against real clinics that have connected you. Never against the test clinic.

While your organisation waits for approval it has no access to any real clinic, is not on any clinic’s list, and cannot ask a clinic for access. The test key works the whole time.

POST/signup

What the sign-up page calls — no key needed. Creates your organisation as pending_review and returns the test key and the claim code, once.

Request body
FieldTypeRequiredMeaning
organisation_namestring ≤ 80yesThe organisation’s name.
vat_numberstringyesCompany registration or VAT number.
countrystring, 2 lettersyesE.g. DK.
websitestringyesThe organisation’s web address.
contact_namestring ≤ 80yesA person we can reach.
emailemailyesA work address at your organisation’s own domain.
phonestringyesInternational form, e.g. +4533123456.
purposestring ≤ 500noWhat you will use the API for.
applications_emailemailnoWhere applications from clinics are sent. Can be changed with PUT /settings.
accept_termsbooleanyesMust be true: the clinic is the data controller, and access to a clinic requires the clinic’s own yes. The terms.
Response · 201
{
  "status": "pending_review",
  "organisation_id": "hv-3f9c1a2b7d04",
  "name": "Nordlys Forsikring A/S",
  "test_key": "ah_test_…",
  "claim_code": "ac_…",
  "test_clinic_id": "kl_testclinic01",
  "claim_url": "https://anotera.clinic/en/api/henvisere/noegle/",
  "email_confirmation": true
}

If the organisation is already known to us — the same registration number, or the same email domain — no new organisation is created and no key is issued: the answer is 202 {"status": "received"}, and we get back to you. At most 5 sign-ups per hour from one address.

POST/signup/claim

What the claim page calls — no key needed. Body: {"organisation_id": "hv-…", "claim_code": "ac_…"}. When your organisation is approved, the live key is created at that moment and returned once, and the claim code is used up. Not approved yet: {"status": "pending_review"}, no key — the code stays valid. A wrong code answers exactly like an unknown organisation (404 not_found). At most 5 attempts per hour, per address and per organisation. Lost the code? We issue a new one, after checking who you are.

Response · 200
{
  "status": "approved",
  "organisation_id": "hv-3f9c1a2b7d04",
  "name": "Nordlys Forsikring A/S",
  "api_key": "ah_live_…"
}

Basics

Plain HTTPS and JSON

Base URLhttps://anotera.clinic/api/referral/v1
AuthenticationAuthorization: Bearer <key> on every call except / and /openapi.json
FormatJSON in, JSON out, UTF-8. Unknown fields in a request are refused with the field’s name — a typo never passes silently. Text fields are single lines: a line break becomes a space, and control characters are refused. Only note_to_clinic keeps its line breaks.
TimesISO 8601 with offset, in the clinic’s time zone: 2026-11-16T09:00:00+01:00. Dates are YYYY-MM-DD.
IdsStrings. Clinics kl_…, referrals ref_… (random, not sequential). Practitioner and service ids come from GET /clinics/{clinic_id}.
Test modeEvery response made with a test key carries "test": true.
Not foundA clinic id that does not exist and a clinic that has not connected you give the same 404. You cannot use the API to find out which clinics use Anotera.
Every request
Authorization: Bearer ah_live_…
Content-Type: application/json        (on POST and PUT)
Idempotency-Key: <your unique string>  (on POST and PUT — recommended)

A machine-readable description of every endpoint is at /openapi.json (OpenAPI 3.1) — import it into Postman, or generate a client from it. GET https://anotera.clinic/api/referral/v1/ answers with the version and these links. Neither needs a key.

Clinics & availability

What a clinic has opened to you

GET/clinics

The clinics that have connected your organisation. Use it to discover clinic ids, or to check that a connection is in place.

Request
curl https://anotera.clinic/api/referral/v1/clinics \
  -H "Authorization: Bearer $ANOTERA_KEY"
Response · 200
{
  "clinics": [
    {
      "id": "kl_testclinic01",
      "name": "Anotera Test Clinic",
      "address": "Eksempelvej 1, 2000 Frederiksberg, Denmark",
      "time_zone": "Europe/Copenhagen",
      "api_base": "https://anotera.clinic/api/referral/v1"
    }
  ],
  "test": true
}
Each clinic
FieldTypeMeaning
idstringThe clinic id to use in every other call.
namestringThe clinic’s name.
addressstringStreet address, as the clinic publishes it. May be empty.
time_zonestringIANA time zone, e.g. Europe/Copenhagen.
api_basestringWhere to call this clinic. Today always this server; the field exists so that a clinic running in its own environment can point elsewhere later. Use it if you want to be ready for that.

GET/clinics/{clinic_id}

One clinic: practitioners, services and the rules for your organisation — only what the clinic has opened to you. The quick start shows a full response.

Response — in addition to the fields above
FieldTypeMeaning
practitioners[]arrayid, name, title, languages (ISO 639-1). Only the practitioners the clinic has opened to you.
services[]arrayid, name, duration_minutes and mode: in_person, video or in_person_or_video.
cancellation_notice_hoursintegerHow many hours before the start an appointment can still be moved or cancelled through the API.
bookingstringimmediate: a booking is final at once. requires_approval: the clinic looks at each referral first — see statuses.
booking_horizon_daysintegerHow far ahead you can see and book.
permissions[]arrayWhat the clinic lets you do: refer (refer and book), status (read your referrals), sessions (see sessions used — off unless the clinic turns it on).

GET/clinics/{clinic_id}/availability

The times you can book. You never see who is booked or why a time is unavailable — only what is free. Ask for at most 31 days per call.

Query parameters
FieldTypeRequiredMeaning
service_idstringyesA service id from the clinic.
fromdatenoFirst day. Default: today.
todatenoLast day. Default: from + 13 days. At most from + 30.
practitioner_idstringnoOnly this practitioner.
Each slot
FieldTypeMeaning
startdate-timeSend this value back, unchanged, to book the slot.
enddate-timestart + the service’s duration.
practitioner_idstringWho the time is with.
service_idstringThe service you asked for.
modestringAs on the service.

A slot is a snapshot. Between your availability call and your booking, someone else may take the time — then the booking answers 409 slot_taken with the next five free times, so you can offer one straight away.

Referrals

Refer, book, follow

POST/clinics/{clinic_id}/referrals

Creates the referral. With appointment the first appointment is booked in the same call; without it, the patient is invited to choose a time themselves. Either way the clinic gets a patient card with the details you sent, a grant from case_number / sessions_granted / valid_until, and — unless you say otherwise — the patient gets the clinic’s own invitation by text message or email, with a link where they fill in the rest (address, national id, consent).

Request body
FieldTypeRequiredMeaning
external_idstring ≤ 80yesYour own id for the referral (printable ASCII, no spaces). Unique per clinic: sending it again answers 409 duplicate_external_id with the existing referral_id.
patientobjectyesSee below.
case_numberstring ≤ 60noYour case number. Printed on the clinic’s invoice to you when its invoicing rule says so.
invoice_referencestring ≤ 60noYour own text for the invoice (a purchase order, a cost centre).
sessions_grantedinteger 1–200noHow many sessions you have granted. The clinic counts against it.
valid_untildatenoLast day the grant is valid.
note_to_clinicstring ≤ 2000noConfidential text for the psychologist. Never returned.
appointmentobjectnoBook the first appointment now. See below. Without it the patient is invited to book.
practitioner_idstringnoOnly without appointment: the practitioner the patient is invited to. Default: the clinic’s first.
service_idstringnoOnly without appointment: the service the patient is invited to book.
notify_patientbooleannoDefault true: the clinic’s invitation goes to the patient. false: nothing is sent; the clinic contacts the patient itself.
patient
FieldTypeRequiredMeaning
first_namestring ≤ 60yesA first name is enough — the patient completes the rest.
last_namestring ≤ 60no
phonestringone of the twoInternational form, +4520123456. The invitation is sent here.
emailstringone of the twoAt least a phone or an email; both is best.
date_of_birthdateno
national_idstringnoCPR number (Denmark: ten digits, with or without a dash). Stored on the patient’s card; the patient is then not asked for it. Never returned.
appointment
FieldTypeRequiredMeaning
startdate-timeyesA start from availability, with offset.
practitioner_idstringyesFrom the same slot.
service_idstringyesFrom the same slot.
modestringnoin_person (default) or video, when the service allows both.
Request — invite the patient to book
curl -X POST https://anotera.clinic/api/referral/v1/clinics/kl_testclinic01/referrals \
  -H "Authorization: Bearer $ANOTERA_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 3f6c2f0e-0b0d-4f6e-9a55-2d0f6a1c7e11" \
  -d '{ "external_id": "CASE-2026-002",
        "patient": { "first_name": "Bo", "email": "bo@example.com" } }'
Response · 201
{
  "id": "ref_XucIxm8Nd8AQanfogCydUA",
  "clinic_id": "kl_testclinic01",
  "external_id": "CASE-2026-002",
  "status": "invited",
  "appointment": null,
  "first_appointment_booked": false,
  "patient_invited": true,
  "patient_completed": false,
  "case_number": null,
  "invoice_reference": null,
  "created_at": "2026-11-14T04:58:31+01:00",
  "updated_at": "2026-11-14T04:58:31+01:00",
  "test": true
}

Existing patients look exactly like new ones. If the phone number and the email both match a patient the clinic already has, the referral is attached to that card — and the response is the same in every field. You cannot learn from the API whether someone was already a patient.

national_id and note_to_clinic are write-only. They are stored with the clinic and never come back in any response, webhook or log. Write nothing in note_to_clinic that the clinic does not need.

The referral object

Returned by every call in this section.

FieldTypeMeaning
idstringThe referral id.
clinic_idstringThe clinic.
external_idstringYour own id, as you sent it.
statusstringSee statuses.
appointmentobject | nullThe appointment you booked: start, end, practitioner_id, service_id, mode, booked_by. A time the patient booked is never shown.
first_appointment_bookedbooleanA first appointment exists — booked by you or by the patient.
patient_invitedbooleanThe clinic’s invitation has gone out.
patient_completedbooleanThe patient has filled in their own details with the clinic.
case_numberstring | nullAs it stands on the grant at the clinic.
invoice_referencestring | null
sessionsobjectOnly when the clinic has given you the sessions permission: granted, used, remaining, valid_until.
created_at, updated_atdate-time

Statuses

StatusMeaning
invitedThe referral is with the clinic; no first appointment yet. The patient has been invited to book (or the clinic will contact them).
bookedA first appointment exists — booked by you (then appointment shows it) or by the patient.
pending_approvalThe clinic looks at each referral first (booking: "requires_approval"). Nothing has been sent to the patient and no time is held. You get referral.approved or referral.declined. On approval the time you asked for is booked if it is still free; otherwise the patient is invited to book.
cancelledThe appointment you booked was cancelled, and there is no other. The referral is still open.
closedThe clinic declined the referral, or the patient’s course with the clinic has ended.

GET/referrals/{referral_id}

One referral — only your own. Someone else’s id, and an id that does not exist, give the same 404.

GET/referrals

Your referrals across all your clinics, oldest first. Poll it with updated_since, or — better — use webhooks.

Query parameters
FieldTypeRequiredMeaning
clinic_idstringnoOnly this clinic.
statusstringnoOne of the statuses above.
updated_sincedate-timenoOnly referrals changed at or after this time.
limitintegerno1–100, default 50.
cursorstringnonext_cursor from the previous page. null means there are no more.
Response · 200
{
  "referrals": [
    {
      "id": "ref_XucIxm8Nd8AQanfogCydUA",
      "clinic_id": "kl_testclinic01",
      "external_id": "CASE-2026-002",
      "status": "invited",
      "appointment": null,
      "first_appointment_booked": false,
      "patient_invited": true,
      "patient_completed": false,
      "case_number": null,
      "invoice_reference": null,
      "created_at": "2026-11-14T04:58:31+01:00",
      "updated_at": "2026-11-14T04:58:31+01:00",
      "test": true
    }
  ],
  "next_cursor": null,
  "test": true
}

PUT/referrals/{referral_id}/appointment

Books the first appointment on a referral that has none, or moves the one you booked. Send a start from availability. Moving keeps the practitioner and the service; inside the clinic’s cancellation notice the answer is 409 cancellation_window_passed. If the patient has already booked a time themselves, there is nothing to book: 409 already_booked.

Request body
FieldTypeRequiredMeaning
startdate-timeyesA start from availability.
practitioner_idstringnoMust be the practitioner the referral is with. Leave it out.
service_idstringwhen bookingRequired when the referral has no service yet. Cannot change when moving.
modestringnoin_person or video.
Request
curl -X PUT https://anotera.clinic/api/referral/v1/referrals/ref_VgU4FxBtxqGNVAn4xksMVA/appointment \
  -H "Authorization: Bearer $ANOTERA_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "start": "2026-11-17T10:30:00+01:00" }'

DELETE/referrals/{referral_id}/appointment

Cancels the appointment you booked. The clinic’s cancellation rules apply: closer to the start than cancellation_notice_hours the answer is 409 cancellation_window_passed, and the message says how many hours the clinic requires. The referral stays, with status cancelled; the patient can still book, and so can you.

POST/referrals/{referral_id}/extend

More sessions granted. The grant at the clinic is updated and the psychologist is told — it is the message she is otherwise waiting for by email.

Request body
FieldTypeRequiredMeaning
sessions_grantedinteger 1–200yesThe new total granted on the referral — not the number added. Cannot be lower than the current total.
valid_untildatenoNew last day.
invoice_referencestring ≤ 60noReplace the invoice reference.
Request
curl -X POST https://anotera.clinic/api/referral/v1/referrals/ref_VgU4FxBtxqGNVAn4xksMVA/extend \
  -H "Authorization: Bearer $ANOTERA_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "sessions_granted": 12, "valid_until": "2027-06-30" }'

Connecting a clinic

Ask a clinic to connect you

The usual way is the clinic’s own: it switches you on in its settings and gives you its id. When you have the id but no connection yet, you can ask from your side.

POST/clinics/{clinic_id}/connection

Puts a request in front of the clinic’s administrator: «<Your organisation> asks for access to see available times and refer patients», with Connect and Decline. The answer is always 202 {"status": "requested"} — whether or not the id exists — so the call cannot be used to probe for clinics. Optional body: {"message": "…"} (≤ 200 characters, shown to the clinic as plain text).

Request
curl -X POST https://anotera.clinic/api/referral/v1/clinics/kl_3d57d7687c87/connection \
  -H "Authorization: Bearer $ANOTERA_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "message": "We have a framework agreement with you from 1 December." }'
Response · 202
{
  "status": "requested"
}

GET/clinics/{clinic_id}/connection

none, requested, interested or connected. none is also the answer for an id that does not exist and for a clinic that has said no — a clinic’s no is the clinic’s own business. interested means the clinic has applied to work with you and waits for your answer. When the clinic connects you, you get the webhook clinic.connected.

At most 50 requests per day across all clinics, and one per clinic every 30 days after a decline. Requests over the limit still answer 202 and are dropped. If the clinic had already applied to work with you, your request is your yes: the two of you are connected at once.

Applications

Clinics that want to work with you

A connection has two sides, and it only applies when both have said yes. When a clinic switches your organisation on without you having asked first, that is an application: the clinic has made its choices (which services and practitioners, immediate booking or approval), but you get no access to its calendar until you accept. Accept, and the connection is live without another click from the clinic.

You hear about an application in three ways:

  • The webhook clinic.interested — with the clinic_id. If the clinic withdraws before you answer: clinic.application_withdrawn.
  • The list GET /clinics?status=interested — and the clinic’s business profile with GET /clinics/{clinic_id}.
  • An email to the address you have given for applications — sent from the clinic’s own mailbox, so a reply (a call, a contract) goes straight to the clinic. It carries the profile and two links, Accept and Decline. The links open a page that shows what you are answering; nothing happens until you press the button there. They work once and for 30 days. If the clinic has no mailbox set up, or you have given no address, no email is sent — the application is still in the API.

GET/clinics?status=interested

The clinics that have applied and wait for your answer, oldest first. Without the parameter, GET /clinics lists connected clinics only, as before.

Response · 200
{
  "clinics": [
    {
      "id": "kl_3d57d7687c87",
      "name": "Psykologerne Havn",
      "address": "Havnegade 1, 2100 København Ø",
      "time_zone": "Europe/Copenhagen",
      "api_base": "https://anotera.clinic/api/referral/v1",
      "status": "interested",
      "applied_at": "2026-11-14T10:12:00+01:00",
      "first_available_in_days": 3
    }
  ]
}

GET/clinics/{clinic_id} — for an applicant

For a clinic with status interested the answer is its business profile — exactly what the clinic saw in its own preview before it sent the application. The clinic’s own business details, and never anything about patients. No practitioner or service ids: there is nothing to book until you accept, and every other call for the clinic (availability, referrals) still answers 404.

The profile
FieldTypeMeaning
id, namestringThe clinic id and the clinic’s name.
statusstringAlways interested here.
applied_atdate-timeWhen the clinic applied.
messagestring | nullA short greeting from the clinic (≤ 600 characters), plain text.
vat_numberstring | nullThe clinic’s company registration number.
address, websitestring | nullWhere the clinic is.
contactobjectname, phone, email — the person at the clinic who applied.
practitioners[]arrayOnly the practitioners the clinic chose to include: name, title, authorised (boolean), authorisation_id (when the profile has it), languages, methods, modes (in_person, video).
first_available_in_daysinteger | nullDays until the clinic’s first available time, worked out at the moment you ask. null: none within 60 days.

PUT/clinics/{clinic_id}/connection

Your answer. Body: {"status": "accepted"} or {"status": "declined", "message": "…"} (the message is optional, ≤ 200 characters, shown to the clinic as plain text). accepted connects the clinic at once — you get clinic.connected, and the clinic’s administrator is told. declined tells the clinic no, with your message. Without an application the answer is the same 404 as for an id that does not exist; for a clinic that is already connected, accepted answers connected and declined answers 409 already_connected (a connection is ended by the clinic).

Request
curl -X PUT https://anotera.clinic/api/referral/v1/clinics/kl_3d57d7687c87/connection \
  -H "Authorization: Bearer $ANOTERA_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "status": "accepted" }'
Response · 200
{
  "status": "connected"
}

GET PUT/settings

Switch applications on or off, and say where the email about them goes. Send only the fields you want to change. With accepting_applications: false clinics see «not accepting applications through Anotera right now» next to your name — and you can still ask a clinic yourself. A test key validates the call and changes nothing.

FieldTypeMeaning
accepting_applicationsbooleanDefault true.
applications_emailemail | nullWhere the clinic’s email is sent. null: no email — applications still show in the API. The address is never shown to a clinic.

What the page behind the links in the email calls — no key needed, and POST only, so a mail scanner that opens a link changes nothing. /applications/view takes {"token": "…"} and returns your organisation’s name and the clinic’s profile; /applications/respond takes {"token": "…", "status": "accepted" | "declined", "message": "…"}. The token works once and for 30 days. Accepting this way gives access only to whoever already holds your API key.

A clinic can apply to you once every 90 days after a decline or without an answer, and can withdraw its application — then it disappears from your list. A clinic sends at most 20 applications a day.

Invoicing

Tell every clinic how you want to be invoiced — once

Put your invoicing terms in once. Each clinic sees them in plain words when it connects you (or applies to you), says yes — and from then on its system invoices you automatically, the way you asked: per session or once a month, one invoice per patient or one combined, with the references you need on every line. No clinic has to type your rules in, and no invoice comes back because a case number was missing.

Three things your terms cannot do. They never change a clinic’s invoicing silently: each clinic has said yes to one version, and a new version waits for the clinic’s administrator, who chooses «use the new terms» or «keep mine» — until then the old rule applies. They cannot set a price: the price is the clinic’s own. And a national id is only printed on an invoice when the clinic explicitly ticks the box for it.

GET PUT/settings/invoicing

Your terms. With PUT, send only the fields you want to change; null resets a field, and delivery and bill_to are replaced as a whole. version counts up only when something actually changed. A test key validates the call and changes nothing.

Fields
FieldTypeDefaultMeaning
billingclinic_invoices | self_billingclinic_invoicesself_billing: you issue the document yourself and the clinic makes no invoice — see Self-billing.
scheduleper_session | monthlymonthlyper_session: an invoice as soon as a session has been held. monthly: the previous month, on invoice_day.
invoice_dayinteger 1–281With monthly: the day of the month on which the previous month is invoiced.
groupingper_patient | combined | statement_onlyper_patientcombined: one invoice with every patient’s sessions, the references on each line. statement_only: no invoice — the clinic keeps a monthly statement. Both need monthly.
required_referencesarray["case_number"]What must be on the invoice: case_number, invoice_reference, policy_number, date_of_birth, session_times, national_id. Ask for what you need and no more; national_id needs the clinic’s explicit tick.
deliveryobjectmethod: email (with email), ean (with ean, 13 digits) or api. With api no email is sent — you collect the invoices with GET /invoices. With the other two the API is a supplement.
payment_terms_daysinteger 1–18030Days from the invoice date to the due date.
bill_toobjectWho the invoice is addressed to: name (required), vat_number, address, postal_code, city, country, attention.
notestring ≤ 300A line the clinic sees next to your terms, as plain text.
Request
curl -X PUT https://anotera.clinic/api/referral/v1/settings/invoicing \
  -H "Authorization: Bearer $ANOTERA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "schedule": "monthly", "invoice_day": 1, "grouping": "combined",
    "required_references": ["case_number", "session_times"],
    "delivery": { "method": "email", "email": "invoices@insurer.example" },
    "payment_terms_days": 30,
    "bill_to": { "name": "Insurer A/S", "vat_number": "12345678",
                 "address": "Main Street 1", "postal_code": "2100", "city": "Copenhagen", "country": "DK" }
  }'
Response · 200
{
  "version": 1,
  "updated_at": "2026-11-14T09:12:40.000Z",
  "billing": "clinic_invoices",
  "schedule": "monthly",
  "invoice_day": 1,
  "grouping": "combined",
  "required_references": ["case_number", "session_times"],
  "delivery": { "method": "email", "email": "invoices@insurer.example", "ean": null },
  "payment_terms_days": 30,
  "bill_to": { "name": "Insurer A/S", "vat_number": "12345678", "address": "Main Street 1",
               "postal_code": "2100", "city": "Copenhagen", "country": "DK", "attention": null },
  "note": null
}

This is what the clinic reads before it says yes: «One combined invoice on the 1st of the month for the previous month, with case number and date and time of each session, sent to invoices@insurer.example, payment 30 days.» The clinic then chooses, itself, between making drafts, issuing, or issuing and sending.

The references and the cap, per referral

case_number, invoice_reference, sessions_granted (the highest number of sessions) and valid_until come with the referral. The case number and your invoice reference are printed on the invoice — on each line of a combined invoice — and in OIOUBL your invoice reference is the order reference and the case number an additional document reference.

PATCH/referrals/{referral_id}

Correct them. Send only what changes; null clears a text, and removes the end date. Needs the refer permission.

Request body
FieldTypeRequiredMeaning
case_numberstring ≤ 60 | nullnoYour case id.
invoice_referencestring ≤ 60 | nullnoYour own text for the invoice.
sessions_grantedinteger 1–200noThe cap. Fewer than already used answers 409 sessions_below_used with used.
valid_untildate | nullnoLast day the grant covers.
Response · 409
{
  "error": {
    "code": "sessions_below_used",
    "message": "3 sessions have already been used on this referral — \"sessions_granted\" cannot be lower than that.",
    "field": "sessions_granted",
    "used": 3
  }
}

Beyond the cap you are never invoiced automatically

A session held beyond sessions_granted, or after valid_until, stays with the clinic as «beyond the grant». The clinic can ask you for more: you get the event referral.extension_requested, and the referral shows extension_request until you answer. Answer with POST /referrals/{referral_id}/extend (or PATCH) — and the session is invoiced automatically, on your terms. The note is a short line from the clinic and never health information.

In GET /referrals/{referral_id}
  "extension_request": {
    "sessions": 4,
    "requested_at": "2026-12-03T10:21:07+01:00",
    "note": "The course of treatment is not finished."
  }

GET/invoices

The invoices and credit notes clinics have issued to your organisation — for those who would rather collect them than read an email. Only issued (booked) documents, only yours, and only those issued after the clinic connected you. Query: clinic_id, issued_since, limit (≤ 100), cursor. A clinic that disconnects issues no new ones here, but those already issued to you stay available for five years: they are your own documents.

GET/invoices/{invoice_id}

One invoice with its lines. The lines carry only what the clinic’s rule for you allows: case number, your invoice reference, date and time — the patient’s name, policy number, date of birth or national id only when the rule has them. Amounts are in the major unit of currency.

Response · 200
{
  "id": "inv_k2Jq0s8cX2m1Ta9vPzQe7A",
  "clinic_id": "kl_8m2x4q7w1z5c",
  "type": "invoice",
  "number": "F2026-0041",
  "issue_date": "2026-12-01",
  "due_date": "2026-12-31",
  "currency": "DKK",
  "total": 2200,
  "status": "issued",
  "credit_of": null,
  "issued_at": "2026-12-01T06:00:04+01:00",
  "seller": { "name": "Anna Holm", "vat_number": "12345678", "address": "Harbour Street 1, 2100 Copenhagen",
              "bank": { "name": null, "registration_number": "1234", "account_number": "5678901234", "iban": null, "bic": null } },
  "buyer": { "name": "Insurer A/S", "vat_number": "12345678", "address": "Main Street 1, 2100 Copenhagen", "ean": null },
  "lines": [
    { "description": "Psykologsamtale", "date": "2026-11-05", "time": "10:00", "case_number": "CASE-2026-001",
      "quantity": 1, "unit_price": 1100, "amount": 1100, "vat": { "exempt": true } },
    { "description": "Psykologsamtale", "date": "2026-11-12", "time": "10:00", "case_number": "CASE-2026-001",
      "quantity": 1, "unit_price": 1100, "amount": 1100, "vat": { "exempt": true } }
  ],
  "subtotal": 2200, "vat_total": 0, "amount_paid": 0, "amount_due": 2200,
  "payment_notices": [],
  "pdf_url": "https://anotera.clinic/api/referral/v1/invoices/inv_k2Jq0s8cX2m1Ta9vPzQe7A/pdf",
  "oioubl_url": "https://anotera.clinic/api/referral/v1/invoices/inv_k2Jq0s8cX2m1Ta9vPzQe7A/oioubl"
}

A credit note has type: "credit_note", a negative total and credit_of: the id of the invoice it credits (which then has status credited). Statuses: issued, partly_paid, paid, credited.

GET/invoices/{invoice_id}/pdf

The invoice as PDF — the same document the clinic sends.

GET/invoices/{invoice_id}/oioubl

The invoice as OIOUBL (XML), for clinics in Denmark; oioubl_url is null and the call answers 404 where the clinic’s country does not use the format.

POST/invoices/{invoice_id}/payment-notice

Tell the clinic that you have paid. It is a notice: the clinic sees «Insurer A/S reports paid 3 Dec». It does not record the payment — unless the clinic has switched on «trust this organisation’s payment notices» for you (off by default). recorded in the answer says which.

Request body
FieldTypeRequiredMeaning
paid_ondateyesThe day the payment was made — today or earlier.
amountnumberyesIn the invoice’s currency, at most two decimals.
referencestring ≤ 80noYour payment reference.
Response · 201
{
  "status": "received",
  "invoice_id": "inv_k2Jq0s8cX2m1Ta9vPzQe7A",
  "recorded": false,
  "note": "The clinic sees the notice. It does not record the payment by itself — the clinic does, when the money has arrived."
}

Events: invoice.issued and credit_note.issued carry data.invoice_id (and data.credit_of) — fetch the document when you hear about it.

Self-billing

You issue the document yourself — the clinic makes no invoice

Some organisations bill themselves: they issue the settlement document and pay by it. Then the clinic’s system must know not to invoice you — and the settlement must still reach the clinic’s accountant. This is how.

  1. Switch it on in your terms

    Set "billing": "self_billing" with PUT /settings/invoicing. Each clinic says yes for itself. From then on neither its monthly run, its «held» button nor a manual invoice makes an invoice to you for a session on one of your referrals.

  2. Hear about the held sessions

    When the clinic says yes it is told plainly that you will be told about every held session on a referral from you: the date, the case number and whether the patient attended. The clinic chooses when: at once (the default), together on the 1st of the month, or when the clinic presses the button itself. You get session.completed — and session.no_show only when the grant covers no-shows.

  3. Send the document

    Post your self-billing invoice with its lines and the PDF. Each line is matched to a held session, and the lines go to the clinic’s accountant along with the clinic’s own invoices — with the PDF when the document covers one practitioner’s patients. When it covers several practitioners’ patients, each practitioner and her accountant get only her own lines, and the PDF can be downloaded by the clinic’s administrator only.

The cap still applies: a session beyond the grant is not reported until you have granted more, or the clinic has invoiced the patient.

GET/referrals/{referral_id}/sessions

The held sessions the clinic has reported on one of your referrals. Only date and status — never content, never other appointments. Answers 403 until the clinic has accepted self-billing from you.

Response · 200
{
  "referral_id": "ref_VgU4FxBtxqGNVAn4xksMVA",
  "sessions": [
    { "id": "a-3f9c2b7e1d04", "date": "2026-11-05", "status": "completed", "service_id": "individuel",
      "reported_at": "2026-11-05T16:02:11+01:00", "settled_by": "SB-2026-0042" },
    { "id": "a-8a1e5d0c7b62", "date": "2026-11-12", "status": "completed", "service_id": "individuel",
      "reported_at": "2026-11-12T16:00:48+01:00" }
  ]
}

POST/clinics/{clinic_id}/self-billing-invoices

Send the document. Use an Idempotency-Key; the same number twice at the same clinic answers 409 duplicate_number. Line amounts are without VAT, and the lines (plus the VAT, when not exempt) must add up to total — otherwise 422 total_mismatch with the difference. The PDF must be a PDF, at most 5 MB; it is stored encrypted with the clinic’s other vouchers and is only ever downloaded there, never displayed inline. Until the clinic has accepted self-billing from you the answer is 409 self_billing_not_enabled.

Request body
FieldTypeRequiredMeaning
numberstring ≤ 40yesYour document number. It never enters the clinic’s own invoice series.
issue_datedateyesThe date on your document, YYYY-MM-DD — today or earlier. A date in the future is refused (422).
periodobjectnofrom and to.
currencystringyesISO 4217 — the clinic’s own currency, e.g. DKK. Another currency is refused (422).
lines[]array 1–200yesreferral_id (yours, at this clinic), session_id (preferred) or session_date, case_number, description, amount.
totalnumberyesThe lines plus the VAT.
vatobjectyes{ "exempt": true } or { "rate": 25, "amount": 237.5 }.
paymentobjectnodate, reference.
pdfbase64yesThe document itself.
credit_ofstringnoFor a credit: the id of the document it credits (never another credit). Every line amount is then negative — only on a credit — and a line that carries the credited line’s amount with the opposite sign makes the session stand as not settled again; any other amount is reported as amount_differs and settles nothing back.
Request
curl -X POST https://anotera.clinic/api/referral/v1/clinics/kl_8m2x4q7w1z5c/self-billing-invoices \
  -H "Authorization: Bearer $ANOTERA_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: sb-2026-0042" \
  -d '{
    "number": "SB-2026-0042", "issue_date": "2026-11-30",
    "period": { "from": "2026-11-01", "to": "2026-11-30" }, "currency": "DKK",
    "lines": [
      { "referral_id": "ref_VgU4FxBtxqGNVAn4xksMVA", "session_id": "a-3f9c2b7e1d04", "case_number": "CASE-2026-001", "amount": 1100.00 },
      { "referral_id": "ref_VgU4FxBtxqGNVAn4xksMVA", "session_date": "2026-11-12", "amount": 950.00 }
    ],
    "total": 2050.00, "vat": { "exempt": true },
    "payment": { "date": "2026-12-05", "reference": "PAY-88231" },
    "pdf": "JVBERi0xLjQK…"
  }'
Response · 201
{
  "id": "sbi_Qe7Ak2Jq0s8cX2m1Ta9vPz",
  "clinic_id": "kl_8m2x4q7w1z5c",
  "number": "SB-2026-0042",
  "issue_date": "2026-11-30",
  "period": { "from": "2026-11-01", "to": "2026-11-30" },
  "currency": "DKK",
  "total": 2050,
  "status": "received",
  "credit_of": null,
  "received_at": "2026-11-30T14:03:22+01:00",
  "matched": 1,
  "unmatched": [
    { "line": 1, "referral_id": "ref_VgU4FxBtxqGNVAn4xksMVA", "reason": "amount_differs", "clinic_amount": 1100 }
  ]
}

matched counts the lines that met a held session at the clinic’s own amount. unmatched says why the rest did not: unknown_session (the clinic knows no held session that fits), amount_differs (with the clinic’s own amount), already_invoiced, already_settled. Status: matched — everything fits, or the clinic approved it anyway; received — the clinic is looking at the unmatched lines; disputed.

GET/self-billing-invoices

The documents you have sent. Query: clinic_id, since, limit, cursor.

GET/self-billing-invoices/{self_billing_invoice_id}

One document and its status at the clinic. Only your own.

Disputes

The clinic is only asked to look when something does not fit: a session you have settled that the clinic does not know, an amount that differs from the clinic’s own, or — ten days after the end of a month — reported sessions that no document has covered. The clinic can approve the document anyway, or dispute it with a short line: you get self_billing_invoice.disputed (data.self_billing_invoice_id, data.note), and the document shows "status": "disputed" with dispute. Answer by crediting it and sending a corrected one.

Errors

One shape, fixed codes

Every error has the same form. Branch on error.code — it is stable. error.message is written for the developer reading a log, and may be reworded.

Response · 422
{
  "error": {
    "code": "validation_failed",
    "message": "Give at least a \"patient.phone\" or a \"patient.email\" — the clinic has to be able to reach the patient.",
    "field": "patient.phone"
  }
}
Response · 409
{
  "error": {
    "code": "slot_taken",
    "message": "That time is no longer available. Pick one of the alternatives, or ask for availability again.",
    "alternatives": [
      {
        "start": "2026-11-16T13:30:00+01:00",
        "end": "2026-11-16T14:30:00+01:00",
        "practitioner_id": "pr_test_anna",
        "service_id": "sv_test_first",
        "mode": "in_person_or_video"
      },
      {
        "start": "2026-11-16T15:00:00+01:00",
        "end": "2026-11-16T16:00:00+01:00",
        "practitioner_id": "pr_test_anna",
        "service_id": "sv_test_first",
        "mode": "in_person_or_video"
      }
    ]
  }
}
CodeHTTPWhen
unauthorized401The key is missing, unknown or revoked — or your organisation is suspended.
forbidden403The clinic has connected you, but not for this (e.g. no status permission).
not_found404The id does not exist, or the clinic has not connected you, or the referral is not yours. Indistinguishable on purpose.
method_not_allowed405The path exists; the method does not.
malformed_json400The body is not valid JSON.
validation_failed422A field is missing or wrong. field names it (patient.phone, appointment.start …).
slot_taken409The time is no longer free. alternatives holds the next five slots with the same practitioner and service.
duplicate_external_id409You already have a referral with this external_id at this clinic. referral_id is the existing one.
idempotency_conflict409The Idempotency-Key was already used with a different body.
already_booked409The patient has booked a first appointment themselves.
cancellation_window_passed409Too close to the start to move or cancel. cancellation_notice_hours is in the error.
pending_approval409The referral is waiting for the clinic’s approval and cannot be booked yet.
referral_closed409The referral is closed.
already_connected409You sent declined for a clinic that is already connected. A connection is ended by the clinic.
key_limit_reached409Claiming a key: your organisation already has two active live keys. Ask us to revoke one.
not_bookable409There is nothing to cancel or move, or the clinic has no practitioner open to you right now.
sessions_below_used409PATCH /referrals/{referral_id}: fewer sessions than already used. used carries the number.
self_billing_not_enabled409The clinic has not accepted self-billing from your organisation.
duplicate_number409You have already sent a self-billing invoice with this number to this clinic. self_billing_invoice_id carries its id.
total_mismatch422A self-billing invoice whose lines do not add up to total. lines_sum, total and difference carry the numbers.
payload_too_large413The body is over 64 kB — or, for a self-billing invoice, the PDF is over 5 MB.
rate_limited429Too many requests. Wait the number of seconds in Retry-After.
server_error500Our fault. Retry with the same Idempotency-Key.
unavailable503The service is temporarily unable to store data. Retry later.

Idempotency

A retry never makes a second referral

Networks fail between your request and our response. Send an Idempotency-Key header on every POST and PUT — any string that is unique per logical request (a UUID, or your case id plus an attempt-independent suffix) — and retry as often as you need:

  • Same key, same body → the first response again, with the header Idempotent-Replayed: true. Nothing is done twice.
  • Same key, different body → 409 idempotency_conflict. A key belongs to one request.
  • Keys are remembered for 24 hours. Responses to 429 and 5xx are not remembered — retry those with the same key.

Without the header, external_id still protects you from duplicates: a second referral with the same external_id at the same clinic is refused with 409 duplicate_external_id and the id of the first.

Rate limits

Generous, and visible in every response

300 requests per minute per key, and 120 per minute per key and clinic. Every response tells you where you stand:

HeaderMeaning
X-RateLimit-LimitThe limit that is closest to being reached (per key, or per key and clinic).
X-RateLimit-RemainingRequests left in the current minute.
X-RateLimit-ResetUnix time (seconds) when the window resets.
Retry-AfterOnly on 429: seconds to wait.

Over the limit you get 429 rate_limited with Retry-After (seconds). Wait that long and continue. If you need more for a migration or a nightly reconciliation, write to us first.

Keys

Rotating a key without downtime

Your organisation can have two active live keys at the same time. That is what makes rotation safe:

  1. Ask Anotera for a second key

    The old key keeps working.

  2. Roll the new key out

    Deploy it everywhere you call from. Both keys work while you do.

  3. Have the old key revoked

    Tell us its prefix (the first 16 characters, e.g. ah_live_7f3aQ2xk). From that moment it answers 401.

Keep keys in a secret store, never in source code or a URL. If a key may have leaked, write to contact@anotera.clinic at once — it is revoked the moment we see it. A revoked key cannot be restored; you get a new one.

Webhooks

Be told, instead of asking

One https address per organisation. We send a signed POST when something happens to one of your referrals — also when it happens outside the API: the patient fills in their details or books a time, the clinic moves the appointment. Events carry ids and status, never names or anything clinical. Events that originate at the clinic arrive within about a minute.

PUT/webhook

Sets the address and returns a new signing secret — once. Setting it again replaces the address and the secret. events is optional; leave it out to receive everything.

Request
curl -X PUT https://anotera.clinic/api/referral/v1/webhook \
  -H "Authorization: Bearer $ANOTERA_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.com/anotera/webhook" }'
Response · 200
{
  "url": "https://example.com/anotera/webhook",
  "events": [
    "referral.booked",
    "referral.patient_completed",
    "referral.appointment_moved",
    "referral.appointment_cancelled",
    "referral.approved",
    "referral.declined",
    "referral.sessions_low",
    "clinic.connected",
    "clinic.disconnected",
    "clinic.interested",
    "clinic.application_withdrawn"
  ],
  "active": true,
  "failures": 0,
  "set_with": "test",
  "secret": "whsec_…",
  "note": "The secret is shown once. Store it now — it cannot be read again, only replaced by a new PUT /webhook."
}

GET /webhook shows the address, the events and failures. DELETE /webhook removes it. POST /webhook/test sends a signed ping right now and tells you whether your server answered 2xx — use it to prove your signature check before going live.

Test key or live key? set_with tells you which kind of key set the address. A webhook set with a test key receives only test events ("test": true) — so when you go live, send PUT /webhook once more with your live key; you get a new secret, and live events start to arrive. And a test key cannot replace or remove a webhook that was set with a live key (403 forbidden): a test key that ends up in the wrong hands can never redirect your live events.

Events

EventWhen
referral.bookedA first appointment exists — booked by you or by the patient. data.appointment only when you booked it.
referral.patient_completedThe patient has filled in their own details with the clinic.
referral.appointment_movedThe appointment you booked was moved — by you, the clinic or the patient. data.appointment is the new time.
referral.appointment_cancelledThe appointment you booked was cancelled.
referral.approvedThe clinic approved a referral that was pending_approval. data.status is booked or invited.
referral.declinedThe clinic declined it. The referral is closed.
referral.sessions_lowTwo or fewer granted sessions remain — grant more with extend before the last one. Only with the sessions permission. data.sessions, data.reason.
clinic.connectedA clinic connected your organisation. clinic_id is ready to call.
clinic.disconnectedA clinic disconnected you. Every call for it answers 404 from the same second; appointments already booked stand.
clinic.interestedA clinic has applied to work with you and waits for your answer. Fetch its profile with GET /clinics/{clinic_id}.
clinic.application_withdrawnThe clinic withdrew its application before you answered.
referral.extension_requestedThe clinic asks for more sessions: a session has been held beyond the grant. data.sessions, data.note. See Invoicing.
invoice.issuedA clinic has issued an invoice to you. data.invoice_id.
credit_note.issuedA clinic has issued a credit note for one of your invoices. data.invoice_id, data.credit_of.
session.completedSelf-billing: a session on one of your referrals has been held. data.session_id, data.date, data.service_id, data.case_number.
session.no_showSelf-billing: the patient did not attend, and the grant covers no-shows.
self_billing_invoice.disputedThe clinic disputes a self-billing invoice you sent. data.self_billing_invoice_id, data.number, data.note.
pingSent by POST /webhook/test.
Delivery — body
{
  "id": "evt_Jq0s8cX2m1Ta9vPz",
  "type": "referral.booked",
  "created": "2026-11-14T04:58:31+01:00",
  "clinic_id": "kl_testclinic01",
  "test": true,
  "referral_id": "ref_VgU4FxBtxqGNVAn4xksMVA",
  "external_id": "CASE-2026-001",
  "data": {
    "status": "booked",
    "appointment": {
      "start": "2026-11-16T09:00:00+01:00",
      "end": "2026-11-16T10:00:00+01:00",
      "practitioner_id": "pr_test_anna",
      "service_id": "sv_test_first",
      "mode": "in_person",
      "booked_by": "referrer"
    }
  }
}

Verifying the signature

Every delivery carries two headers: X-Anotera-Timestamp (Unix seconds) and X-Anotera-Signature: v1=<hex>. The signature is HMAC-SHA256, keyed with your secret, over the timestamp, a dot, and the raw body — exactly the bytes you received, before any JSON parsing. Compare in constant time, and refuse timestamps more than five minutes old.

Node.js
const crypto = require('crypto');

// rawBody: the request body exactly as received (a string, not parsed JSON).
// headers: lower-cased header names, as Node gives them.
function verifyAnotera(rawBody, headers, secret) {
  const timestamp = String(headers['x-anotera-timestamp'] || '');
  const signature = String(headers['x-anotera-signature'] || '').replace(/^v1=/, '');
  // Refuse anything older than five minutes: a replayed event is not an event.
  if (!/^\d+$/.test(timestamp) || Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
  const expected = crypto.createHmac('sha256', secret)
    .update(timestamp + '.' + rawBody).digest('hex');
  const a = Buffer.from(signature, 'utf8'), b = Buffer.from(expected, 'utf8');
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}
Python
import hashlib
import hmac
import time


def verify_anotera(raw_body: bytes, headers: dict, secret: str) -> bool:
    """raw_body: the request body exactly as received. headers: lower-cased names."""
    timestamp = headers.get("x-anotera-timestamp", "")
    signature = headers.get("x-anotera-signature", "")
    if signature.startswith("v1="):
        signature = signature[3:]
    # Refuse anything older than five minutes: a replayed event is not an event.
    if not timestamp.isdigit() or abs(time.time() - int(timestamp)) > 300:
        return False
    expected = hmac.new(secret.encode(), timestamp.encode() + b"." + raw_body,
                        hashlib.sha256).hexdigest()
    return hmac.compare_digest(signature, expected)
C#
using System.Security.Cryptography;
using System.Text;

// rawBody: the request body exactly as received (read it before model binding).
static bool VerifyAnotera(string rawBody, string timestamp, string signatureHeader, string secret)
{
    // Refuse anything older than five minutes: a replayed event is not an event.
    if (!long.TryParse(timestamp, out var t) ||
        Math.Abs(DateTimeOffset.UtcNow.ToUnixTimeSeconds() - t) > 300) return false;

    var signature = signatureHeader.StartsWith("v1=") ? signatureHeader[3..] : signatureHeader;
    using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(secret));
    var hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(timestamp + "." + rawBody));
    var expected = Convert.ToHexString(hash).ToLowerInvariant();

    return CryptographicOperations.FixedTimeEquals(
        Encoding.UTF8.GetBytes(expected), Encoding.UTF8.GetBytes(signature));
}

Delivery

  • Answer 2xx within 8 seconds. Do the work afterwards; acknowledge first.
  • Three attempts: at once, after 5 seconds and after 30 seconds. Each attempt is signed with a fresh timestamp.
  • Events can arrive twice or out of order. De-duplicate on id, and treat an event as a hint to read GET /referrals/{referral_id} — that is always the truth.
  • After 50 failed deliveries in a row the webhook is switched off ("active": false). Set it again with PUT /webhook to switch it back on.
  • Internal and private addresses are refused. Other headers: X-Anotera-Event, X-Anotera-Delivery.

The test clinic

Build the whole integration before a single clinic has connected you

kl_testclinic01 exists only for test keys. It validates exactly as a real clinic does and answers realistically, so what works here works in production.

  • Two practitioners, three services. pr_test_anna, pr_test_omar · sv_test_first (60 min), sv_test_session (50 min), sv_test_video (50 min, video only).
  • Times are calculated from today: weekdays at 09:00, 10:30, 13:30 and 15:00, from tomorrow and 60 days ahead. A time you book is taken — for your key.
  • 12:00 is always taken. It never appears in availability; book it to see 409 slot_taken.
  • The patient «completes» after one minute: patient_completed turns true, and referral.patient_completed is sent — so you can test that path too.
  • Nothing is stored and nobody is contacted. Test referrals live in memory for 24 hours and are visible only to the key’s organisation. Webhooks go only to your own address, marked "test": true.
  • All permissions are on (sessions included), booking is immediate, cancellation notice is 24 hours.

A test key against a real clinic answers 404. A live key against the test clinic answers 404.

Data & privacy

What we store, and what you can see

  • The clinic is the data controller for the record. A referral creates a patient card at the clinic. From then on it is the clinic’s record, kept under the clinic’s obligations — not a copy of your case.
  • You never see clinical content. No notes, no diagnoses, no questionnaires, no messages — and no appointments other than the one you booked yourself. You see status, whether the patient has completed their details, and — only if the clinic turns it on — how many granted sessions are used.
  • national_id is never returned. It goes on the patient’s card at the clinic. It is not in any response, webhook, call log or server log. The same holds for note_to_clinic.
  • Whether someone already was a patient cannot be seen. A referral for an existing patient answers exactly like one for a new patient.
  • What Anotera keeps about your organisation: name, registration number, a contact, fingerprints of your keys, your webhook address, and a register of your referrals by id. The clinic sees a log of your calls to that clinic: time, route and status code — never the body.
  • A clinic can disconnect you at any time, without asking anyone. Every call for that clinic then answers 404 from the same second. Appointments already booked stand, and the patient remains the clinic’s patient.
  • You decide what you send. A first name and one way to reach the patient is enough; the patient fills in the rest directly with the clinic.

Versioning

v1 stays v1

The version is in the path. Within /v1 we only make changes that an existing integration survives: new endpoints, new optional request fields, new fields in responses, new webhook events, new error codes for new situations. Write your client to ignore fields and events it does not know. Anything else — removing or renaming a field, changing a meaning — gets a new version in the path, and /v1 keeps running beside it for at least twelve months after notice to your technical contact.

Changelog
DateChange
2026-11-14First version: clinics, availability, referrals, appointments, extend, connection requests, webhooks, the test clinic.
2026-11-14Sign-up: POST /signup and POST /signup/claim. Applications from clinics: GET /clinics?status=interested, the applicant profile, PUT /clinics/{clinic_id}/connection, GET/PUT /settings, the status interested, the events clinic.interested and clinic.application_withdrawn, the codes already_connected and key_limit_reached.
2026-11-14Invoicing: GET/PUT /settings/invoicing, PATCH /referrals/{referral_id}, extension_request on the referral, GET /invoices with PDF and OIOUBL, POST /invoices/{invoice_id}/payment-notice. Self-billing: GET /referrals/{referral_id}/sessions, POST /clinics/{clinic_id}/self-billing-invoices, GET /self-billing-invoices. Six new events and four new error codes. A webhook set without events now also receives events added later.

Questions, or something missing? Write to contact@anotera.clinic — with the call and the response, without patient data. For clinics’ own integrations (website booking, accounting, moving from another system) see the open API.