Messagerie
2 routes
GET /messages
Messages of the coach's threads, scheduled ones included. A deleted message keeps only its ids and dates. Media files are counted, not served. A hard-deleted thread takes its messages with it, and a cancelled scheduled message is hard-deleted too: neither leaves a tombstone.
- Périmètre messaging:read
- 1 crédit
- Lecture
- Stable
Paramètres
| Nom | Type | Description |
|---|---|---|
limitquery | integer1–200, default 50 | |
cursorquery | string | Opaque cursor: next_cursor of the previous page. |
sincequery | date-time | ISO 8601. Returns the objects with updated_at >= since. |
include_deletedquery | booleandefault false | |
student_idquery | integer≥ 1 | |
directionquery | stringparmi : received, sent |
curl "https://api.fitdistance.io/api/partner/v1/messages?limit=50" \
-H "Authorization: Bearer fd_live_xxxxxxxx"200 · une page de Message
{
"data": [
{
"id": "7c1d1e2a-9b3f-4c5d-8e6f-1a2b3c4d5e6f",
"thread_id": "7c1d1e2a-9b3f-4c5d-8e6f-1a2b3c4d5e6f",
"student_id": 4821,
"coach_id": 4821,
"author_role": "student",
"text": "Great session yesterday, keep it up!",
"link_kind": "bilan",
"link_ref": "string",
"link_title": "string",
"reply_to_message_id": "string",
"broadcast_id": "string",
"media_count": 3,
"scheduled_at": "2026-10-24T09:12:00Z",
"delivered_at": "2026-10-24T09:12:00Z",
"read_at": "2026-10-24T09:12:00Z",
"edited_at": "2026-10-24T09:12:00Z",
"created_at": "2026-10-24T09:12:00Z",
"updated_at": "2026-10-24T09:12:00Z"
}
],
"next_cursor": null,
"has_more": false
}403 · SCOPE_MISSING
{
"error": {
"name": "PARTNER_API",
"message": "SCOPE_MISSING"
}
}200 · une page de Message
| Nom | Type | Description |
|---|---|---|
id requis | string | |
thread_id requis | string | The uid of the thread. |
student_id requis | integer | The student of the thread. |
coach_id requis | integer | The coach of the thread. |
author_role requis | stringparmi : student, coach | |
text requis | string | null | Written by the coach or the student, served as is: treat a student's text as untrusted input. Null when the message is deleted. |
link_kind requis | string | nullparmi : bilan, habits, program, form, form_response | The resource card the message points to. Null when deleted. |
link_ref requis | string | null | The reference of the linked resource. Null when deleted. |
link_title requis | string | null | Null when deleted. |
reply_to_message_id requis | string | null | The uid of the message this one replies to. |
broadcast_id requis | string | null | The uid of the broadcast that sent this message. |
media_count requis | integer | Attached media files, never their URL. 0 when deleted. |
scheduled_at requis | date-time | null | When a scheduled message is due. |
delivered_at requis | date-time | null | Null while a scheduled message waits. |
read_at requis | date-time | null | |
edited_at requis | date-time | null | |
created_at requis | date-time | |
updated_at requis | date-time | The latest change of the message, its deletion included. |
deleted_at | date-time | null | Present when include_deleted is true. |
Erreurs
| Statut | Code | Quand |
|---|---|---|
400 | VALIDATION | Paramètres ou corps invalides.facturé |
401 | UNAUTHORIZED | Clé absente, inconnue ou révoquée.non facturé |
402 | CREDITS_EXHAUSTED | Plus de crédits ce mois-ci et aucune réserve.non facturé |
403 | SCOPE_MISSING | La clé n'a pas le périmètre demandé.non facturé |
403 | PLAN_NOT_ELIGIBLE | Ton offre n'ouvre pas l'API.non facturé |
429 | RATE_LIMITED | Trop d'appels : 10 par seconde, 300 par minute, 60 écritures et 20 suppressions par minute.non facturé |
GET /threads
One thread per student and kind. Hard-deleted threads leave no tombstone. The coach's draft never appears. include_deleted has no effect.
- Périmètre messaging:read
- 1 crédit
- Lecture
- Stable
Paramètres
| Nom | Type | Description |
|---|---|---|
limitquery | integer1–200, default 50 | |
cursorquery | string | Opaque cursor: next_cursor of the previous page. |
sincequery | date-time | ISO 8601. Returns the objects with updated_at >= since. |
include_deletedquery | booleandefault false | |
student_idquery | integer≥ 1 |
curl "https://api.fitdistance.io/api/partner/v1/threads?limit=50" \
-H "Authorization: Bearer fd_live_xxxxxxxx"200 · une page de Thread
{
"data": [
{
"id": "7c1d1e2a-9b3f-4c5d-8e6f-1a2b3c4d5e6f",
"coach_id": 4821,
"student_id": 4821,
"kind": "direct",
"unread_by_coach": 0,
"unread_by_student": 0,
"last_message_at": "2026-10-24T09:12:00Z",
"last_from": "student",
"pinned_by_coach": true,
"archived_by_coach": true,
"created_at": "2026-10-24T09:12:00Z",
"updated_at": "2026-10-24T09:12:00Z"
}
],
"next_cursor": null,
"has_more": false
}403 · SCOPE_MISSING
{
"error": {
"name": "PARTNER_API",
"message": "SCOPE_MISSING"
}
}200 · une page de Thread
| Nom | Type | Description |
|---|---|---|
id requis | string | |
coach_id requis | integer | |
student_id requis | integer | |
kind requis | stringparmi : direct, announcement | |
unread_by_coach requis | integer | |
unread_by_student requis | integer | |
last_message_at requis | date-time | null | |
last_from requis | string | nullparmi : student, coach | Who wrote the last message. |
pinned_by_coach requis | boolean | |
archived_by_coach requis | boolean | |
created_at requis | date-time | |
updated_at requis | date-time | The latest change of the thread, a new message included. |
Erreurs
| Statut | Code | Quand |
|---|---|---|
400 | VALIDATION | Paramètres ou corps invalides.facturé |
401 | UNAUTHORIZED | Clé absente, inconnue ou révoquée.non facturé |
402 | CREDITS_EXHAUSTED | Plus de crédits ce mois-ci et aucune réserve.non facturé |
403 | SCOPE_MISSING | La clé n'a pas le périmètre demandé.non facturé |
403 | PLAN_NOT_ELIGIBLE | Ton offre n'ouvre pas l'API.non facturé |
429 | RATE_LIMITED | Trop d'appels : 10 par seconde, 300 par minute, 60 écritures et 20 suppressions par minute.non facturé |