Edit (or revert) the AI coaching artifact
const url = 'http://localhost:8000/api/coaching/artifacts/example/';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"edited_markdown":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Body
Section titled “Request Body”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
Examplegenerated
{ "edited_markdown": "example"}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
Examplegenerated
edited_markdown=examplePATCH 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
Responses
Section titled “Responses”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_editedare also exposed so the UI can offer a “revert to AI draft” affordance and warn before a regenerate would overwrite the draft.citationsis 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 SSEcitationsframe.
object
Example
{ "surface": "session", "lang": "en", "unit_system": "metric", "focus": ""}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).
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).
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).
Examplegenerated
{ "detail": "example"}