Skip to Content
SDK 1.14 is out with per-user product usage and typed API errors. Read the changelog →
Get startedAuthentication

Authentication

Using the Squire SDK requires having a valid access token. An access token can be requested from the Squire API using your Squire API key. If you do not have a Squire API key yet, create one via the Portal.

Authentication flow

The SDK uses token-based authentication to securely identify users per integration. It goes as follows:

  1. Your EHR client requests an access token from your backend
  2. Your EHR backend requests an access token from Squire API using your private API key
  3. The Squire API validates the request and returns an access token
  4. Your EHR backend provides the access token to your client application
  5. Your EHR client initializes the Squire SDK using the access token

Requesting an access token

Request access tokens from your server. Never ship your API key to the client.

To request an access token, make a POST request to https://api.squire.eu/api/v1/external/token/ with your API key in the header and the user ID in the request body.

Request specification

Request an access token by calling the Squire API from your preferred programming language.

HeaderRequiredDescription
X-Api-KeyYesYour Squire API key for authentication
Content-TypeYesMust be set to application/json

The request body is a JSON object with the following keys:

ParameterTypeRequiredDescription
user_idstringYesUnique identifier of the user in your system
first_namestringYesFirst name of the user
last_namestringYesLast name of the user
organisationstringYesThe name of the organisation (the practice, hospital, or similar) where the user works
organisation_idstringNoUnique identifier of the organisation (practice or hospital department) in your system. Acts as the data scope: all users sharing the same organisation_id see the same intake configurations and session data.
healthcare_provider_identification_numberstringNoThe healthcare provider identification number of the user (e.g. RIZIV number in Belgium). Separators between the numbers or characters are allowed.
emailstringNoEmail address of the user in your system
healthcare_provider_typestringNoThe specific type of healthcare provider

Healthcare provider types

Nameid
Anesthesiologistanesthesiologist
Cardiologistcardiologist
Dermatologistdermatologist
Dietitiandietitian
Emergency Doctoremergency_doctor
Endocrinologistendocrinologist
Gastroenterologistgastroenterologist
General Practitionergeneral_practitioner
Geriatriciangeriatrician
Gynecologistgynecologist
Hematologisthematologist
Home Nursehome_nurse
Hospital Nursehospital_nurse
Infectiologistinfectiologist
Medical Social Workermedical_social_worker
Nephrologistnephrologist
Neurologistneurologist
Nursing Home Nursenursing_home_nurse
Oncologistoncologist
Ophthalmologistophthalmologist
Orthopedicorthopedic
Otorhinolaryngologistotorhinolaryngologist
Pathologistpathologist
Pediatricianpediatrician
Physiotherapistphysiotherapist
Practice Nursepractice_nurse
Psychiatristpsychiatrist
Psychologistpsychologist
Pulmonologistpulmonologist
Radiologistradiologist
Rheumatologistrheumatologist
Secretariat Staffsecretariat_staff
Speech-Language Pathologistspeech_language_pathologist
Stomatologiststomatologist
Surgeonsurgeon
Urologisturologist

Example request

curl -X POST "https://api.squire.eu/api/v1/external/token/" \ -H "X-Api-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"user_id": "doctor123", "first_name": "doctor", "last_name": "123", "organisation": "practice_name", "healthcare_provider_identification_number": "12345678901", "email": "doctor@123.com", "healthcare_provider_type": "general_practitioner"}'

Response specification

A successful request returns an access token and its expiration date:

{ "token": "eyJhbGciOiJIUzI1NiIs...", "expires_at": "2025-01-01T14:30:00Z" }
FieldTypeDescription
tokenstringJWT access token for SDK initialization
expires_atstringISO 8601 formatted expiration timestamp

For examples in other languages and the full list of possible status codes, see the token endpoint API reference .

Next steps

Now that you have acquired a valid access token, continue with either SDK installation or the widget overview.

Last updated on