Skip to main content
POST
Preview. This endpoint is available to organisations in the Wordsmith MCP pilot. Other organisations receive 403 mcp_not_enabled. See the preview overview.
Drafts a new DOCX or PDF file. What it does depends on what you send: A blueprint is a document with placeholders, such as your standard NDA. Find one with List Blueprints and read its placeholders with Get Blueprint. The blueprint must be published. Give context in any mix of four forms:
  • instructions: what to draft, or how to fill the blueprint.
  • context: free text, such as a deal summary or an email from the business.
  • file_ids: source documents, such as a term sheet or the heads of terms.
  • session_id: a past Wordsmith conversation about the deal.
Each draft runs in a new Wordsmith conversation, so you can open it in the app and keep working on it. Drafting can take a minute or more, so the call returns an operation. Its resource is that conversation, { "type": "session" }. Its id is null until the draft has started. A draft cancelled before it starts opens no conversation. A blueprint filled from your own values usually comes back succeeded within a wait of a few seconds. See Long-running operations for how to wait for the rest. On success, result holds:
  • file_id: the new document, in your own files. Read it with Get File Download.
  • values: for a blueprint, every placeholder value used, keyed by placeholder key. A value nothing was found for is null and left blank. To correct one, send the edited values back with the same blueprint_id and no context; no AI runs the second time. null for a draft without a blueprint.
  • url: opens the conversation in Wordsmith, where the user can keep working on the draft.
The operation fails with error.code:
  • missing_values: a required placeholder still has no value. The message names it; send it in values.
  • no_document: the agent answered without drafting a document. Try clearer instructions.
  • draft_failed: anything else went wrong, or the draft stopped without finishing. Retrying is safe.
  • An API error code, such as resource_not_found: the blueprint, a file or the session became unreadable while the draft ran. The message says what; retrying the same request will not help.

Authentication

Requires an API key, or an OAuth token with files:write and files:read: you need files:read to poll the operation and download the draft. Add blueprints:read to pass blueprint_id and sessions:read to pass session_id.

Headers

string
A unique key for this request. A retry with the same key and body within 30 days returns the same operation instead of drafting twice. See Retrying safely.

Body parameters

string
What to draft, up to 10,000 characters. For example: “A two-page side letter extending the exclusivity period to 31 March.” Required without blueprint_id. With a blueprint, it steers how AI drafts the empty placeholders.
string
The blueprint to draft from.
object
Blueprint placeholder values you already know, keyed by placeholder key. AI never overrides them. Each value must fit its placeholder’s type: a string (or number) for text, one of the options for choice, a list of options for multi_choice, true or false for boolean, and rows of strings for table. Only with blueprint_id.
string
Free-text context, up to 20,000 characters.
string[]
Up to 10 source documents, as file_ids from the files API. A file_id comes from Complete Upload or Import File, not from Upload URL, which returns a job_id.
string
A past conversation to use as context, from List Sessions.
string
default:"docx"
docx or pdf.
string
The name of the new file, without an extension, up to 255 characters. Defaults to the blueprint’s or the draft’s name, plus the date.
integer
default:"0"
Seconds to wait for the operation to finish before responding, from 0 to 20.
string
An HTTPS URL that receives a signed POST with the operation when it finishes. API keys only. See Callbacks.

Response

Returns 202 with the operation, of type draft. A repeat with the same Idempotency-Key returns 200 with the same operation.

Errors