Create (or reuse) a public share link for a client profile
const url = 'http://localhost:8000/api/clients/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/share/';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Query Parameters
Section titled “Query Parameters”Active UI language (en / ru / es) to freeze on the share. Defaults to en when omitted or unrecognised.
Responses
Section titled “Responses”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
Opaque share token.
Public viewer path — /c/<token> on the web app.
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).
Frozen UI / report language for the public viewer, captured from the coach’s active language when the link was created.
en- Englishru- Русскийes- Español
Examples
Created or reused — idempotent per client
{ "token": "kV9_3sQp2mZ1xY7bN4cR8dLt", "url": "/c/kV9_3sQp2mZ1xY7bN4cR8dLt", "expires_at": "2027-03-15T10:22:00Z", "locale": "en"}object
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).
Examplegenerated
{ "detail": "example"}object
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).
Examples
404 — No such client on this team
{ "detail": "client_not_found"}