Facebook Pixel
Fit'DistanceDocumentation
Open the app

Messaging

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.

  • Scope messaging:read
  • 1 credit
  • Read
  • Stable

Parameters

NameTypeDescription
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
directionquerystringone of received, sent
curl "https://api.fitdistance.io/api/partner/v1/messages?limit=50" \
  -H "Authorization: Bearer fd_live_xxxxxxxx"
200 · a page of 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 · a page of Message

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

Errors

StatusCodeWhen
400VALIDATIONInvalid parameters or body.billed
401UNAUTHORIZEDKey missing, unknown or revoked.not billed
402CREDITS_EXHAUSTEDNo credits left this month and no reserve.not billed
403SCOPE_MISSINGThe key doesn't have the required scope.not billed
403PLAN_NOT_ELIGIBLEYour plan doesn't include the API.not billed
429RATE_LIMITEDToo many calls: 10 per second, 300 per minute, 60 writes and 20 deletes per minute.not billed

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.

  • Scope messaging:read
  • 1 credit
  • Read
  • Stable

Parameters

NameTypeDescription
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 · a page of 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 · a page of Thread

NameTypeDescription
id requiredstring
coach_id requiredinteger
student_id requiredinteger
kind requiredstringone of direct, announcement
unread_by_coach requiredinteger
unread_by_student requiredinteger
last_message_at requireddate-time | null
last_from requiredstring | nullone of student, coachWho wrote the last message.
pinned_by_coach requiredboolean
archived_by_coach requiredboolean
created_at requireddate-time
updated_at requireddate-timeThe latest change of the thread, a new message included.

Errors

StatusCodeWhen
400VALIDATIONInvalid parameters or body.billed
401UNAUTHORIZEDKey missing, unknown or revoked.not billed
402CREDITS_EXHAUSTEDNo credits left this month and no reserve.not billed
403SCOPE_MISSINGThe key doesn't have the required scope.not billed
403PLAN_NOT_ELIGIBLEYour plan doesn't include the API.not billed
429RATE_LIMITEDToo many calls: 10 per second, 300 per minute, 60 writes and 20 deletes per minute.not billed