Skip to content

Write to the card's people

POST
/api/clients/{id}/thread/messages/
curl --request POST \
--url http://localhost:8000/api/clients/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/thread/messages/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "text": "How did the run feel?" }'

Plain text up to 4,000 characters, and an optional reference. A reference is a kind and ids — session, session_moment (params.at_ms), metric (params.metric_key), report, plan_step (params.step_id); the server builds the card. Its subject must be this card’s (400 reference_not_found otherwise). release: true shares the referenced session or report with the client’s side in the same send (400 release_not_applicable without one; 409 not_releasable / report_covers_other_athletes posts nothing). 400 empty_message with neither text nor a reference. 403 not_a_team_member for staff, who read and do not write; 409 no_client_access while nobody on the client’s side holds access.

A coach of the card’s team. Every route answers 404 while client access is switched off on the environment, and 404 client_not_found for a card of another team; a partner API key and a client’s own account get 403. Reading stays open on every plan; posting and editing are 402 on a read-only team or a plan without client access; deleting one’s own message is not. 429 past the account’s rate (chat_read 240/min for reads, chat_post 30/min for writes).

id
required
string format: uuid
lang
string

The cards’ language: en · ru · es.

units
string

metric (default) · imperial.

POST /api/clients/<id>/thread/messages/ (ThreadMessageInput).

object
text

Plain text, at most 4000 characters; links become clickable on render, nothing else is interpreted.

string
"" <= 4000 characters
reference

A kind and ids — never content: the server builds the card.

object
kind
required

document is the server’s own (the document_shared notice): 400 reference_not_allowed.

  • session - Session
  • session_moment - Moment of a session
  • metric - Metric of a session
  • report - Report
  • plan_step - Plan step
  • document - Document on the athlete
string
Allowed values: session session_moment metric report plan_step document
subject_id
required

The session, the Solutions run, or the plan (for plan_step).

string format: uuid
params
object
at_ms

session_moment: the second, in ms.

integer
<= 21600000
metric_key

metric: a metric row of the session, or a bilateral stem.

string
>= 1 characters <= 80 characters
step_id

plan_step: the step of the plan.

string format: uuid
release

Share the referenced session or report with the client’s side in the same send (contract change 2): without it, an unshared result reads as a placeholder there.

boolean

Examples

A message

{
"text": "How did the run feel?"
}
Media typeapplication/json

One message (ThreadMessage).

object
id
required
string format: uuid
author_id
required

The author’s participant id; null once their account is gone.

string format: uuid
nullable
author_role
required
  • coach - Coach
  • athlete - Athlete
  • guardian - Parent or guardian
string
Allowed values: coach athlete guardian
author_name
required

Coach side: a name, else an address. Client side: a name only, never an address — empty when the person gave none.

string
text
required

Empty once deleted, and for a shared result nobody reviewed.

string
reference
required
One of:
One of: discriminator: kind

kind: session — a whole session.

object
placeholder
required

True: kind alone — the card cannot be shown to this reader (or its subject is gone).

boolean
kind
required

The discriminator.

  • session - session
string
Allowed values: session
session_id
string format: uuid
activity
string
title
string
recorded_at
string format: date-time
thumbnail_url
string
nullable
event
required
One of:
  • result_shared - Result shared
  • client_upload - Client sent a clip
  • upload_refused - Client’s clip refused: team out of analyses
  • document_shared - Document shared
string
Allowed values: result_shared client_upload upload_refused document_shared
created_at
required
string format: date-time
edited_at
required
string format: date-time
nullable
deleted
required

Soft delete: the row stays and reads “message deleted”.

boolean

Examples

ExamplePosted
{
"id": "3f2a1b0c-0000-4000-8000-0000000000d3",
"author_id": "c0ac4000-0000-4000-8000-0000000000c1",
"author_role": "coach",
"author_name": "Kim Larsen",
"text": "Nice cadence on this one — let's keep the stride short next week.",
"reference": {
"kind": "session",
"placeholder": false,
"session_id": "5e2b9c41-7d3a-4f80-9b6e-1c0d2e3f4a51",
"activity": "running",
"title": "Treadmill check",
"recorded_at": "2026-11-02T09:40:00Z",
"thumbnail_url": null
},
"event": null,
"created_at": "2026-11-02T10:16:00Z",
"edited_at": null,
"deleted": false
}
Media typeapplication/json
object
detail
required

