{"openapi":"3.1.0","info":{"title":"Nabu Agent API","description":"AI-native screenwriting API. Authenticate with API keys, talk to Nisaba, create screenplays autonomously.","version":"2026-11-08","x-nabu-first-version":"2026-11-08","contact":{"name":"Nabu","url":"https://github.com/Nabu-Screenwriting/nabu-cli"}},"servers":[{"url":"https://app.nabu.page","description":"Nabu server"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"API key in format: nabu_sk_ + 48 hex chars. Pass as Authorization: Bearer nabu_sk_..."}},"schemas":{"ConversationDraft":{"type":"object","properties":{"content":{"type":"string"},"itemIds":{"type":"array","items":{"type":"string"}},"revision":{"type":"integer","minimum":0}},"required":["content","itemIds","revision"]},"MessageAttachment":{"type":"object","properties":{"itemId":{"type":"string"},"revisionId":{"type":["string","null"]}},"required":["itemId","revisionId"]},"ConversationMessage":{"type":"object","properties":{"id":{"type":"integer"},"conversationId":{"type":"string"},"role":{"type":"string","enum":["user","assistant","system"]},"content":{"type":"string"},"createdAt":{"type":"string"},"hidden":{"type":"boolean"},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/MessageAttachment"}},"attachmentTiles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"badge":{"type":"string"},"modality":{"type":"string"},"state":{"type":"string"}},"required":["id","label","badge","modality","state"]}}},"required":["id","conversationId","role","content"]},"ApiKeyMetadata":{"type":"object","required":["id","keyPrefix","name","apiVersion"],"properties":{"id":{"type":"string"},"keyPrefix":{"type":"string"},"name":{"type":"string"},"apiVersion":{"type":"string","format":"date","description":"Immutable mint pin; legacy NULL reads the first published contract."},"workspaceId":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"capabilities":{"type":"array","items":{"type":"string"}},"expiresAt":{"type":["string","null"]},"createdAt":{"type":"string"}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable error code (e.g., AUTH_UNAUTHENTICATED)"},"message":{"type":"string","description":"Human-readable error message"},"category":{"type":"string","enum":["transient","permanent","actionRequired"]},"suggestedAction":{"type":"string"},"retryable":{"type":"boolean"},"retryAfter":{"type":"number","description":"Seconds to wait before retry"},"details":{"type":"object"}},"required":["code","message","category","retryable"]}}},"ChatDispatch":{"description":"Durable chat dispatch identity. Read content and terminal controls from GET /api/projects/{projectId}/ai/turn/{jobId}/stream; this response is not the final assistant reply.","oneOf":[{"type":"object","properties":{"jobId":{"type":"string"},"turnId":{"type":"string"},"conversationId":{"type":"string"},"status":{"type":"string","description":"Current durable turn status; a replay can return an existing turn."},"executionBackend":{"type":"string","enum":["coordinator"]},"streamType":{"type":"string","enum":["turn"]},"responseText":{"type":"string","description":"Present for a resolved interaction: the canonical committed answer."},"answerPersisted":{"type":"boolean","description":"Present for a resolved interaction."}},"required":["jobId","turnId","conversationId","status","executionBackend","streamType"]},{"type":"object","properties":{"jobId":{"type":"string"},"conversationId":{"type":"string"},"executionBackend":{"type":"string","enum":["legacy-job"]},"streamType":{"type":"string","enum":["turn"]}},"required":["jobId","conversationId","executionBackend","streamType"]}]},"ProjectCapability":{"type":"object","description":"Partial discovery inspection, not execution authorization. The handler still validates the request and admission when invoked.","properties":{"action":{"type":"string"},"endpoint":{"type":"string"},"method":{"type":"string","enum":["POST"],"description":"Actual handler method. Exports require viewer/read authority despite using POST."},"available":{"type":"boolean","description":"True only when the inspected checks passed; never a reservation or execution guarantee."},"availability":{"type":"string","enum":["available","blocked","unknown"]},"reason":{"type":"string","description":"Present for blocked and unknown actions."},"remedy":{"type":"string","description":"Present for blocked and unknown actions."},"admission":{"type":"object","properties":{"status":{"type":"string","enum":["not_assessed"]},"uncheckedRequirements":{"type":"array","items":{"type":"string"},"description":"Requirements still owned by the actual execution handler; these are not successful checks."}},"required":["status","uncheckedRequirements"]}},"required":["action","endpoint","method","available","availability","admission"]},"ProjectCapabilities":{"type":"object","description":"Current visibility, role/scope and inspected prerequisites for eight existing actions. Nullable stage/lock/artifact fields correct earlier fabricated values and are a compatibility-impacting change. No billing admission is performed.","properties":{"projectId":{"type":"string"},"title":{"type":"string"},"wizardState":{"type":"string","enum":["present","absent","unreadable"]},"currentStage":{"type":["string","null"],"description":"Canonical wizard stage, including SYNOPSIS_COLLAB; null when absent or unreadable."},"stageIndex":{"type":["integer","null"],"minimum":0},"totalStages":{"type":"integer","description":"Length of the canonical stage order (currently 14)."},"progress":{"type":["number","null"],"minimum":0,"maximum":1},"isLocked":{"type":["boolean","null"]},"agentAutoAdvance":{"type":["boolean","null"]},"capabilities":{"type":"array","items":{"$ref":"#/components/schemas/ProjectCapability"},"description":"Only availability=available; this does not guarantee execution."},"blocked":{"type":"array","items":{"$ref":"#/components/schemas/ProjectCapability"},"description":"Both blocked and unknown actions, each with reason/remedy."},"artifacts":{"type":"object","description":"Inspected presence, not semantic validity or completed-stage history. Null means unassessed/unreadable; the pitches reader also collapses absence to null.","properties":{"bones":{"type":["boolean","null"]},"synthesis":{"type":["boolean","null"]},"validation":{"type":["boolean","null"]},"pitches":{"type":["boolean","null"]},"lockedDirection":{"type":["boolean","null"]},"treatment":{"type":["boolean","null"]},"spine":{"type":["boolean","null"]},"scenes":{"type":["boolean","null"]}},"required":["bones","synthesis","validation","pitches","lockedDirection","treatment","spine","scenes"]}},"required":["projectId","title","wizardState","currentStage","stageIndex","totalStages","progress","isLocked","agentAutoAdvance","capabilities","blocked","artifacts"]},"ProjectSummary":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"author":{"type":"string"},"logline":{"type":"string"},"genre":{"type":"string"},"format":{"type":"string","enum":["feature","short"]},"status":{"type":"string"},"updatedAt":{"type":"string","format":"date-time"},"pageCount":{"type":"number"},"sceneCount":{"type":"number"}},"required":["id","title","author","updatedAt"]},"WizardState":{"type":"object","properties":{"version":{"type":"number"},"currentStage":{"type":"string","enum":["BONES","CONVERSATION","EXTRACTION","PITCH_GENERATION","DIRECTION_SELECTION","DIRECTION_LOCKED","TREATMENT_COLLAB","SPINE_EXTRACT","TREATMENT_EXTRACTION","SCENE_GENERATION","REVIEW","COMPLETE"]},"completedStages":{"type":"array","items":{"type":"string"}},"conversationId":{"type":"string"},"treatmentLocked":{"type":"boolean"},"agentAutoAdvance":{"type":"boolean"},"materialDoor":{"description":"Read-only current door from the intake run; never a draft or carriage field.","oneOf":[{"type":"null"},{"$ref":"#/components/schemas/MaterialDoor"}]},"updatedAt":{"type":"string","format":"date-time"}}},"MaterialDoor":{"type":"object","required":["kind","itemId","intakeId","projectId","workspaceId","phase","status","backfillJobId","sourceFilename","sourceFormat","routedPressedAt"],"properties":{"kind":{"type":"string","enum":["import-script","import-treatment"]},"itemId":{"type":["string","null"]},"intakeId":{"type":"string"},"projectId":{"type":"string"},"workspaceId":{"type":"string"},"phase":{"type":"string","enum":["review","running","landed"]},"status":{"type":"string","enum":["staged","parsed","classifying","classified","confirmed","materializing","backfilling","cancelling","completed"]},"backfillJobId":{"type":["string","null"]},"sourceFilename":{"type":"string"},"sourceFormat":{"type":["string","null"]},"routedPressedAt":{"type":["string","null"]}}},"MusicTrackIdentity":{"type":"object","properties":{"provider":{"type":"string","enum":["apple"]},"externalId":{"type":"string"},"title":{"type":"string"},"artist":{"type":"string"},"previewUrl":{"type":"string","description":"Transient search preview URL; omitted on cache hits and never persisted."}},"required":["provider","externalId","title","artist"]},"MusicLookupResponse":{"oneOf":[{"type":"object","properties":{"previewUrl":{"type":"string"},"storeUrl":{"type":"string"},"title":{"type":"string"},"artist":{"type":"string"}},"required":["previewUrl","title","artist"]},{"type":"object","properties":{"track":{"type":"null"}},"required":["track"]}]}}},"paths":{"/api/projects/{id}/considerations/{family}/{memberId}/ruling":{"post":{"tags":["Projects"],"summary":"Dismiss a machine note with an explicit reason and scope","description":"Editor access. Claim scope is derived by the server from the persisted note. Thread scope requires a server-verified note/thread association. It records intentional-complete (the existing graph projection labels this paid_off); it adds no page payoff. A current thread ruling requires replace:true, otherwise 409 names its handle. Reasons are verbatim. Existing reasonless Dismiss buttons create an empty-reason claim ruling; accept/resolve remain dated context. Keyed success and its effect commit together.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"family","in":"path","required":true,"schema":{"type":"string","enum":["flag","finding","note"]}},{"name":"memberId","in":"path","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["reason","scope"],"properties":{"reason":{"type":"string","minLength":1,"maxLength":10000},"replace":{"type":"boolean","description":"Thread scope only. Explicit consent to replace its current ruling."},"scope":{"oneOf":[{"type":"object","required":["kind"],"properties":{"kind":{"type":"string","enum":["claim"]}}},{"type":"object","required":["kind","threadId","kindOfRuling"],"properties":{"kind":{"type":"string","enum":["thread"]},"threadId":{"type":"string"},"kindOfRuling":{"type":"string","enum":["intentional-complete"]}}}]}}}}}},"responses":{"200":{"description":"Scoped ruling saved","content":{"application/json":{"schema":{"type":"object","required":["success","incidentId","rulingId","handle"],"properties":{"success":{"type":"boolean"},"incidentId":{"type":"string"},"rulingId":{"type":"string"},"handle":{"type":"string"}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Reason, scope, or source is unsuitable SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"403":{"description":"Editor access required","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"409":{"description":"Note answered/unavailable, thread split, or existing ruling requires explicit replacement","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"422":{"description":"Missing/unrelated thread, or idempotency key belongs to a different request or principal","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/projects/{id}/decisions/{handle}":{"get":{"tags":["Projects"],"summary":"Read a dated decision from its owner","description":"Viewer access. R·<ruling id>, D·<incident id>, D·suggestion:<id>, P·feeder:<evidence id>; P·<message id> is the actual visible writer reply, with unknown authorship retained. No coordinator reads; no memory is page canon.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"handle","in":"path","required":true,"schema":{"type":"string"}},{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"Dated source record","content":{"application/json":{"schema":{"type":"object","required":["handle","source","at","action","verbatim","actor","actorUserId"],"properties":{"handle":{"type":"string"},"source":{"type":"object","required":["kind","id"],"properties":{"kind":{"type":"string","enum":["incident","thread-ruling","message","feeder-choice","suggestion"]},"id":{"type":"string"}}},"at":{"type":["string","null"]},"action":{"type":"string"},"verbatim":{"type":["string","null"]},"actor":{"type":["object","null"],"additionalProperties":true},"actorUserId":{"type":["string","null"]},"context":{}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"403":{"description":"Viewer access required","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"404":{"description":"Handle unavailable in this project","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/projects/{id}/material":{"get":{"tags":["Projects"],"summary":"List the pending attachments (writer material)","description":"Editor access (GH #3617). The project's attachments that have not gone anywhere yet — project scope, not withdrawn, not routed through a door (an item routed to the idea at Let's Go stays pending while the bones are not frozen, GH #3618), not a dead upload — in drop order: what a tray restores after a refresh. Each row says whether the item is still being read and, once settled, what it is (type: the writer's own, else the reading's, as one of five; GH #3618), and whether the writer pinned it (pinned, GH #3673). Read-only.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"pinned","in":"query","required":false,"schema":{"type":"string","enum":["1"]},"description":"GH #3673: answer the writer's PINNED project items instead — every pinned item the chat's prompt reads (see mode), a note kept beside an import door included — as the same rows: what a chat composer shows first."},{"name":"mode","in":"query","required":false,"schema":{"type":"string","enum":["chat","scene","character","wizard","treatment","collab","nisaba"]},"description":"REQUIRED with pinned=1 (a missing or unknown mode is a 400): the chat's conversation mode. A wizard chat's prompt never carries a project script as material, so its list never names one; any other mode reads as a chat turn."},{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"The pending items","content":{"application/json":{"schema":{"type":"object","required":["items"],"properties":{"items":{"type":"array","items":{"type":"object","required":["itemId","label","badge","modality","order","state","type","pinned"],"properties":{"itemId":{"type":"string"},"label":{"type":"string"},"badge":{"type":"string"},"modality":{"type":"string","enum":["text","document","image","audio"]},"order":{"type":"integer","minimum":0},"state":{"type":"string","enum":["reading","settled","unreadable"]},"type":{"type":"string","nullable":true,"enum":["script","treatment","note","research","reference",null]},"pinned":{"type":"boolean"}}}}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"pinned=1 without a valid mode SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"401":{"description":"Not signed in","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"403":{"description":"Editor access required","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/projects/{id}/material/{itemId}":{"get":{"tags":["Projects"],"summary":"Preview an attachment (writer material)","description":"Editor access (GH #3673). What the preview sheet shows beyond the tile: line — the first line of what Nabu read from the item, on one line and bounded (null while it is still being read, or when nothing could be read); note — why it was not read whole, as a key (pagesUnread, cannotRead, tooLarge), else null. A withdrawn item is a 404. Read-only.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"itemId","in":"path","required":true,"schema":{"type":"string"}},{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"The preview","content":{"application/json":{"schema":{"type":"object","required":["itemId","line","note"],"properties":{"itemId":{"type":"string"},"line":{"type":"string","nullable":true},"note":{"type":"string","nullable":true,"enum":["pagesUnread","cannotRead","tooLarge",null]}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"401":{"description":"Not signed in","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"403":{"description":"Editor access required","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"404":{"description":"The project holds no such attachment","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}},"patch":{"tags":["Projects"],"summary":"Withdraw an attachment, say what it is, or pin it","description":"Editor access (GH #3617, GH #3618, GH #3673). Send exactly one of { withdrawn: true }, { type } or { pinned }. { withdrawn: true } takes the item out of the story: it leaves every future prompt and the pending list. Reversible — nothing is deleted, and adding the same file again brings the item back. An item already withdrawn answers the same. { type } is the writer's own type for the item; Let's Go routes by it and never overrides it. The type she already set answers the same; a withdrawn item is a 404. { pinned } is the writer's pin: a pinned item goes first in the material every prompt reads, and stays in view in the first chat composer. The pin already on file answers the same; a withdrawn item is a 404. Keyed retries replay.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"itemId","in":"path","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","additionalProperties":false,"required":["withdrawn"],"properties":{"withdrawn":{"type":"boolean","enum":[true]}}},{"type":"object","additionalProperties":false,"required":["type"],"properties":{"type":{"type":"string","enum":["script","treatment","note","research","reference"]}}},{"type":"object","additionalProperties":false,"required":["pinned"],"properties":{"pinned":{"type":"boolean"}}}]}}}},"responses":{"200":{"description":"Withdrawn, her type is on file, or her pin is","content":{"application/json":{"schema":{"oneOf":[{"type":"object","required":["itemId","withdrawn"],"properties":{"itemId":{"type":"string"},"withdrawn":{"type":"boolean","enum":[true]}}},{"type":"object","required":["itemId","type"],"properties":{"itemId":{"type":"string"},"type":{"type":"string","enum":["script","treatment","note","research","reference"]}}},{"type":"object","required":["itemId","pinned"],"properties":{"itemId":{"type":"string"},"pinned":{"type":"boolean"}}}]}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Malformed request SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"401":{"description":"Not signed in","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"403":{"description":"Editor access required","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"404":{"description":"The project holds no such attachment","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"409":{"description":"The same idempotency key is still in progress, or withdrawal is refused with STATE_PREREQUISITE_NOT_MET because the attachment is associated with this project's active import (including a kept companion). Nothing is withdrawn.","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"422":{"description":"The idempotency key belongs to a different request or principal","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"503":{"description":"The idempotency status is unknown","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/projects/{id}/material/presign":{"post":{"tags":["Projects"],"summary":"Start an attachment upload (writer material)","description":"Editor access. Send the file's name, size and SHA-256 (GH #3000 A0b). Bytes already in this scope answer that item (deduplicated: item); bytes kept elsewhere in the project make a new item on that source (deduplicated: source); otherwise the answer is a signed manifest and where to send the bytes: a create-once presigned PUT (upload.mode direct — send exactly upload.headers; the length must be the body's own) valid ten minutes, or the commit route itself on a local server (upload.mode stream). Refusals carry one sentence and details.reason (material-upload-*; upload-paced). Keyed retries replay.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["filename","size","sha256","surface"],"properties":{"filename":{"type":"string","minLength":1,"maxLength":255},"size":{"type":"integer","minimum":1},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"surface":{"type":"string","enum":["spark","chat","api"]},"conversationId":{"type":["string","null"]},"order":{"type":"integer","minimum":0,"maximum":10000},"paste":{"type":["object","null"],"additionalProperties":false,"required":["lines","chars"],"properties":{"lines":{"type":"integer","minimum":0},"chars":{"type":"integer","minimum":0}}}}}}}},"responses":{"200":{"description":"Deduplicated, or the upload to perform","content":{"application/json":{"schema":{"type":"object","required":["itemId","sourceId","deduplicated"],"properties":{"itemId":{"type":"string"},"sourceId":{"type":"string"},"deduplicated":{"type":["string","null"],"enum":["item","source",null]},"jobId":{"type":["string","null"]},"manifest":{"type":"object","additionalProperties":true},"signature":{"type":"string"},"upload":{"type":"object","required":["mode","url","method","expiresAt"],"properties":{"mode":{"type":"string","enum":["direct","stream"]},"url":{"type":"string"},"method":{"type":"string","enum":["PUT","POST"]},"headers":{"type":"object","additionalProperties":{"type":"string"}},"expiresAt":{"type":"string","format":"date-time"}}}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Malformed request SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"401":{"description":"Not signed in","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"403":{"description":"Editor access required","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"409":{"description":"The same idempotency key is still in progress","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"413":{"description":"File too large","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"415":{"description":"File type not supported","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"422":{"description":"The idempotency key belongs to a different request or principal","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"429":{"description":"Upload pace, pending items, or the daily bytes limit — decided before the key is recorded, so the same key may be retried after Retry-After (one exception: a scope that filled in the locked attach of a kept-source item is recorded under the key)","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"503":{"description":"Uploads paused (storage cost guard; Retry-After), or the idempotency status is unknown","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/projects/{id}/material/{itemId}/commit":{"post":{"tags":["Projects"],"summary":"Commit an attachment upload","description":"Editor access. After the direct PUT, send the manifest, its signature and the ETag the PUT answered. The server checks the stored object against them, promotes it, records the item and starts its free ingest (jobId — the current ingest attempt's job). The same manifest again answers the same item without repeating anything. On a local server only, send multipart manifest + signature + file instead.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"itemId","in":"path","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["manifest","signature","etag"],"properties":{"manifest":{"type":"object","additionalProperties":true},"signature":{"type":"string"},"etag":{"type":"string"}}}}}},"responses":{"200":{"description":"Committed","content":{"application/json":{"schema":{"type":"object","required":["itemId","sourceId","jobId","deduplicated"],"properties":{"itemId":{"type":"string"},"sourceId":{"type":"string"},"jobId":{"type":"string"},"deduplicated":{"type":["string","null"],"enum":["item",null]}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Malformed or tampered manifest SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"401":{"description":"Not signed in","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"403":{"description":"Editor access required","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"404":{"description":"Not an item id","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"409":{"description":"The upload did not arrive as signed, expired, or the item holds another manifest — add the file again; or the same idempotency key is still in progress","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"413":{"description":"File too large (local stream lane)","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"422":{"description":"The idempotency key belongs to a different request or principal","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"429":{"description":"Commit pacing (per item over the manifest's life, per account per minute) — wait for Retry-After; decided before the key is recorded. Or the scope filled before this upload committed — remove an item and add the file again","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"503":{"description":"The idempotency status is unknown","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/keys":{"post":{"tags":["Authentication"],"summary":"Create a new API key","description":"Returns the plaintext key exactly once. Requires a platform admin (AUTH_INSUFFICIENT_PERMISSION otherwise), then workspace admin/owner and api_access checks. Workspace ownership alone does not authorize creation.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Human-readable key name"},"scopes":{"type":"array","items":{"type":"string","enum":["read","write","admin"]}},"capabilities":{"type":"array","items":{"type":"string","enum":["agent_mode","auto_advance","autonomous_write","dispatch_agents","admin"]}},"expiresAt":{"type":"string","format":"date-time","nullable":true}},"required":["name"]}}}},"responses":{"201":{"description":"Key created. plaintext field shown only once.","content":{"application/json":{"schema":{"type":"object","required":["key","plaintext"],"properties":{"key":{"$ref":"#/components/schemas/ApiKeyMetadata"},"plaintext":{"type":"string"},"warning":{"type":"string"}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"401":{"description":"Not authenticated","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"403":{"description":"AUTH_INSUFFICIENT_PERMISSION for a non-platform-admin or insufficient workspace role, or BILLING_FEATURE_NOT_INCLUDED — the plan does not include api_access (details.gate carries the classified refusal, requiredPlan \"professional\"); nothing is minted","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]},"get":{"tags":["Authentication"],"summary":"List API keys for the workspace","responses":{"200":{"description":"Key metadata (no secrets)","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"$ref":"#/components/schemas/ApiKeyMetadata"}}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/billing/subscription/change":{"get":{"tags":["Billing"],"summary":"Read a pending change, or preview a plan change","description":"Billing admin only (admin scope for API keys). Without planId, reads the owned Stripe pending decrease and its withdrawal token; this read is available with purchases closed. With planId, previews either an immediate paid upgrade or Pro Max to Pro in the same cadence at period end (changeKind=period-end, zero due today). The opaque signed v2 previewToken binds workspace, subscription, item, current price/quantity, period end, schedule basis and target price for one hour. A failed or unfamiliar schedule read is an error, never pendingChange=null. Plan previews are purchase-fenced.","parameters":[{"name":"planId","in":"query","required":false,"schema":{"type":"string","enum":["writer","professional","professional_large"]}},{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"The price of the change","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"changeKind":{"type":"string","enum":["immediate","period-end"]},"planId":{"type":"string"},"fromPlanId":{"type":"string","nullable":true},"previewToken":{"type":"string","description":"Opaque; echo it on the POST (1 h)"},"waitingOnPayment":{"type":"boolean"},"period":{"type":"string","enum":["monthly","yearly"]},"amountDueCents":{"type":"integer"},"currency":{"type":"string"},"renewalPriceCents":{"type":"integer","nullable":true},"renewsAt":{"type":"string","format":"date-time","nullable":true},"card":{"type":"object","nullable":true,"properties":{"brand":{"type":"string"},"last4":{"type":"string"}}}},"required":["planId","previewToken","waitingOnPayment","period","amountDueCents","currency"]},{"type":"object","required":["pendingChange","withdrawToken"],"properties":{"pendingChange":{"type":"object","nullable":true,"required":["planId","period","effectiveAt"],"properties":{"planId":{"type":"string","enum":["professional"]},"period":{"type":"string","enum":["monthly","yearly"]},"effectiveAt":{"type":"string","format":"date-time"}}},"withdrawToken":{"type":"string","nullable":true,"description":"Opaque current schedule proof; echo on DELETE"}}}]}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Unknown planId SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"403":{"description":"Not the billing admin, or BILLING_PURCHASES_CLOSED","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"409":{"description":"STATE_PREREQUISITE_NOT_MET — no live subscription, the current plan, an unrelated decrease (only Pro Max to Pro is supported), or a plan set to end","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}},"post":{"tags":["Billing"],"summary":"Apply an immediate upgrade or period-end size decrease","description":"Billing admin only (admin scope for API keys). An upward change charges the proration NOW (always_invoice) and changes nothing unless paid (pending_if_incomplete). Pro Max to Pro instead schedules the same-cadence size decrease at period end with nothing charged today; outcome scheduled leaves current access/window unchanged. Webhooks alone project the plan: an immediate upgrade waits for its paid proration, while the scheduled decrease waits for the boundary price change. Read current access from GET /api/billing/credits. Send X-Idempotency-Key; a replay never charges twice.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"planId":{"type":"string","enum":["writer","professional","professional_large"]},"previewToken":{"type":"string","description":"The GET preview's previewToken for this plan (no older than an hour)"}},"required":["planId","previewToken"]}}}},"responses":{"200":{"description":"`scheduled` is the durable future Pro size, with current access unchanged; `charged` is an immediate paid upgrade; `payment_needed` waits on the card","content":{"application/json":{"schema":{"type":"object","properties":{"outcome":{"type":"string","enum":["charged","payment_needed","scheduled"]},"planId":{"type":"string"}},"required":["outcome","planId"]}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"403":{"description":"Not the billing admin, or BILLING_PURCHASES_CLOSED","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"409":{"description":"STATE_PREREQUISITE_NOT_MET (see GET; also: a change waiting on the card, a missing, forged, expired or other-change previewToken, a price that does not match the published one) or STATE_ALREADY_IN_PROGRESS (the same key still running — not a refusal)","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]},"delete":{"tags":["Billing"],"summary":"Withdraw the owned pending decrease and keep the current size","description":"Billing admin only. No purchase fence. Send the current withdrawal token returned by GET without planId. Re-reads the schedule under the shared mutation lock; stale or foreign intent is refused. Principal-bound cache-5xx idempotency. An unconfirmed provider response is never a claim of no effect.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["previewToken"],"properties":{"previewToken":{"type":"string"}}}}}},"responses":{"200":{"description":"Withdrawn; confirm by the pending read","content":{"application/json":{"schema":{"type":"object","required":["outcome"],"properties":{"outcome":{"type":"string","enum":["withdrawn"]}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"403":{"description":"Not the billing admin","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"409":{"description":"Stale proof, unfamiliar schedule, or another change in progress","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/billing/subscription/cancel":{"post":{"tags":["Billing"],"summary":"Cancel the subscription at its period end","description":"Billing admin only (admin scope for API keys). Not fenced by the purchases switch. An owned schedule retains its current phase with end_behavior cancel; repeated cancellation is read-only. Unscheduled subscriptions keep the flag/date path. The plan stays until the period ends. Works for a live or a dunning subscription. The answer is a hint; GET /api/billing/credits reads back `subscription.cancelAtPeriodEnd` / `endsAt` once the webhook records it. Send X-Idempotency-Key.","responses":{"200":{"description":"Accepted","content":{"application/json":{"schema":{"type":"object","properties":{"cancelAtPeriodEnd":{"type":"boolean"},"renewsAt":{"type":"string","format":"date-time","nullable":true},"endsAt":{"type":"string","format":"date-time","nullable":true}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"403":{"description":"Not the billing admin","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"409":{"description":"STATE_PREREQUISITE_NOT_MET — no subscription to cancel (a lapsed plan is resubscribed)","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]},"delete":{"tags":["Billing"],"summary":"Resume an actual cancellation; otherwise preserve the pending plan change","description":"Billing admin only (admin scope for API keys). Resumes an actually cancelled owned schedule using its current phase and release behavior, or clears only the flag/date Stripe holds on an unscheduled subscription. With no cancellation there is no provider write and a pending Pro decrease survives. The answer is a hint, never confirmation of the requested state; read the result back from GET /api/billing/credits. Send X-Idempotency-Key.","responses":{"200":{"description":"Accepted","content":{"application/json":{"schema":{"type":"object","properties":{"cancelAtPeriodEnd":{"type":"boolean"},"endsAt":{"type":"string","format":"date-time","nullable":true},"renewsAt":{"type":"string","format":"date-time","nullable":true}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"403":{"description":"Not the billing admin","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"409":{"description":"STATE_PREREQUISITE_NOT_MET — no subscription to resume","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/me/avatar":{"put":{"tags":["Account"],"summary":"Set or replace the profile picture","description":"multipart/form-data with ONE `image` part: PNG, JPEG or WebP (type from the bytes), up to 5 MB, at most 8192 pixels on an axis and 25 megapixels (4096 × 4096 for a PNG or WebP). Re-encoded to centred square WebPs (256 and 64 px), all metadata stripped. 5 uploads per hour per person. The answer's `avatarUrl` (`/api/images/user/<id>/avatar/<imageId>.webp`, public and immutable) is what the session now carries. Send X-Idempotency-Key.","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["image"],"properties":{"image":{"type":"string","format":"binary"}}}}}},"responses":{"200":{"description":"Set","content":{"application/json":{"schema":{"type":"object","properties":{"avatarUrl":{"type":"string","nullable":true}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"VALIDATION_INVALID_INPUT — details.reason `image-refused` (refusal: unsupported-type | too-large | dimensions | undecodable) or `too-many-files` SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Error"},{"$ref":"#/components/schemas/Error"}]}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"429":{"description":"RATE_LIMIT_TOO_MANY_REQUESTS — 5 uploads per hour; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"503":{"description":"SYSTEM_SERVICE_UNAVAILABLE — storage or the service budget is unavailable; retry later","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]},"delete":{"tags":["Account"],"summary":"Remove the profile picture","description":"Back to the sign-in provider's picture, or none (`avatarUrl: null` — the initials). Send X-Idempotency-Key.","responses":{"200":{"description":"Removed","content":{"application/json":{"schema":{"type":"object","properties":{"avatarUrl":{"type":"string","nullable":true}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects":{"get":{"tags":["Projects"],"summary":"List all projects in the workspace","responses":{"200":{"description":"Array of ProjectSummary","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]},"post":{"tags":["Projects"],"summary":"Create a new project","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"author":{"type":"string"},"genre":{"type":"string"},"format":{"type":"string","enum":["feature","short"]},"logline":{"type":"string"},"harnessProbe":{"type":"boolean","enum":[true],"description":"ADMIN ONLY. Marks an operator-harness project: hidden from every project listing, reachable only by a platform admin or by the recorded minting principal (404 for everyone else, including members of the owning workspace), and created with background AI forced off. A non-admin caller is rejected by the admin guard; any value other than true is a 400. Used by the R2 A3 SLO harness, which mints one, measures in it, and deletes it."}},"required":["title","author"]}}}},"responses":{"201":{"description":"Created project","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}":{"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}}],"get":{"tags":["Projects"],"summary":"Get project details","parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}},"put":{"tags":["Projects"],"summary":"Update project metadata","parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}},"delete":{"tags":["Projects"],"summary":"Delete a project","parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/projects/{projectId}/acts":{"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}}],"get":{"tags":["Projects"],"summary":"A TV script's page acts: each act's printed words and the placed scenes it holds (GH #1557 S6)","description":"The End of Act lines on the page through the one act reader, in placed-scene order. `acts: null` for a feature or short and for a TV script with no End of Act yet. Read-only; no billing, no event.","responses":{"200":{"description":"The page acts, or null","content":{"application/json":{"schema":{"type":"object","required":["acts"],"properties":{"acts":{"type":["array","null"],"items":{"type":"object","required":["words","sceneIds"],"properties":{"words":{"type":"string","description":"The act as the page names it: COLD OPEN, TEASER, ACT ONE … TAG, or a writer heading"},"sceneIds":{"type":"array","items":{"type":"string"}},"plannedPages":{"type":"number","description":"Optional registered act page budget while the script contains scene ideas; written estimates stay actual"}}}}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"404":{"description":"The project does not exist or is not visible to the caller","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}/ai/chat":{"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}}],"post":{"tags":["Chat"],"summary":"Send a message to Nisaba","description":"Dispatch a durable chat turn and return JSON identity immediately, including when caller=agent or stream=true. Subscribe separately to GET /api/projects/{projectId}/ai/turn/{jobId}/stream for content and terminal controls.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"User message text"},"mode":{"type":"string","enum":["chat","wizard","treatment","collab","nisaba"],"default":"chat"},"conversationId":{"type":"string","description":"Continue an existing conversation"},"resumeMessageId":{"type":"integer","minimum":1,"description":"Re-send the committed user row and its frozen attachments; appends nothing. Requires conversationId."},"draftRevision":{"type":"integer","minimum":1,"description":"Revision returned by the conversation draft PATCH; send together with attachmentItemIds."},"attachmentItemIds":{"type":"array","items":{"type":"string"},"description":"Ordered item ids of the saved conversation draft. The server freezes reading revisions on the message."},"caller":{"type":"string","enum":["ui","agent"],"default":"ui","description":"Caller mode. agent = autonomous decisions, no choice presentation. Requires agent_mode capability."},"autoAdvance":{"type":"boolean","default":false,"description":"Auto-advance wizard stages. Requires auto_advance capability."},"stream":{"type":"boolean","default":false,"description":"Compatibility request flag; chat POST returns JSON dispatch metadata regardless. Subscribe to the separate turn stream for tokens."},"useTools":{"type":"boolean","default":true},"modelTierOverride":{"type":"string","enum":["default","heavy","fast","chat"],"description":"A tier, never a model: the server picks the model (the writer's saved pick, the admin rows and the plan). Any other value is refused 400 VALIDATION_INVALID_INPUT naming modelTierOverride, before anything is written or admitted."}},"anyOf":[{"required":["message"]},{"required":["resumeMessageId","conversationId"]}]}}}},"responses":{"200":{"description":"Durable chat dispatch identity (coordinator turn or supported legacy job); not a final assistant reply.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatDispatch"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"VALIDATION_INVALID_INPUT — among others, a modelTierOverride that is not one of its tiers (error.details.fields.modelTierOverride). Nothing is written, reserved or dispatched. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"401":{"description":"Not authenticated","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"409":{"description":"STATE_CONVERSATION_TURN_LIVE — Nisaba is still answering in this conversation. No turn or billing reservation is created. Ordinary chat writes no message; wizard preserves its project-locked message and returns error.details.savedUserMessageId plus conversationId. Keep that row rather than restoring its text to the composer. error.details.activeTurnId identifies the live owner; send again after terminal truth, accepted Stop, or explicit server release of an aged wizard park. The park remains recoverable in operations; missing age or ownership keeps the guard.","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"423":{"description":"Project locked by orchestrator","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}/conversations":{"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}}],"post":{"tags":["Chat"],"summary":"Create or ensure a conversation before attaching material","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","default":"chat"},"title":{"type":"string"},"ensure":{"type":"boolean","description":"Use the existing active/stage binding instead of creating an unrelated thread."},"expectedStage":{"type":"string"}}}}}},"responses":{"200":{"description":"Ensured binding","content":{"application/json":{"schema":{"type":"object","properties":{"conversationId":{"type":"string"}},"required":["conversationId"]}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"201":{"description":"Created conversation","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}/conversations/{conversationId}":{"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}},{"name":"conversationId","in":"path","required":true,"schema":{"type":"string"}}],"get":{"tags":["Chat"],"summary":"Read conversation messages or the authenticated author’s draft","parameters":[{"name":"draft","in":"query","schema":{"type":"integer","enum":[1]}},{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"Messages optionally carry frozen attachments and attachmentTiles. With draft=1 returns this author’s draft only.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"messages":{"type":"array","items":{"$ref":"#/components/schemas/ConversationMessage"}}},"required":["messages"]},{"type":"object","properties":{"draft":{"$ref":"#/components/schemas/ConversationDraft"}},"required":["draft"]}]}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}},"patch":{"tags":["Chat"],"summary":"Save this author’s conversation draft by revision CAS","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string"},"itemIds":{"type":"array","items":{"type":"string"}},"expectedRevision":{"type":"integer","minimum":0}},"required":["content","itemIds","expectedRevision"]}}}},"responses":{"200":{"description":"Saved draft and new revision","content":{"application/json":{"schema":{"type":"object","properties":{"draft":{"$ref":"#/components/schemas/ConversationDraft"}},"required":["draft"]}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"409":{"description":"Draft changed; no overwrite","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}/ai/voice/transcribe":{"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}}],"post":{"tags":["Voice"],"summary":"Speech-to-text (dictation)","description":"Transcribe an audio clip. Multipart upload; gated by the `voice` plan feature (admins bypass). `X-Idempotency-Key` replays the JSON result without re-charging.","requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"audio":{"type":"string","format":"binary","description":"Audio (webm/mp4/mp3/wav), capped by UploadKind.voice + server-side duration verification"},"intentVersion":{"type":"string","enum":["request-v1"],"description":"Opt into request-only idempotency binding; retain this value for every retry. Omission preserves the legacy model/vocabulary binding."},"language":{"type":"string","description":"ISO-639-1 hint (optional)"},"conversationId":{"type":"string"},"messageId":{"type":"string"}},"required":["audio"]}}}},"responses":{"200":{"description":"Transcript","content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"},"durationSec":{"type":"number"},"model":{"type":"string"},"provider":{"type":"string"}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"402":{"description":"Insufficient credits","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"403":{"description":"`voice` feature not included in plan","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}/ai/voice/synthesize":{"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}}],"post":{"tags":["Voice"],"summary":"Text-to-speech (dormant — no client playback in v1)","description":"Synthesize speech from text; returns raw audio bytes. Gated by the `voice` plan feature. Built but no client playback is wired in v1.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","description":"Text to synthesize (capped at MAX_TTS_INPUT_CHARS)"},"personaId":{"type":"string","default":"nisaba-standard"},"format":{"type":"string","default":"mp3","description":"Output format (mp3/wav/…)"},"conversationId":{"type":"string"},"messageId":{"type":"string"}},"required":["text"]}}}},"responses":{"200":{"description":"Audio bytes; Content-Type follows the requested `format` (mp3→audio/mpeg, wav→audio/wav, …)","content":{"audio/mpeg":{"schema":{"type":"string","format":"binary"}},"audio/wav":{"schema":{"type":"string","format":"binary"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"402":{"description":"Insufficient credits","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"403":{"description":"`voice` feature not included in plan","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}/wizard":{"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}}],"get":{"tags":["Wizard"],"summary":"Get current wizard pipeline state","responses":{"200":{"description":"WizardState object","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]},"patch":{"tags":["Wizard"],"summary":"Update wizard state fields","parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/projects/{projectId}/wizard/bones":{"post":{"tags":["Wizard"],"summary":"Freeze story bones (format, spark, genre, instincts)","parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/projects/{projectId}/wizard/extract":{"post":{"tags":["Wizard"],"summary":"Dispatch extraction job (conversation → structured data)","responses":{"202":{"description":"Job dispatched","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}/wizard/pitch-generate":{"post":{"tags":["Wizard"],"summary":"Generate 3 pitch directions","responses":{"202":{"description":"Job dispatched","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}/wizard/pitch-select":{"post":{"tags":["Wizard"],"summary":"Select a pitch direction","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"selectedIndex":{"type":"number","description":"0-based index of the selected pitch"},"directionId":{"type":"string","description":"Optional. The id of the direction the caller was shown; when sent it must be the id at selectedIndex, or the pick is refused as stale (400). Refused with a retryable 503 (details.reason \"pitch-regeneration-running\") while a pitch regeneration is running."},"mixNotes":{"type":"string","description":"Optional notes for mixing elements from multiple pitches"},"ending":{"type":"object","description":"Optional (GH #2374). Ending held for the pick. For a feature, decision edits steps.climax (step 10) and finalImage edits steps.newStatusQuo (step 12); the saved direction carries steps and arc, with no turns, beats copy, opposition.moves or ending copy. Other formats keep their own ending. Explicit adopted origin must match the saved story-change proposal and keeps Nabu authorship; typed is the writer's wording. Omit origin for legacy behavior. Both sentences non-empty, at most 2,000 characters each; never with mixNotes (400).","properties":{"decision":{"type":"string","description":"What the lead decides or does at the climax"},"finalImage":{"type":"string","description":"The last image on screen"},"origin":{"type":"string","enum":["adopted","typed"],"description":"Optional. adopted must match the selected saved story-change ending; it keeps Nabu authorship. typed is the writer’s wording. Omit for legacy behavior."}},"required":["decision","finalImage"]},"base":{"type":"object","description":"Optional (GH #2449 r4). The writer's own answers to the story-base questions the selected direction's pitch left OPEN (a field its plan left empty, or every field when its plan was unavailable). A direction with an open question (or no proposed ending) is refused 400 with details.reason 'pitch-base-open' and details.open (the fields) until they are answered; an answer to a field the pitch decided is refused 400 (details.reason 'pitch-base-not-open'). Stored on the locked direction as the writer's (decided 'writer'). Never with mixNotes.","properties":{"dramaticQuestion":{"type":"string","description":"One sentence, at most 600 characters"},"stakes":{"type":"string","description":"One sentence, at most 600 characters"},"setting":{"type":"string","description":"One sentence, at most 600 characters"},"themes":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":3},"cast":{"type":"array","minItems":1,"maxItems":6,"description":"The leads, the lead first (the protagonist); names unique","items":{"type":"object","properties":{"name":{"type":"string"},"want":{"type":"string"}},"required":["name","want"]}}}},"seriesKind":{"type":"string","enum":["ongoing","limited"],"description":"Optional (GH #2542, TV P1a). The writer's answer to a SERIES direction's kind of show (a new TV pilot's pitch): ongoing (season by season) or limited (one closed story). A series direction with no kind is refused 400 with details.reason 'pitch-base-open' and details.open containing 'seriesKind' until answered; an answer different from the pitch's proposal is stored on the locked direction as the writer's (seriesKindByWriter). Refused 400 on a direction that is not a series pitch (details.reason 'series-kind-not-series'), on any other value, and with mixNotes."},"bStories":{"type":"object","description":"Optional (GH #5757, active when B stories in the wizard are enabled). The writer's B-story choice for the selected or mixed direction: `{ mode: 'declined' }` (explicit None, remembered on the story map) or `{ mode: 'selected', items: [...] }` where each item is `{ origin: 'adopted', proposalId }` (must match a saved candidate on the chosen direction — revalidated under the project lock; stale proposalId answers 400) or `{ origin: 'typed', name, crossingConsequence }` (written in the writer's own words). Omit when B stories are disabled.","properties":{"mode":{"type":"string","enum":["declined","selected"]},"items":{"type":"array","items":{"type":"object","properties":{"origin":{"type":"string","enum":["adopted","typed"]},"proposalId":{"type":"string"},"name":{"type":"string"},"crossingConsequence":{"type":"string"}},"required":["origin"]}}},"required":["mode"]}},"required":["selectedIndex"]}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/projects/{projectId}/wizard/treatment/finalize":{"post":{"tags":["Wizard"],"summary":"Finalize the treatment (locks it, advances to spine extraction)","parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/projects/{projectId}/wizard/spine-extract":{"post":{"tags":["Wizard"],"summary":"Dispatch spine extraction job","responses":{"202":{"description":"Job dispatched","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}/wizard/complete":{"post":{"tags":["Wizard"],"summary":"Mark wizard as complete","parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/projects/{projectId}/wizard/story-map":{"get":{"tags":["Wizard"],"summary":"Read the story map: sequences with their scenes, beat markers, missing beats and ideas","parameters":[{"name":"framework","in":"query","required":false,"schema":{"type":"string"},"description":"Preview a candidate framework (registry id) — read-only; nothing is written"},{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"{ model, committedFrameworkId, committedMissing, mapCreatedAt } — mapCreatedAt names the map every map write must send","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"404":{"description":"The project has no spine / bound framework yet","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/projects/{projectId}/find-replace":{"post":{"tags":["Scenes"],"summary":"Replace All across the scenes the caller searched (GH #801) — refused WHOLE when any named scene moved; every changed scene lands as ONE undo group","description":"The caller names, for every scene it searched, the content version AND the content signature of the version it holds (server-issued: GET /screenplay scenes[].contentHash, the scene read/save contentSignature). The server re-reads every head before planning and fences each write on the planned head. Undo/redo: POST /undo/step { scope: 'group', groupId: operationId }, or a scene-scope step in any of its scenes. Honours X-Idempotency-Key (cache-5xx).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"operationId":{"type":"string","format":"uuid","description":"Minted once per Replace All; also its undo group id"},"query":{"type":"string","minLength":1,"maxLength":1000},"replacement":{"type":"string","maxLength":1000},"options":{"type":"object","properties":{"matchCase":{"type":"boolean","default":false},"wholeWord":{"type":"boolean","default":false},"scope":{"type":"string","enum":["all","sceneHeading","action","character","parenthetical","dialogue","transition"],"default":"all"}}},"scenes":{"type":"array","minItems":1,"maxItems":2000,"description":"One entry per scene searched; sceneId must be unique across entries","items":{"type":"object","properties":{"sceneId":{"type":"string","minLength":1},"expectedContentVersion":{"type":"integer","minimum":0},"expectedContentSignature":{"type":"string","minLength":1,"maxLength":200}},"required":["sceneId","expectedContentVersion","expectedContentSignature"]}}},"required":["operationId","query","replacement","scenes"]}}}},"responses":{"200":{"description":"Replaced ({ ok: true, groupId, replaced, scenes }) or nothing matched ({ ok: false, reason: 'nothing-to-replace' })","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"groupId":{"type":"string"},"replaced":{"type":"integer","minimum":1},"scenes":{"type":"array","items":{"type":"object","properties":{"sceneId":{"type":"string"},"replaced":{"type":"integer"}},"required":["sceneId","replaced"]}}},"required":["ok","groupId","replaced","scenes"]},{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"reason":{"type":"string","enum":["nothing-to-replace"]}},"required":["ok","reason"]}]}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"VALIDATION_INVALID_INPUT — bad operationId, query, replacement, options (a non-boolean toggle, an unknown scope) or scenes (missing identity, duplicate sceneId) SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"409":{"description":"Stale (nothing written) or partial (a race after the precheck; what landed is one undo group)","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"reason":{"type":"string","enum":["stale"]},"staleSceneIds":{"type":"array","items":{"type":"string"}}},"required":["ok","reason","staleSceneIds"]},{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"reason":{"type":"string","enum":["partial"]},"groupId":{"type":"string"},"written":{"type":"array","items":{"type":"object","properties":{"sceneId":{"type":"string"},"replaced":{"type":"integer"}},"required":["sceneId","replaced"]}},"conflictSceneId":{"type":"string"},"conflict":{"type":"string","enum":["changed","deleted"]}},"required":["ok","reason","groupId","written","conflictSceneId","conflict"]}]}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}/wizard/story-on-file":{"get":{"tags":["Wizard"],"summary":"Read the story-on-file ledger: every artifact and decision, by phase, with what each finished phase offers","responses":{"200":{"description":"{ rail }","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"404":{"description":"The project has no wizard","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}/wizard/story-map/offers/{offerId}":{"post":{"tags":["Wizard"],"summary":"Answer one of Nisaba's ideas on the story map: { verdict: 'yes' | 'later' | 'no' | 'open', sceneId?, mapCreatedAt } (record only; yes without sceneId claims, yes + sceneId attaches, open releases)","responses":{"200":{"description":"{ ok: true, offer }","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Bad verdict, sceneId on a non-yes, or no mapCreatedAt SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"404":{"description":"Unknown idea","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"409":{"description":"No story map or a closed one (STATE_INVALID_TRANSITION), an earlier map (STATE_STALE_CONTENT), an idea another card took (STATE_ALREADY_COMPLETED)","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}/wizard/story-map/handoff":{"post":{"tags":["Wizard"],"summary":"Leave the story map and start writing: { mapCreatedAt } (stamps the handoff; idempotent)","responses":{"200":{"description":"{ ok: true, handedOffAt }","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"No mapCreatedAt SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"409":{"description":"An earlier map (STATE_STALE_CONTENT); no story map, or the wizard is not at COMPLETE (STATE_INVALID_TRANSITION)","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}/analysis/reread":{"get":{"tags":["Analysis"],"summary":"Read how current the Notes reading is, or (?quote=1) price a re-read","parameters":[{"name":"quote","in":"query","required":false,"schema":{"type":"string","enum":["1"]},"description":"Price a press instead: { sceneCount, onDemand, quotedCredits, percentOfPlan, basis } — optional legacy basis on POST"},{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"{ totalScenes, changedSceneIds, lastReadAt, lastFullReadAt?, modelChanged, promptChanged?, runId, inFlightJobIds, readAgainAt, clearedNotes? } — lastFullReadAt is when the last press finished (nullable ISO; absent on older builds); clearedNotes counts notes removed from the Doctor list after its incident fold, proved by the latest complete current whole-draft read; readAgainAt is the nullable ISO quiet-window deadline; runId is the running press (its root job id: GET /api/jobs/{runId}?operation=1 answers for the whole press), inFlightJobIds every job it created; or the quote with ?quote=1","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"503":{"description":"The press state could not be read (Retry-After) — never answered as \"no press\"","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}},"post":{"tags":["Analysis"],"summary":"Re-read the draft's changed scenes, or every scene when all are current: { scope: 'notes', basis? } (optional legacy basis from GET ?quote=1; honours X-Idempotency-Key)","responses":{"200":{"description":"{ requestId, jobIds, attached: true } — a press already runs; this one attaches to it","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"202":{"description":"{ requestId, jobIds, onDemand, waitingSceneIds } — each scene admitted before its job","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Body is not { scope: 'notes', basis?: string } SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"402":{"description":"Usage refusal; error.details { requestId, jobIds } names the scenes admitted before usage ran out (they run)","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"409":{"description":"STATE_STALE_CONTENT: details.reason basis_changed (the draft moved since an optional legacy quote) or too_long (the draft cannot fit one pass)","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"429":{"description":"A press finished inside the quiet window; nothing was read (Retry-After)","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"503":{"description":"The press state could not be read or its root job not written — nothing started; or a scene dispatch threw, and error.details { requestId, jobIds } names what was created (they run)","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}/characters":{"get":{"tags":["Characters"],"summary":"List all characters in the project","parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}},"post":{"tags":["Characters"],"summary":"Create a new character","parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/projects/{projectId}/scenes":{"get":{"tags":["Scenes"],"summary":"List all scenes in the project","parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}},"post":{"tags":["Scenes"],"summary":"Create one undoable scene, optionally at a story gap","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["heading"],"properties":{"heading":{"type":"object","required":["intExt","location"],"properties":{"intExt":{"type":"string","enum":["INT.","EXT.","INT./EXT."]},"location":{"type":"string","minLength":1},"timeOfDay":{"type":"string"}}},"content":{"type":"string"},"synopsis":{"type":"string"},"notes":{"type":"string"},"synopsisEdited":{"type":"boolean","description":"true when the writer typed `synopsis` (it is stamped as their own words and held against Nabu's summaries); false for text copied in (a starter, an offered idea). Omitted: not stamped."},"characters":{"type":"array","items":{"type":"string"}},"cardColor":{"type":["string","null"]},"skeletonOrigin":{"type":"string","enum":["board","freewrite"]},"zoneId":{"type":"string","description":"A project zone; cannot be combined with a scene anchor."},"afterSceneId":{"type":"string","minLength":1,"description":"Place after this scene; mutually exclusive with beforeSceneId and zoneId."},"beforeSceneId":{"type":"string","minLength":1,"description":"Place before this scene; mutually exclusive with afterSceneId and zoneId."},"sequenceId":{"type":"string","minLength":1,"description":"Join at the requested gap; alone, follows the last placed member. Unknown sequences and split runs are refused."},"storyMapCreatedAt":{"type":"string","minLength":1,"description":"Identity of the open wizard map hosting this card."},"storyMapOffer":{"type":"object","required":["id"],"description":"Persisted idea identity and displayed zone intent. Requires storyMapCreatedAt; mutually exclusive with zoneId, sequenceId and both scene anchors. Server resolves the current act and anchor under the map lock. Retry only the identical body/key.","properties":{"id":{"type":"string","minLength":1},"expectedZoneId":{"type":"string","minLength":1,"nullable":true}}}}}}}},"responses":{"201":{"description":"The created scene record, with the committed placement (when one was asked for) and the undo action that takes the create back.","content":{"application/json":{"schema":{"type":"object","required":["id","heading"],"additionalProperties":true,"properties":{"id":{"type":"string"},"heading":{"type":"object","properties":{"intExt":{"type":"string"},"location":{"type":"string"},"timeOfDay":{"type":"string"}}},"status":{"type":"string"},"synopsis":{"type":"string"},"placement":{"type":"object","required":["disposition"],"additionalProperties":{"type":"string"},"description":"What the placement actually committed, never the request; present only when a placement was asked for. Besides `disposition`: `zoneId`, the zone the scene sits in after the call (when known), and `sequenceId`, the sequence it joined (when one was named and the join committed).","properties":{"disposition":{"type":"string","enum":["placed","already-placed","yielded","deferred","unverified"]}}},"undoActionId":{"type":"string","description":"The enrolled create; pass as expectedActionId to undo exactly it."}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid placement request; error.details.code can be anchor_not_found, anchor_unzoned, sequence_not_found or sequence_linearity. Admission creates nothing. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/jobs":{"get":{"tags":["Jobs"],"summary":"List jobs (requires project access)","description":"Returns { jobs, workspaceId }, using the persisted project workspace. With agent=suggest-the-move and X-Idempotency-Key, reads the exact authenticated actor request across active and terminal statuses. A positive PG row with an unconfirmed current job answers 503, never an empty list. An empty list, even after a recorded failure, does not prove that an earlier job insert cannot commit; retain the original request until an authoritative job or affirmative no-effect answer resolves it.","parameters":[{"name":"projectId","in":"query","required":true,"schema":{"type":"string"},"description":"Project ID — required for authorization scoping"},{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}},"post":{"tags":["Jobs"],"summary":"Create background agent job (requires editor role)","description":"A public dispatch never chooses the model: a job-level model, or a payload model coordinate (modelTierOverride, tier, modelId, modelProviderType), is refused 400 VALIDATION_INVALID_INPUT naming the field, with jobAdmission: refused — except a nisaba-turn payload.modelTierOverride that is one of default, heavy, fast, chat. Known pre-effect refusals include jobAdmission: refused. A later record-read refusal alone does not prove the earlier mutation had no effect. Suggest-the-move stamps the validated idempotency key as trusted job attribution; never infer refusal from the HTTP status family. A proved pre-job/no-admission or confirmed-release failure uses the existing same-key retryable marker; unknown admission or release stays guarded. scene-auditor (GH #6090) reads ONE scene (payload.sceneId required, else 400; a batch or window is refused by the generic deny) and is a requested read through the one scene-read dispatcher, priced at the scene's own words: 201 { job } when a read starts; 200 { job, joined: true } when a job reading the same scene at the same text is pending or running; 409 STATE_ALREADY_IN_PROGRESS with Retry-After and jobAdmission: refused when another dispatch holds the scene and no matching read is proven (nothing admitted; the same idempotency key re-runs); 200 { alreadyRead: true } when the scene's current text was already read (nothing admitted, nothing charged); 404 for a scene that does not exist; the usage refusal. Other payload fields (mode, force, background, any request id) do not change it.","parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/jobs/{jobId}":{"get":{"tags":["Jobs"],"summary":"Get job status (project-scoped auth)","description":"When no job row exists, falls back to an OPERATION lookup by the same id (base-layer Slice P1). An op-backed response carries `recordType:\"operation\"` and a synthesized job-shaped `job` object so a client holding an operation id (e.g. across a deploy boundary) resolves instead of being reaped by the 404→remove reconciler.","parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}},"patch":{"tags":["Jobs"],"summary":"Cancel job (requires editor role)","parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/jobs/{jobId}/stream":{"get":{"tags":["Jobs"],"summary":"Stream job progress via SSE (project-scoped auth)","parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/operations/{operationId}":{"get":{"tags":["Operations"],"summary":"Read a billable operation by id (project/workspace-scoped auth)","description":"First-class operation read. Returns the raw operation fields plus a `recordType:\"operation\"` job-shaped projection (the same shape `GET /api/jobs/{id}` synthesizes on op-fallback). `operation.quotedPercentOfPlan` (billing lane B4) is the quote as a share of the payer workspace's plan — what a writer-facing reader prints instead of `quotedCredits`; `null` when unresolved. 403→404 masked.","parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/operations/{operationId}/stream":{"get":{"tags":["Operations"],"summary":"Stream OPERATION-level lifecycle via SSE (project/workspace-scoped auth)","description":"Base-layer Slice P7. Operation-keyed sibling of `GET /api/jobs/{jobId}/stream`: resolves the operation's CURRENT attempt, delegates execution frames (same field names/semantics as the jobs stream), and surfaces attempt transitions as frames (`attemptTransition: { fromAttemptNo, toAttemptNo }`). Closes terminal ⟺ `billable_operations.status` is terminal — an attempt's terminal job status while retries remain NEVER closes the stream. Frames add `operation: { id, kind, status }` and `attempt: { attemptNo, progressFloor, ... }`. Accepts execution ids (job/run id) and resolves to the canonical operation. 403→404 masked.","responses":{"200":{"description":"text/event-stream of operation frames","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"404":{"description":"Operation not found or caller lacks access (masked)","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/operations/{operationId}/cancel":{"post":{"tags":["Operations"],"summary":"Request operation cancellation (requires editor role)","description":"Accepts the canonical operation ID or the root job ID of exactly one live operation of an operation-authority kind (exact operation ID wins; run and turn IDs are not resolved; none or several live operations answer 404); the response carries the canonical operation ID, and idempotency stays bound to the requested URL. CASes `billable_operations.status → \"cancel_requested\"` from an active status. Idempotent via `X-Idempotency-Key`. Returns 409 `STATE_OPERATION_KIND_NOT_CANCELLABLE` (fail-loud, never a silent no-op) when the operation kind is not on operation authority. Retired kinds are always cancellable here; flipped kinds are while the operator has them enabled; kinds still on legacy authority never are.","responses":{"200":{"description":"Cancel requested, or already terminal (benign no-op)","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"404":{"description":"Operation not found or caller lacks access (masked)","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"409":{"description":"Operation kind not cancellable via the operation API — it is not on operation authority (`STATE_OPERATION_KIND_NOT_CANCELLABLE`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}/export/fountain":{"post":{"tags":["Export"],"summary":"Export screenplay as Fountain text","responses":{"200":{"description":"Fountain document","content":{"text/plain":{"schema":{"type":"string"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}/export/fdx":{"post":{"tags":["Export"],"summary":"Export screenplay as Final Draft XML","responses":{"200":{"description":"FDX document","content":{"application/xml":{"schema":{"type":"string"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/import":{"post":{"tags":["Projects"],"summary":"Upload a screenplay for asynchronous import","description":"Requires write scope and workspace membership. JSON server-file paths are disabled in production unless explicitly enabled; use multipart upload.","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"},"workspaceId":{"type":"string","description":"Defaults to the active workspace."},"author":{"type":"string"}}}}}},"responses":{"202":{"description":"Import queued; follow the job stream.","content":{"application/json":{"schema":{"type":"object","required":["jobId","projectId","status"],"properties":{"jobId":{"type":"string"},"projectId":{"type":"string"},"status":{"type":"string"}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/sample-project":{"post":{"tags":["Projects"],"summary":"Open the account's sample project (staged)","description":"GH #6092. Restores the release's sample .nabu as a new project through the legacy-import job: no model call, no credits. One per account: every press (any tab, any device, any idempotency key) rejoins the same project and job; a sample already restored answers status `completed`. Staged: 404 unless SAMPLE_PROJECT_ENABLED=1, the account is on SAMPLE_PROJECT_USER_ALLOWLIST, or it is a platform admin. Optional JSON body (GH #6303): the Write from Scratch dialog's `{ title?, genre?, format? }`, validated as POST /api/projects validates them. An account whose sample came back whole gets 409 with `error.details.reason` `sample-already-loaded` and nothing is bound; a running restore is joined; a failed or spent attempt loads the sample again. The fields wait on the claim for POST /api/projects/{projectId}/clear-sample, which makes the blank project with all three and then drops them; the sample keeps its own title. X-Idempotency-Key is optional (the server mints one per press); a request is bound to its pair with its recorded answer, so a same-key retry replays that pair. `status` is the restore job status, `completed` for a sample restored whole, `failed` or `cancelled` otherwise; 503 when the restore state cannot be read.","responses":{"202":{"description":"Restore queued or rejoined; follow the job stream.","content":{"application/json":{"schema":{"type":"object","required":["jobId","projectId","status"],"properties":{"jobId":{"type":"string"},"projectId":{"type":"string"},"status":{"type":"string"}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"A dialog field the blank create would refuse (title over the limit, a malformed genre or format). SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"404":{"description":"The sample project is not open to this account.","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"409":{"description":"Write from Scratch on an account whose sample came back whole (`error.details.reason` `sample-already-loaded`): nothing bound; make the blank project instead.","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"501":{"description":"A short where the Short switch is off (FEATURE_NOT_IMPLEMENTED, as POST /api/projects).","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":["string","null"]},"genre":{"type":["string","null"]},"format":{"type":"string","enum":["feature","short"]}}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}/clear-sample":{"post":{"tags":["Projects"],"summary":"Clear and start writing: open the writer's blank project (nothing is deleted)","description":"GH #6303. Owner only, and only on the sample project. Opens a blank project made the way Write from Scratch makes one, with the title, genre and format the Write from Scratch dialog gave when it loaded the sample (else the blank create's defaults), never the sample's. Nothing is deleted: the sample stays whole, still the sample, under its own title. One live blank project per sample under any keys and presses: a later press opens the same one; a blank project the owner deleted is replaced, never answered. No body. X-Idempotency-Key is optional (the server mints one); a same-key retry replays the answer, and runs again after a refusal that changed nothing (503). Free.","parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}},{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"The blank project to open.","content":{"application/json":{"schema":{"type":"object","required":["projectId"],"properties":{"projectId":{"type":"string"}}}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"A malformed X-Idempotency-Key. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"403":{"description":"Not the project owner, or the Free project limit (a billing gate code with `error.details.gate`).","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"404":{"description":"No such project (and no live blank project made from it).","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"409":{"description":"`STATE_ALREADY_IN_PROGRESS` (header `X-Idempotency-Record: in-progress`): the same request is still running, ask again with the same key. `STATE_PREREQUISITE_NOT_MET`: the project is not the sample; do not retry.","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"422":{"description":"The idempotency key was used for another request.","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"501":{"description":"The dialog asked for a short and the Short switch is now off (FEATURE_NOT_IMPLEMENTED).","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"503":{"description":"A fact the server could not read; nothing changed. Retry with the same key.","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/projects/{projectId}/export/pdf":{"post":{"tags":["Export"],"summary":"Export screenplay as PDF","description":"Optional `application/json` object with two optional booleans (GH #802). An omitted option takes its default: `sceneNumbers` is true only when the project's scene numbers are locked (fixed numbering or an active page lock), `titlePage` is true. Unknown keys are ignored. An empty, non-JSON or non-object body means no options. Only a known option with a non-boolean value is refused (400).","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","description":"Unknown keys are ignored.","properties":{"sceneNumbers":{"type":"boolean","description":"Print margin scene numbers (both margins)."},"titlePage":{"type":"boolean","description":"Print the title page."}}}}}},"responses":{"200":{"description":"The PDF (`application/pdf` attachment) — the whole script (GH #4958)","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"A known option with a non-boolean value SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Error"},{"$ref":"#/components/schemas/Error"}]}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"500":{"description":"The PDF could not be built (the renderer failed) — no file is sent (GH #4958; it used to send the page HTML)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"503":{"description":"The PDF renderer is busy (`Retry-After` seconds)","headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}},"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/projects/{projectId}/export/print":{"post":{"tags":["Export"],"summary":"The PDF export's own pages as HTML, for a browser print dialog","description":"GH #2047. Answers the exact HTML `export/pdf` rasterizes (one composer, engine-broken pages; the document's `@page` rule carries the PDF's page size and margins), served inline for printing — no Content-Disposition, `Cache-Control: no-store`. Same request body, defaults and 400 as `export/pdf`: an optional `application/json` object with two optional booleans. An omitted option takes its default: `sceneNumbers` is true only when the project's scene numbers are locked (fixed numbering or an active page lock), `titlePage` is true. Unknown keys are ignored. An empty, non-JSON or non-object body means no options. Only a known option with a non-boolean value is refused (400). Requires viewer access.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","description":"Unknown keys are ignored.","properties":{"sceneNumbers":{"type":"boolean","description":"Print margin scene numbers (both margins)."},"titlePage":{"type":"boolean","description":"Print the title page."}}}}}},"responses":{"200":{"description":"The print document (inline `text/html; charset=utf-8`) — the whole script, as the PDF prints it (GH #4958)","content":{"text/html":{"schema":{"type":"string"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"A known option with a non-boolean value SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Error"},{"$ref":"#/components/schemas/Error"}]}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"403":{"description":"No viewer access to the project","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"404":{"description":"Project not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/music/search":{"post":{"tags":["Music"],"summary":"Search iTunes tracks for an editor music cue","description":"Authenticated UI helper. Search results may include a transient previewUrl, but cached search hits return identity only.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string","maxLength":200}},"required":["query"]}}}},"responses":{"200":{"description":"Search results","content":{"application/json":{"schema":{"type":"object","properties":{"tracks":{"type":"array","items":{"$ref":"#/components/schemas/MusicTrackIdentity"}}},"required":["tracks"]}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"429":{"description":"Music resolver rate limit exceeded","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/music/lookup":{"post":{"tags":["Music"],"summary":"Resolve a fresh iTunes preview URL for a stored music cue","description":"Authenticated UI helper. Lookup is not cached so preview/store URLs remain transient runtime data.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"externalId":{"type":"string"}},"required":["externalId"]}}}},"responses":{"200":{"description":"Fresh preview/store URL, or track:null when unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicLookupResponse"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"429":{"description":"Music resolver rate limit exceeded","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}},"/api/health":{"get":{"tags":["System"],"summary":"Liveness probe","security":[],"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{}}},"/api/ready":{"get":{"tags":["System"],"summary":"Readiness probe","security":[],"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/openapi.json":{"get":{"tags":["System"],"summary":"OpenAPI 3.1 specification","security":[],"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}],"responses":{"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}}}}},"/api/projects/{projectId}/capabilities":{"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}}],"get":{"tags":["Discovery"],"summary":"Inspect project actions without dispatching or reserving credits","description":"Fresh project visibility and editor/write checks, canonical wizard state and bounded artifact prerequisites. Available is a partial inspection, not admission. Check availability, reason/remedy and admission.uncheckedRequirements; nullable state/artifact fields must not be interpreted as BONES or absence.","responses":{"200":{"description":"Inspected available actions, blocked/unknown actions and nullable state/artifact evidence.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectCapabilities"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"400":{"description":"Invalid request. SYSTEM_CLIENT_VERSION_UNSUPPORTED requires a supported dated client; no operation admitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"401":{"description":"Not authenticated","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"403":{"description":"Project viewer/read access denied","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"404":{"description":"Project not visible or not found","headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"500":{"description":"Unexpected authority failure, returned in the shared typed error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}}},"503":{"description":"Temporary storage or authority unavailability; inspect the error envelope and Retry-After.","headers":{"Retry-After":{"description":"Minimum delay in seconds before retrying discovery.","schema":{"type":"integer","minimum":1}},"Nabu-Version":{"description":"Effective dated contract for this response.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"Nabu-Version","in":"header","required":false,"description":"Dated client contract. Missing: stored key pin (legacy NULL = first contract), otherwise oldest supported. Newer clients are served as current. Native EventSource uses nabu_version; the real header wins. Native sendBeacon cannot set headers and uses the oldest contract. GET /api/health remains readable for asset-build recovery.","schema":{"type":"string","format":"date"}}]}}},"tags":[{"name":"Authentication","description":"API key management"},{"name":"Account","description":"The signed-in person's profile picture"},{"name":"Projects","description":"Screenplay project CRUD"},{"name":"Chat","description":"Conversation with Nisaba (the primary agent endpoint)"},{"name":"Wizard","description":"Screenplay wizard pipeline stages"},{"name":"Characters","description":"Character management"},{"name":"Scenes","description":"Scene management"},{"name":"Jobs","description":"Background job monitoring"},{"name":"Export","description":"Screenplay export (PDF, Fountain)"},{"name":"Music","description":"Editor music cue search and runtime lookup"},{"name":"Discovery","description":"API discovery and capability introspection"},{"name":"System","description":"Health checks and system info"}]}