Skip to content

Edit (or revert) the AI coaching artifact

PATCH
/api/coaching/artifacts/{id}/
curl --request PATCH \
--url http://localhost:8000/api/coaching/artifacts/example/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "edited_markdown": "example" }'

Coach edit of the persisted AI text — available any time the artifact exists, independent of the generation stream. Sets edited_markdown (served everywhere the artifact is read, including public athlete-facing shares) and records edited_by / edited_at; the raw draft_markdown is never overwritten. Send a blank or null edited_markdown to revert to the AI draft. Team-scoped; cross-team ids return 404.

id
required
string

PATCH body. edited_markdown is the coach’s text; a blank or null value reverts to the AI draft. trim_whitespace=False so leading / trailing markdown formatting the coach typed is preserved verbatim.

object
edited_markdown
string
nullable <= 20000 characters
Examplegenerated
{
"edited_markdown": "example"
}
Media typeapplication/json

Read shape. markdown is the effective text (the coach edit if one exists, else the raw model draft) — the field UIs render. draft_markdown

  • is_edited are also exposed so the UI can offer a “revert to AI draft” affordance and warn before a regenerate would overwrite the draft. citations is the grounding provenance (#759) — the curated-corpus section titles the draft was grounded in; the FE replays them as the “Based on: …” footnote when a persisted take is reopened without a live stream (authed session panel + cached Solutions report), so provenance survives non-live paths, not just the SSE citations frame.
object
id
required
string format: uuid
surface
required
string
Allowed values: session solution client dashboard_overview dashboard_activity dashboard_business support
subject_id
required
string format: uuid
lang
required
string
default: en
unit_system
required
string
default: metric
focus
required
string
""
mode
required
string
markdown
required
string
draft_markdown
required
string
edited_markdown
required
string
nullable
is_edited
required
boolean
citations
required
Array<string>
edited_at
required
string format: date-time
nullable
generated_at
required
string format: date-time
updated_at
required
string format: date-time
Example
{
"surface": "session",
"lang": "en",
"unit_system": "metric",
"focus": ""
}
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
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
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
Examplegenerated
{
"detail": "example"
}