TRAK-API-DOCS (1.0.0)
Download OpenAPI specification:Download
TRAK public integration API. Every endpoint requires authentication with an access token (OAuth2 Bearer or Token) in the Authorization header.
Create Physio
Create a physiotherapist. Requires an authenticated user with superAdmin permission on the team. The username is derived from the email (or from the integration identifier with a team prefix); it is not sent in the body.
Authorizations:
Request Body schema: application/json
| email required | string |
| name | string |
| surname | string |
| domicilio | string |
| nif | string |
| phone | string |
| center | string |
| city | string |
| send_email | boolean If true, sends a welcome email to the physiotherapist. |
| integration_id | string External identifier of the physiotherapist. Only for teams that integrate by identifier. |
Responses
Request samples
- Payload
{- "email": "physio_username@trak.es",
- "name": "Physio Name",
- "surname": "Surname",
- "domicilio": "Madrid",
- "nif": "11111111A",
- "phone": "666666666",
- "center": "Medical Center X",
- "city": "Madrid",
- "send_email": false,
- "integration_id": "physio-123"
}Response samples
- 201
{- "id": 10,
- "name": "Physio Name",
- "surname": "Surname",
- "email": "physio_username@trak.es",
- "domicilio": "Madrid",
- "nif": "11111111A",
- "phone": "666666666",
- "center": "Medical Center X",
- "city": "Madrid",
- "integration_id": "physio-123"
}Activate/Deactivate/Edit Physio
Activate/deactivate or edit a physiotherapist. Requires a superAdmin user on the same team. When deactivating, the patients can be transferred with transfer_patients_to_physio.
Authorizations:
path Parameters
| physio_id required | string Physiotherapist username (email or identifier with a team prefix). |
Request Body schema: application/json
| active required | boolean true to activate, false to deactivate the physiotherapist's access. |
string | |
| name | string |
| surname | string |
| domicilio | string |
| nif | string |
| phone | string |
| center | string |
| city | string |
| transfer_patients_to_physio | string When deactivating, email of the physiotherapist to transfer the patients to. |
| on_edit_send_email | boolean If true, notifies the changes by email. Defaults to true. |
Responses
Request samples
- Payload
{- "active": false,
- "email": "lira+physio_new1@trak.es",
- "name": "Antonio",
- "surname": "Lira",
- "domicilio": "Cordoba",
- "nif": "459429492S",
- "phone": "658309867",
- "center": "Medical Center X",
- "city": "Cordoba",
- "transfer_patients_to_physio": "otro_physio@trak.es",
- "on_edit_send_email": true
}Response samples
- 200
{- "active": true,
- "name": "Antonio",
- "surname": "Lira",
- "email": "lira+physio_new1@trak.es",
- "domicilio": "Cordoba",
- "nif": "459429492S",
- "phone": "658309867",
- "center": "Medical Center X",
- "city": "Cordoba",
- "patients_transferred_count": 3
}Get Token
Returns a temporary token for a physiotherapist or a patient, used to generate embedded frontend views. Requires OAuth2 (Bearer) authentication.
Authorizations:
path Parameters
| integration_id required | string Identifier (email or integration id) of the physiotherapist or patient the token is requested for. |
Responses
Response samples
- 200
- 400
{- "data": {
- "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiABCDIjoxNzEyNTkxMjk4LCJpYXQiOjE3MTI1OTA5OTgsImp0aSI6IjcxYTExNzI2Njc4ODRhNmViYTk2MzE2YWZhYzg4NDM4IiwidXNlcl9pZCI6MjU2NTR9.w2imp79kt3P2_v41r9zFwQ90T_IvY0B6Va7hV5qumas",
- "active": true
}
}List Protocols
Lists protocols. Besides the parameters shown, it supports other filters (body_region, favourite, materials, typologies, fase_protocol, name, right_left, n_exercises).
Authorizations:
query Parameters
| patient_id | string Patient identifier. If provided, returns the protocols assigned to that patient; otherwise, the physiotherapist's protocol templates. |
| date_start | string Start date (ISO 8601). Filters protocols in session on that date. Requires patient_id. |
| date_end | string End date (ISO 8601). Requires patient_id. |
| active | boolean Filters by whether the protocol assignment to the patient is active or not. Requires patient_id. |
Responses
Response samples
- 200
{- "count": 12,
- "next": null,
- "previous": null,
- "results": [
- {
- "id": 1,
- "name": "Protocol for right shoulder tendinitis",
- "description": "Rehabilitation protocol.",
- "side_protocol": "right",
- "fase_protocol": "initial",
- "body_region": "cervical",
- "n_exercises": 10,
- "active": true,
- "favourite": false
}
]
}Create protocol from template
Assigns a protocol template (protocol_id) to a patient (patient_id), scheduling the sessions in days. The endpoint also supports other modes (create a new template or a custom protocol by sending name and exercises).
Authorizations:
query Parameters
| patient_id | string Identifier of the patient to assign the protocol to. |
Request Body schema: application/json
| protocol_id required | number ID of the protocol template to assign. |
| days required | Array of strings Session dates (ISO 8601) to schedule. |
| physio_id | string Physiotherapist to assign (optional). |
| type_protocol | string |
Responses
Request samples
- Payload
{- "protocol_id": 45705,
- "days": [
- "2024-09-13T03:00:00Z"
], - "physio_id": "550e8400-e29b-41d4-a716-446655440000",
- "type_protocol": "rehabilitation"
}Response samples
- 201
{- "id": 1,
- "name": "Protocol for right shoulder tendinitis",
- "patient_id": "lira@trak.es",
- "sesions": [
- {
- "id": [
- 0
], - "dates": [
- "string"
], - "completed": [
- true
]
}
]
}Retrieve Protocol
Retrieves a protocol by its ID, with the full list of exercises.
Authorizations:
path Parameters
| protocol_id required | string |
query Parameters
| patient_id | string Patient identifier. If provided, the assigned sessions are included. |
| date_start | string Start date (ISO 8601). Requires patient_id. |
| date_end | string End date (ISO 8601). Requires patient_id. |
| active | boolean Filters by whether the protocol assignment to the patient is active or not. Requires patient_id. |
Responses
Response samples
- 200
{- "id": 1,
- "name": "Protocol for right shoulder tendinitis",
- "description": "Rehabilitation protocol.",
- "body_region": "cervical",
- "fase_protocol": "initial",
- "n_exercises": 10,
- "active": true,
- "favourite": false,
- "exercises": [
- {
- "name": "Left hip abduction with chair",
- "sets": 1,
- "reps": 10,
- "rest": 5,
- "material": [
- "string"
],
}
], - "sesions": {
- "id": [
- 0
], - "dates": [
- "string"
], - "completed": [
- true
]
}
}List Patients
Lists the patients of the authenticated physiotherapist. Supports filtering by query params and pagination.
Authorizations:
Responses
Response samples
- 200
{- "count": 42,
- "previous": null,
- "results": [
- {
- "username": "lira@trak.es",
- "email": "lira@trak.es",
- "name": "Antonio",
- "surname": "Lira",
- "phone": "666666666",
- "gender": "male",
- "bday": "2024-08-01",
- "injury": "Tendinitis",
- "physio": 10,
- "commentary": "Injury while playing basketball.",
- "active": true
}
]
}Create Patient
Creates a patient assigned to the physiotherapist indicated in careManager. The body follows a simplified HL7/FHIR-like format.
Authorizations:
Request Body schema: application/json
| resourceType | string |
| identifier required | string Patient identifier (usually the email). |
| mrn | number Medical record number. |
Array of objects | |
| telecom | string |
| phone | number |
| gender | string |
| birthDate | string |
| injury | string |
| commentary | string |
required | Array of objects Physiotherapist responsible for the patient. |
| document_type | string |
| document_number | string |
string | |
| language | string Patient language. Defaults to 'es'. |
object Episode to associate with the patient (optional). |
Responses
Request samples
- Payload
{- "resourceType": "Patient",
- "identifier": "lira@trak.es",
- "mrn": 893629,
- "name": [
- {
- "family": "Lira",
- "given": "Antonio"
}
], - "telecom": "lira@trak.es",
- "phone": 666666666,
- "gender": "male",
- "birthDate": "2024-08-01",
- "injury": "Tendinitis",
- "commentary": "The patient had an injury while playing basketball; will need at least 3 weeks of rehabilitation.",
- "careManager": [
- {
- "telecom": "physio@trak.es"
}
], - "document_type": "DNI",
- "document_number": "11111111A",
- "email": "lira@trak.es",
- "language": "es",
- "episode": {
- "id": "EP-12345"
}
}Response samples
- 201
{- "id": 25654,
- "email": "lira@trak.es",
- "user_id": "lira@trak.es"
}Retrieve Patient
Retrieves a patient by identifier.
Authorizations:
path Parameters
| user_patient_id required | string Patient username (email or identifier with a team prefix). |
Responses
Response samples
- 200
{- "id": 25654,
- "username": "lira@trak.es",
- "email": "lira@trak.es",
- "name": "Antonio",
- "surname": "Lira",
- "phone": "666666666",
- "gender": "male",
- "bday": "2024-08-01",
- "injury": "Tendinitis",
- "physio": 10,
- "commentary": "Injury while playing basketball.",
- "active": true,
- "mrn": 893629,
- "document_type": "DNI",
- "document_number": "11111111A"
}Edit Patient
Edits a patient. Returns 204 with no content on success.
Authorizations:
path Parameters
| user_patient_id required | string Patient username (email or identifier with a team prefix). |
Request Body schema: application/json
| name | string |
| surname | string |
string | |
| phone | string |
| gender | string |
| bday | string |
| injury | string |
| commentary | string |
| mrn | number |
| document_type | string |
| document_number | string |
| country_code | string |
| active | boolean |
| physio | string Username of the physiotherapist to reassign the patient to. |
Responses
Request samples
- Payload
{- "name": "Antonio",
- "surname": "Lira",
- "email": "lira@trak.com",
- "phone": "666666666",
- "gender": "male",
- "bday": "2024-08-01",
- "injury": "Tendinitis",
- "commentary": "Will need at least 3 weeks of rehabilitation.",
- "mrn": 893629,
- "document_type": "DNI",
- "document_number": "11111111A",
- "country_code": "ES",
- "active": true,
- "physio": "physio@trak.es"
}