Human-readable message, or a stable machine code for the cases a client branches on. The standard envelope for 400 (validation — a field-keyed object may appear instead), 401 (missing / invalid credentials), 403 (authenticated but not permitted), and 404 (absent — cross-team records are collapsed to 404 so the API never leaks the existence of another team’s data).

string

Examples

400 — nothing to say

{
"detail": "empty_message"
}
Media typeapplication/json
object
detail
required

Human-readable message, or a stable machine code for the cases a client branches on. The standard envelope for 400 (validation — a field-keyed object may appear instead), 401 (missing / invalid credentials), 403 (authenticated but not permitted), and 404 (absent — cross-team records are collapsed to 404 so the API never leaks the existence of another team’s data).

string

Example generated

{
"detail": "example"
}

The team is read-only, or its plan does not include client access.

Media typeapplication/json
object
detail
required

One of eight canonical strings. The front-end paywall switches copy + CTA on this value (exact string equality — do not localise). quota_exhausted / seat_limit_reached / client_limit_reached / feature_not_in_plan lead to an upgrade CTA; subscription_suspended leads to a Billing Portal CTA so the buyer can update their payment method; exercise_not_in_plan leads to a contact-us CTA — the movement list is sales-managed, no tier adds to it (#2030). trial_expired / access_ended mean the team is read-only (#2901): everything opens, nothing new is created; they lead to a subscribe CTA and always carry reset_at: null.

  • quota_exhausted - Session quota for the period reached 0
  • subscription_suspended - Stripe dunning in flight (past_due / unpaid)
  • seat_limit_reached - Adding another team member would exceed plan.max_seats
  • client_limit_reached - Adding another Client would exceed plan.max_client_profiles
  • feature_not_in_plan - The tier does not include this whole feature surface
  • exercise_not_in_plan - The (activity, exercise) is not in the team’s exercise grants
  • trial_expired - The team is read-only: its self-serve trial ended
  • access_ended - The team is read-only: its paid plan or granted access ended
string
Allowed values: quota_exhausted subscription_suspended seat_limit_reached client_limit_reached feature_not_in_plan exercise_not_in_plan trial_expired access_ended
reset_at
required

ISO-8601 UTC timestamp the team’s current period ends. Null when the team has no live subscription (legacy un-migrated row). On Free + paid this is the renewal moment; quota refreshes to exactly plan.session_quota (NOT additive — leftover sessions don’t roll over).

string format: date-time
nullable
current_plan
required

The active plan’s role string (free, starter, professional, organization, strategic). Same value as current_role — kept as two separate fields for forward-compatibility with a future named-plan split where current_plan could carry an SKU and current_role the tier label.

string
current_role
required

The active plan’s role string. See current_plan.

string
feature

Which feature surface is locked. Present ONLY on feature_not_in_plan, so one modal can name what’s gated without a detail string per feature (#773). The only value today is agents (aikynetix/agents/services.py::AGENTS_FEATURE).

string

Example

{
"detail": "quota_exhausted"
}
Media typeapplication/json
object
detail
required

Human-readable message, or a stable machine code for the cases a client branches on. The standard envelope for 400 (validation — a field-keyed object may appear instead), 401 (missing / invalid credentials), 403 (authenticated but not permitted), and 404 (absent — cross-team records are collapsed to 404 so the API never leaks the existence of another team’s data).

string

Examples

403 — staff

{
"detail": "not_a_team_member"
}
Media typeapplication/json
object
detail
required

Human-readable message, or a stable machine code for the cases a client branches on. The standard envelope for 400 (validation — a field-keyed object may appear instead), 401 (missing / invalid credentials), 403 (authenticated but not permitted), and 404 (absent — cross-team records are collapsed to 404 so the API never leaks the existence of another team’s data).

string

Examples

Example404—NotACardOfTheTeam

404 — not a card of the team

{
"detail": "client_not_found"
}
Media typeapplication/json
object
detail
required

409 — the request conflicts with current state. detail is a stable code (e.g. reanalyze_in_flight, already_on_plan, email_in_use). Some 409s carry extra context fields alongside detail; those are documented on the specific endpoint that emits them.

string

Examples

Example409—NobodyToTalkTo

409 — nobody to talk to

{
"detail": "no_client_access"
}
Media typeapplication/json
object
detail
required

429 — throttled: this account’s (or address’s) rate for the route is used up; try again after wait seconds, which Retry-After repeats. A route with a limit of its own answers its own code instead, documented there.

string
wait

With throttled: whole seconds until the next request can pass.

integer
nullable

Example generated

{
"detail": "example",
"wait": 1
}