Facebook Pixel
Fit'DistanceDocumentation
Ouvrir l'app

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

NomTypeDescription
limitqueryinteger1–200, default 50
cursorquerystringOpaque cursor: next_cursor of the previous page.
sincequerydate-timeISO 8601. Returns the objects with updated_at >= since.
include_deletedquerybooleandefault false
student_idqueryinteger≥ 1
directionquerystringparmi : 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

NomTypeDescription
id requisstring
thread_id requisstringThe uid of the thread.
student_id requisintegerThe student of the thread.
coach_id requisintegerThe coach of the thread.
author_role requisstringparmi : student, coach
text requisstring | nullWritten 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 requisstring | nullparmi : bilan, habits, program, form, form_responseThe resource card the message points to. Null when deleted.
link_ref requisstring | nullThe reference of the linked resource. Null when deleted.
link_title requisstring | nullNull when deleted.
reply_to_message_id requisstring | nullThe uid of the message this one replies to.
broadcast_id requisstring | nullThe uid of the broadcast that sent this message.
media_count requisintegerAttached media files, never their URL. 0 when deleted.
scheduled_at requisdate-time | nullWhen a scheduled message is due.
delivered_at requisdate-time | nullNull while a scheduled message waits.
read_at requisdate-time | null
edited_at requisdate-time | null
created_at requisdate-time
updated_at requisdate-timeThe latest change of the message, its deletion included.
deleted_atdate-time | nullPresent when include_deleted is true.

Erreurs

StatutCodeQuand
400VALIDATIONParamètres ou corps invalides.facturé
401UNAUTHORIZEDClé absente, inconnue ou révoquée.non facturé
402CREDITS_EXHAUSTEDPlus de crédits ce mois-ci et aucune réserve.non facturé
403SCOPE_MISSINGLa clé n'a pas le périmètre demandé.non facturé
403PLAN_NOT_ELIGIBLETon offre n'ouvre pas l'API.non facturé
429RATE_LIMITEDTrop 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

NomTypeDescription
limitqueryinteger1–200, default 50
cursorquerystringOpaque cursor: next_cursor of the previous page.
sincequerydate-timeISO 8601. Returns the objects with updated_at >= since.
include_deletedquerybooleandefault false
student_idqueryinteger≥ 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

NomTypeDescription
id requisstring
coach_id requisinteger
student_id requisinteger
kind requisstringparmi : direct, announcement
unread_by_coach requisinteger
unread_by_student requisinteger
last_message_at requisdate-time | null
last_from requisstring | nullparmi : student, coachWho wrote the last message.
pinned_by_coach requisboolean
archived_by_coach requisboolean
created_at requisdate-time
updated_at requisdate-timeThe latest change of the thread, a new message included.

Erreurs

StatutCodeQuand
400VALIDATIONParamètres ou corps invalides.facturé
401UNAUTHORIZEDClé absente, inconnue ou révoquée.non facturé
402CREDITS_EXHAUSTEDPlus de crédits ce mois-ci et aucune réserve.non facturé
403SCOPE_MISSINGLa clé n'a pas le périmètre demandé.non facturé
403PLAN_NOT_ELIGIBLETon offre n'ouvre pas l'API.non facturé
429RATE_LIMITEDTrop d'appels : 10 par seconde, 300 par minute, 60 écritures et 20 suppressions par minute.non facturé