Skip to content

For AI agents: every API docs page in one plain-text file is at /docs/llms-full.txt, and the documentation index is at /llms.txt. This page is available as Markdown at https://diffio.ai/docs/api-reference/save-transcript-draft.md, and every docs URL returns Markdown when requested with Accept: text/markdown.

Save the transcript draft

Saves an arbitrary JSON object (data, up to 900,000 bytes) as the generation's transcript draft, with optional revision checking to prevent lost updates.

PUT https://api.diffio.ai/v2/projects/{project_id}/generations/{generation_id}/transcript/draft

  • Key scope: generations:write
  • Auth header:Authorization: Bearer <apiKey>
  • Body: JSON

Request

Send data (any JSON object up to 900,000 bytes) and optional revision from the last read.

Path parameters

FieldTypeRequiredDescription
#project_idstringRequired: YesUnique identifier of the project.
#generation_idstringRequired: YesUnique identifier of the generation within the project.

Headers

FieldTypeRequiredDescription
#Diffio-End-UserstringRequired: NoOptional end-user identifier (up to 128 characters). Scopes the request to that end user's projects; omit to act across the whole account.

Body fields

FieldTypeRequiredDescription
#dataobjectRequired: YesArbitrary JSON object holding your editor's draft state (at most 900000 bytes as compact UTF-8 JSON); stored and returned verbatim.
#revisionstringRequired: NoOptional opaque revision last read from GET .../transcript/draft. Refuses stale saves with 409 (revision_conflict) and details.current_revision; omit to overwrite unconditionally.

Request

import os
from diffio import DiffioClient

key = os.environ["DIFFIO_API_KEY"]
client = DiffioClient(api_key=key)

draft = client.transcripts.save_draft(
    "62f62565-049f-5e7e-bbd2-9de0cf7ddbfe",
    "ce832a32-a1ce-516a-b8bd-75457bd8517f",
    data={"cursor": 12, "removed": ["w3"]},
    revision="0",
)

Response

Returns the saved transcript_draft with its new revision.

Success: 200OK.

Response fields

FieldTypePresentDescription
#objectstringAlwaysResource type, always "transcript_draft".transcript_draft
#project_idstringAlwaysIdentifier of the parent project.
#generation_idstringAlwaysIdentifier of the generation.
#revisionstringAlwaysOpaque revision string ("0" before the first save); send back when saving or deleting to detect concurrent edits.
#dataobject | nullAlwaysSaved JSON object exactly as sent to PUT .../transcript/draft, or null when no draft is saved.
#created_atstring | nullAlwaysISO 8601 UTC timestamp when the current draft was first created, or null when empty.
#updated_atstring | nullAlwaysISO 8601 UTC timestamp when the draft was last saved, or null when empty.

Response 200OK.

Successful response
{
  "object": "transcript_draft",
  "project_id": "62f62565-049f-5e7e-bbd2-9de0cf7ddbfe",
  "generation_id": "ce832a32-a1ce-516a-b8bd-75457bd8517f",
  "revision": "1",
  "data": {
    "cursor": 12,
    "removed": [
      "w3"
    ]
  },
  "created_at": "2026-11-13T00:33:51.366709Z",
  "updated_at": "2026-11-13T00:33:51.366709Z"
}

Return codes

  • 200OK.Draft saved and returned with a new revision.
  • 400Bad request.
    Malformed JSON, or 3 more causes
    • Malformed JSON
    • Missing data
    • data is not a JSON object or revision is not one a draft answer gave
    • Oversized header
    invalid_jsonmissing_fieldinvalid_fieldinvalid_header
  • 403Forbidden: the key lacks permission.Key is inactive or lacks generations:write. permission_denied
  • 404Not found.Project not found, or generation not found. project_not_foundgeneration_not_found
  • 409Conflict: see error.code for which one.Sent revision does not match the current revision, reported in details.current_revision. revision_conflict
  • 413Payload too large.data exceeds 900,000 bytes when serialized as compact UTF-8 JSON. transcript_draft_too_large
  • 401Unauthorized: the API key is missing or invalid.405Client error.Same on every endpoint
    • 401Unauthorized: the API key is missing or invalid. Missing API key (code missing_api_key), or invalid API key (code invalid_api_key).
    • 405Client error. HTTP method not supported on this path; check the Allow header (code method_not_allowed).

Example error response

Errors are JSON: an error object with code, message and request_id. An unrecognized key returns 401Unauthorized: the API key is missing or invalid.:

Error response
{
  "error": {
    "code": "invalid_api_key",
    "message": "Invalid API key.",
    "request_id": "dead773b60e148fd9e22d680a22fa701"
  }
}

Notes

Report an issue with this page