Skip to content

Create (or reuse) a public share link for a client profile

POST
/api/clients/{id}/share/
curl --request POST \
--url http://localhost:8000/api/clients/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/share/ \
--header 'Authorization: Bearer <token>'

Issues a public, token-gated URL for the athlete’s aggregate profile — anyone with the link sees a redacted snapshot (progress trends, no email / session ids / video URLs), no auth required. Idempotent: reuses the most recent active token rather than minting a fresh one on every click (the URL the coach sent yesterday keeps working). Each call (re-)stamps the share’s locale from ?lang= (clamped to en / ru / es, default en) so the public viewer renders in the coach’s language regardless of the recipient’s browser locale. The web app serves the viewer at /c/<token>; read the snapshot via GET /api/clients/shared/<token>/. Revoke with DELETE on this same endpoint. 404 for a client owned by another team.

id
required
string format: uuid
lang
string

Active UI language (en / ru / es) to freeze on the share. Defaults to en when omitted or unrecognised.

Media typeapplication/json

Body returned by POST /api/clients/<id>/share/. The token is opaque; url is the public path the coach copies (the SPA serves the viewer at /c/<token>).

object
token
required

Opaque share token.

string
url
required

Public viewer path — /c/<token> on the web app.

string
expires_at
required

Expiry instant — SHARE_LINK_TTL_DAYS out (30 by default), re-stamped to a full window on every re-share, past which the public route returns 410. null only on links minted before the TTL landed (#1400).

string format: date-time
nullable
locale
required

Frozen UI / report language for the public viewer, captured from the coach’s active language when the link was created.

  • en - English
  • ru - Русский
  • es - Español
string
Allowed values: en ru es
Examples
ExampleShareLink

Created or reused — idempotent per client

{
"token": "kV9_3sQp2mZ1xY7bN4cR8dLt",
"url": "/c/kV9_3sQp2mZ1xY7bN4cR8dLt",
"expires_at": "2027-03-15T10:22:00Z",
"locale": "en"
}
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
Examplegenerated
{
"detail": "example"
}
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—NoSuchClientOnThisTeam

404 — No such client on this team

{
"detail": "client_not_found"
}