Reference
API: Decisions and drafts
Create Decisions, write and check their drafts, and work with the Definition assistant.
Part of the API reference: requests carry a personal access token as Authorization: Bearer <token>, and bodies and answers are JSON.
Decisions
GET /v1/organisations/{org}/decisions
List Decisions
The Decisions in use; with archived=true, the archived ones instead.
Path
orgRequiredstring
Query
archivedOptionalboolean
Answer (200)
decisionsarray
curl "https://api.typefuse.dev/v1/organisations/acme/decisions" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN"POST /v1/organisations/{org}/decisions
Create a Decision
Path
orgRequiredstring
Body
slugRequiredstringnameRequiredstringdescriptionOptionalstring or nulldefinitionOptionalobjectAn initial draft, for example from a template or the authoring model.sourceOptionalstringThe initial draft as YAML or JSON source, instead ofdefinition: TypeFuse parses it, keeps it exactly as written, and refuses it with the exact path of any problem.sourceFormatOptionalstringOne ofyaml,json
Answer (200)
idstringslugstringaddressstringorganisation/decision: the Decision's identifier.namestringdescriptionstring or nullcategorystring or nullCached output from the platform's deployed Decision categoriser.categorySourcestring or nullWhich classifier set the category, and its version.draftobjectThe authored Definition:format: 3,model,state_schema, optionalcontextandquestions.draftHashstringdraftSourcestringYAML authored by the user, preserved exactly.draftSourceFormatstringOne ofyaml,jsonreadmeMarkdownstringMarkdown documentation edited with the draft and frozen on publish.readmeHashstringcreatedAtstringupdatedAtstringarchivedAtstring or nullWhen it was archived; null while in use.archivedByinteger or nullWho archived it; null while in use.agentsobjectWhat it tells agents, and whether it's offered to them.agents.offeredbooleanAgents the organisation allows can find it and call it wherever it's deployed.agents.whenToUsestring or nullagents.whenNotToUsestring or nullagents.exampleIntentsarray of string
curl -X POST "https://api.typefuse.dev/v1/organisations/acme/decisions" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"slug":"refunds","name":"Refunds"}'GET /v1/organisations/{org}/decisions/{slug}
Get a Decision
Path
orgRequiredstringslugRequiredstring
Answer (200)
idstringslugstringaddressstringorganisation/decision: the Decision's identifier.namestringdescriptionstring or nullcategorystring or nullCached output from the platform's deployed Decision categoriser.categorySourcestring or nullWhich classifier set the category, and its version.draftobjectThe authored Definition:format: 3,model,state_schema, optionalcontextandquestions.draftHashstringdraftSourcestringYAML authored by the user, preserved exactly.draftSourceFormatstringOne ofyaml,jsonreadmeMarkdownstringMarkdown documentation edited with the draft and frozen on publish.readmeHashstringcreatedAtstringupdatedAtstringarchivedAtstring or nullWhen it was archived; null while in use.archivedByinteger or nullWho archived it; null while in use.agentsobjectWhat it tells agents, and whether it's offered to them.agents.offeredbooleanAgents the organisation allows can find it and call it wherever it's deployed.agents.whenToUsestring or nullagents.whenNotToUsestring or nullagents.exampleIntentsarray of string
curl "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN"PATCH /v1/organisations/{org}/decisions/{slug}
Update a Decision
Rename: name and description only; the slug is part of the identifier and stays.
Path
orgRequiredstringslugRequiredstring
Body
nameRequiredstringdescriptionRequiredstring or null
Answer (200)
idstringslugstringaddressstringorganisation/decision: the Decision's identifier.namestringdescriptionstring or nullcategorystring or nullCached output from the platform's deployed Decision categoriser.categorySourcestring or nullWhich classifier set the category, and its version.draftobjectThe authored Definition:format: 3,model,state_schema, optionalcontextandquestions.draftHashstringdraftSourcestringYAML authored by the user, preserved exactly.draftSourceFormatstringOne ofyaml,jsonreadmeMarkdownstringMarkdown documentation edited with the draft and frozen on publish.readmeHashstringcreatedAtstringupdatedAtstringarchivedAtstring or nullWhen it was archived; null while in use.archivedByinteger or nullWho archived it; null while in use.agentsobjectWhat it tells agents, and whether it's offered to them.agents.offeredbooleanAgents the organisation allows can find it and call it wherever it's deployed.agents.whenToUsestring or nullagents.whenNotToUsestring or nullagents.exampleIntentsarray of string
curl -X PATCH "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"Refunds","description":"<description>"}'POST /v1/organisations/{org}/decisions/{slug}/move
Move a Decision to another organisation
Moves the Decision to another organisation. Owners and admins of both. dryRun reports without changing anything; 409 MOVE_BLOCKED carries the report and its blockers; 503 RUNTIME_SYNC_FAILED means the database moved and repeating the call finishes it.
Path
orgRequiredstringslugRequiredstring
Body
toRequiredstringThe organisation to move to; the caller must be an owner or admin of both.dryRunOptionalbooleanReport what would move, and what stops it, without changing anything.
Answer (200)
It answers with no body.
curl -X POST "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/move" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"to":"<to>"}'GET /v1/organisations/{org}/decisions/{slug}/forwards
List a Decision's old identifiers
The Decision's old identifiers, which forward to it permanently.
Path
orgRequiredstringslugRequiredstring
Answer (200)
forwardsarray
curl "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/forwards" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN"POST /v1/organisations/{org}/decisions/{slug}/forwards/{from}/stop-old-keys
Stop the old organisation's keys
Stops accepting the old organisation's API keys at one old identifier. The identifier keeps forwarding for this organisation's keys and its name stays reserved. Owners and admins.
Path
orgRequiredstringslugRequiredstringfromRequiredstring
Answer (200)
forwardsarray
curl -X POST "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/forwards/<from>/stop-old-keys" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN"POST /v1/organisations/{org}/decisions/{slug}/archive
Archive a Decision
Archive: out of every environment it can leave at once, off the lists and the plan's count, read-only; its history stays. Owners and admins. 409 when it serves production, when taking it out needs an approval, or while a request waits.
Path
orgRequiredstringslugRequiredstring
Answer (200)
idstringslugstringaddressstringorganisation/decision: the Decision's identifier.namestringdescriptionstring or nullcategorystring or nullCached output from the platform's deployed Decision categoriser.categorySourcestring or nullWhich classifier set the category, and its version.draftobjectThe authored Definition:format: 3,model,state_schema, optionalcontextandquestions.draftHashstringdraftSourcestringYAML authored by the user, preserved exactly.draftSourceFormatstringOne ofyaml,jsonreadmeMarkdownstringMarkdown documentation edited with the draft and frozen on publish.readmeHashstringcreatedAtstringupdatedAtstringarchivedAtstring or nullWhen it was archived; null while in use.archivedByinteger or nullWho archived it; null while in use.agentsobjectWhat it tells agents, and whether it's offered to them.agents.offeredbooleanAgents the organisation allows can find it and call it wherever it's deployed.agents.whenToUsestring or nullagents.whenNotToUsestring or nullagents.exampleIntentsarray of string
curl -X POST "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/archive" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN"POST /v1/organisations/{org}/decisions/{slug}/restore
Restore an archived Decision
Restore an archived Decision, if the plan has room for it (402 PLAN_LIMIT otherwise).
Path
orgRequiredstringslugRequiredstring
Answer (200)
idstringslugstringaddressstringorganisation/decision: the Decision's identifier.namestringdescriptionstring or nullcategorystring or nullCached output from the platform's deployed Decision categoriser.categorySourcestring or nullWhich classifier set the category, and its version.draftobjectThe authored Definition:format: 3,model,state_schema, optionalcontextandquestions.draftHashstringdraftSourcestringYAML authored by the user, preserved exactly.draftSourceFormatstringOne ofyaml,jsonreadmeMarkdownstringMarkdown documentation edited with the draft and frozen on publish.readmeHashstringcreatedAtstringupdatedAtstringarchivedAtstring or nullWhen it was archived; null while in use.archivedByinteger or nullWho archived it; null while in use.agentsobjectWhat it tells agents, and whether it's offered to them.agents.offeredbooleanAgents the organisation allows can find it and call it wherever it's deployed.agents.whenToUsestring or nullagents.whenNotToUsestring or nullagents.exampleIntentsarray of string
curl -X POST "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/restore" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN"PUT /v1/organisations/{org}/decisions/{slug}/readme
Update the readme
Replaces the draft README Markdown; publishing freezes it into the version.
Path
orgRequiredstringslugRequiredstring
Body
markdownRequiredstring
Answer (200)
idstringslugstringaddressstringorganisation/decision: the Decision's identifier.namestringdescriptionstring or nullcategorystring or nullCached output from the platform's deployed Decision categoriser.categorySourcestring or nullWhich classifier set the category, and its version.draftobjectThe authored Definition:format: 3,model,state_schema, optionalcontextandquestions.draftHashstringdraftSourcestringYAML authored by the user, preserved exactly.draftSourceFormatstringOne ofyaml,jsonreadmeMarkdownstringMarkdown documentation edited with the draft and frozen on publish.readmeHashstringcreatedAtstringupdatedAtstringarchivedAtstring or nullWhen it was archived; null while in use.archivedByinteger or nullWho archived it; null while in use.agentsobjectWhat it tells agents, and whether it's offered to them.agents.offeredbooleanAgents the organisation allows can find it and call it wherever it's deployed.agents.whenToUsestring or nullagents.whenNotToUsestring or nullagents.exampleIntentsarray of string
curl -X PUT "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/readme" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"markdown":"<markdown>"}'Drafts
PUT /v1/organisations/{org}/decisions/{slug}/draft
Save the draft
Path
orgRequiredstringslugRequiredstring
Body
definitionOptionalobjectThe parsed draft. Leave it out to have TypeFuse parsesource.sourceRequiredstringYAML authored by the user, preserved exactly.sourceFormatRequiredstringOne ofyaml,json
Answer (200)
idstringslugstringaddressstringorganisation/decision: the Decision's identifier.namestringdescriptionstring or nullcategorystring or nullCached output from the platform's deployed Decision categoriser.categorySourcestring or nullWhich classifier set the category, and its version.draftobjectThe authored Definition:format: 3,model,state_schema, optionalcontextandquestions.draftHashstringdraftSourcestringYAML authored by the user, preserved exactly.draftSourceFormatstringOne ofyaml,jsonreadmeMarkdownstringMarkdown documentation edited with the draft and frozen on publish.readmeHashstringcreatedAtstringupdatedAtstringarchivedAtstring or nullWhen it was archived; null while in use.archivedByinteger or nullWho archived it; null while in use.agentsobjectWhat it tells agents, and whether it's offered to them.agents.offeredbooleanAgents the organisation allows can find it and call it wherever it's deployed.agents.whenToUsestring or nullagents.whenNotToUsestring or nullagents.exampleIntentsarray of string
curl -X PUT "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/draft" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"source":"<source>","sourceFormat":"yaml"}'POST /v1/organisations/{org}/decisions/{slug}/compile
Compile the draft
Path
orgRequiredstringslugRequiredstring
Answer (200)
okbooleanplanobjectThe compiled ExecutionPlan. Its shape is owned byerrorsarray of { "path": string, "message": string }estimateobjectPresent whenever the draft parses, compiled or not.estimate.fixedTokensintegerOverhead, context and ordinary questions: paid on every call.estimate.eacharray of { "question": string, "each": string, "maxItems": integer, "tokensPerItem": integer }estimate.questionTokensAtMaxintegerestimate.inputTokensAtMaxintegerCaller input at its limits, estimated from state_schema (maxLength where declared).estimate.requestTokensAtMaxintegeradvicearray
curl -X POST "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/compile" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN"POST /v1/organisations/{org}/decisions/{slug}/draft/run
Run the draft in the Sandbox
Sandbox: runs the draft as it is now, without publishing. With X-TypeSafe-Key it runs on your own TypeSafe key, for this request only and never stored.
Path
orgRequiredstringslugRequiredstring
Headers
X-TypeSafe-KeyOptionalstring
Body
inputRequiredstring or object or arrayDynamic TypeSafe state: a string, object, or array, checked by state_schema.
Answer (200)
idstringversionIdstring or nullNull when the run executed the draft; see draftHash.draftHashstring or nullrolestring or nullFor served runs, which part of the deployment this was; null otherwise.One ofprimary,variant,compatible,shadowenvironmentstringsourcestringactorTypestringactorIdstringstartedAtstringlatencyMsintegerinputstring or object or arrayDynamic TypeSafe state: a string, object, or array, checked by state_schema.answersobject or nullNative TypeSafe answers, keyed by question id; a list in item order for aneachquestion.inputTokensinteger or nullInput tokens, as the provider reported them.outputTokensinteger or nullitemCountinteger or nullItems judged by per-item (each) questions; null for a Decision without them.statusstringerrorstring or nullapplicationIdstring or nullThe calling software (its key's Application); null for sandbox and test runs.referenceobject or nullWhat the call was about, in the caller's terms.reference.typestringreference.idstringcorrelationIdstring or nullThe thread of calls it belongs to.sealIdstring or nullThe seal that fixed its content in the audit chain; null until the next seal.responseOriginstring or nullWhere the provider's response came from:providerwhen TypeFuse received it from TypeSafe itself (Managed, BYOK),callerwhen the caller reported it (Relay, and the removed record-only mode). Null for runs from before it was recorded. Included in the run's seal.One ofprovider,callerplanHashstringcompletedAtstringstateobjectThe state exactly as sent to the provider.providerstringproviderModelstring or nullproviderRequestIdstring or nullusageobject or nullusage.inputTokensintegerusage.outputTokensintegerproofobjectOn a single run: its content hashes and seal.proof.planHashstringproof.inputHashstring or nullproof.stateHashstring or nullproof.answersHashstring or nullproof.sealobject or nullversionNumberinteger or nullOn a single run: the number of the version it ran (versionId's), null for a draft run.servedByobject or nullOn a single served call: the deployment that answered it, who asked for it and who approved it. Null for Sandbox, Test set and Evaluation runs.servedBy.deploymentIdstringservedBy.liveAtstringWhen the deployment went live.servedBy.requestedByobject or nullThe person or deploy token that asked for it; null when neither is known any more.servedBy.approvedBystring or nullservedBy.approvedAtstring or nullservedBy.selfApprovedbooleanThe person who approved it also asked for it (the only owner or admin).notStoredstringPresent when the run's stored input and the state sent to the model have expired under the plan's retention (or the Sandbox's): the sentence that says so. The run keeps its answers, hashes and seal;inputis then empty andstateis{}.
curl -X POST "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/draft/run" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"input":"<input>"}'Draft review
POST /v1/organisations/{org}/decisions/{slug}/draft/review
Review the draft
The Definition assistant's Review: deterministic checks over the draft (or source not yet saved), each finding with a mechanical fix where there is one. It writes nothing, so a Read token may call it.
Path
orgRequiredstringslugRequiredstring
Body
sourceOptionalstringsourceFormatOptionalstringOne ofyaml,jsontriageOptionalbooleanAlso run the assistant review's judgment checks: one model call, whose answer is kept for each question.
Answer (200)
draftHashstringsavedbooleanFalse when unsaved source was reviewed.okbooleanFalse when the source does not parse;errorssays why.errorsarray of { "path": string, "message": string }estimateobject or nullThe estimated tokens and cost of one call, with every list at its limit.estimate.fixedTokensintegerOverhead, context and ordinary questions: paid on every call.estimate.eacharray of { "question": string, "each": string, "maxItems": integer, "tokensPerItem": integer }estimate.questionTokensAtMaxintegerestimate.inputTokensAtMaxintegerCaller input at its limits, estimated from state_schema (maxLength where declared).estimate.requestTokensAtMaxintegerfindingsarrayWorst first.triageobject or nullThe judgment checks whentriagewas asked for; null otherwise.triage.statusstringnot_permitted: viewers and read-only tokens get the rule checks only; nothing was asked.One ofok,unavailable,failed,rate_limited,not_permittedtriage.messagestring or nulltriage.retryAfterSecondsinteger or nulltriage.reviewerobject or nulltriage.findingsarrayWorst first.triage.worthALookarraytriage.passedintegertriage.totalQuestionsintegertriage.reviewedQuestionsintegertriage.cachedQuestionsintegertriage.askedQuestionsintegertriage.usageobjectusageobjectusage.modelCallsinteger0 for the rule checks; at most 1 with triage.usage.authoringCallsinteger
curl -X POST "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/draft/review" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'POST /v1/organisations/{org}/decisions/{slug}/draft/review/apply
Apply a review fix
Applies one fix to the saved draft as a single edit. Never publishes. 409 DRAFT_MOVED, 422 FIX_UNAVAILABLE.
Path
orgRequiredstringslugRequiredstring
Body
fixIdRequiredstringdraftHashOptionalstring or nullThe draft the fix was offered for; 409 DRAFT_MOVED when it changed since.
Answer (200)
draftHashstringpreviousDraftHashstringdraftSourcestring or nulldraftSourceFormatstring or nullOne ofyaml,jsonappliedobjectapplied.fixIdstringapplied.codestringapplied.titlestringapplied.labelstringapplied.releaseTypestringOne ofinitial,major,minor,patch,noneapplied.nextReleaseobject or nullreviewobjectThe draft reviewed again after the fix.review.draftHashstringreview.savedbooleanFalse when unsaved source was reviewed.review.okbooleanFalse when the source does not parse;errorssays why.review.errorsarray of { "path": string, "message": string }review.estimateobject or nullThe estimated tokens and cost of one call, with every list at its limit.review.findingsarrayWorst first.review.triageobject or nullThe judgment checks whentriagewas asked for; null otherwise.review.usageobject
curl -X POST "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/draft/review/apply" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"fixId":"<fixId>"}'POST /v1/organisations/{org}/decisions/{slug}/draft/review/dismiss
Dismiss a finding
"Not a problem" / "Not now" on a Review finding (rule or judgment check), by its finding id. Records the dismissal on the audit trail (codes and paths only); the draft is unchanged. "Not a problem" also hides the finding on this Decision until the part of the Definition it is about changes (subjectHash, or the saved draft's). 422 FINDING_UNAVAILABLE for an id no check has.
Path
orgRequiredstringslugRequiredstring
Body
findingIdRequiredstring<check>:<path>, as a review returned it.reasonRequiredstringnot_a_problem: the check was wrong (how the checks are improved); not_now: set aside.One ofnot_a_problem,not_nowprobabilityOptionalnumber or nullThe judgment check's probability as shown; ignored for a rule check.reviewerOptionalstring or nullWhich review check made the finding, with its version, for a judgment check.subjectHashOptionalstring or nullfindingSubjectHash of the source the person saw; the saved draft's when absent.
Answer (200)
dismissedstringreasonstringOne ofnot_a_problem,not_nowhiddenobject or nullThe hidden finding, for not_a_problem; null for not_now.hidden.findingIdstring<check>:<path>.hidden.codestringhidden.pathstringhidden.subjectHashstringfindingSubjectHash (hidden.dismissedAtintegerUnix seconds.
curl -X POST "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/draft/review/dismiss" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"findingId":"<findingId>","reason":"not_a_problem"}'POST /v1/organisations/{org}/decisions/{slug}/draft/review/suggest
Suggest a fix for a finding
Suggests a fix for one finding of the assistant review: a patch scoped to the finding's paths, checked by the compiler, with the same review question asked again of the rewrite. 402 FAIR_USE_REACHED, 409 DRAFT_MOVED, 422 FINDING_UNAVAILABLE, 503 REVIEW_UNAVAILABLE when the assistant review can't run.
Path
orgRequiredstringslugRequiredstring
Body
findingIdRequiredstringdraftHashOptionalstring or nullThe draft the finding was found on; 409 DRAFT_MOVED when it changed since.retryOfOptionalstring or null"Try again": a Not verified suggestion for this finding, whose verification is fed back.
Answer (200)
idstring or nullPass it to /draft/review/suggestions/{id}/accept; null when there is no rewrite.findingIdstringcodestringpathstringtitlestringoutcomestringOne ofsuggested,no_rewritemessagestring or nullhowToFixstringexplanationstring or nulloperationsarray of { "op": string, "path": string, "value": any JSON value, "to": string }sourceAfterstring or nullpreservedFormattingbooleandiffobject or nulldiff.linesarray of { "kind": string, "text": string }diff.addedintegerdiff.removedintegerunifiedDiffstring or nulleffectobject or nullWhat a fix would do: whether it compiles, its release and the cost of one call.effect.compilesbooleaneffect.errorsarray of { "path": string, "message": string }effect.changeobjectThis change alone.effect.nextReleaseobject or nullThe draft's next release with this change, against the latest published version.effect.estimateobjectverificationobject or nullverification.statusstringOne ofverified,not_verified,unavailableverification.codestringverification.beforenumberverification.afternumber or nullThe same check re-asked on the rewrite; null when the question was removed.verification.thresholdnumberverification.removedbooleanverification.questionIdsarray of stringverification.newFindingsarray of { "id": string, "code": string, "path": string, "title": string, "probability": number }verification.messagestring or nullcanAcceptbooleanattemptsLeftintegerRewrites left for this finding on this draft (2 in all; 422 SUGGESTION_LIMIT after).provenanceobjectprovenance.reviewerstringprovenance.modelstringusageobjectusage.authoringCallsintegerusage.authoringInputTokensintegerusage.authoringOutputTokensintegerusage.modelCallsinteger
curl -X POST "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/draft/review/suggest" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"findingId":"<findingId>"}'POST /v1/organisations/{org}/decisions/{slug}/draft/review/suggestions/{suggestionId}/accept
Accept a suggested fix
Accepts a verified suggestion into the saved draft as one edit. Never publishes. 409 DRAFT_MOVED, 422 SUGGESTION_UNAVAILABLE.
Path
orgRequiredstringslugRequiredstringsuggestionIdRequiredstring
Body
draftHashOptionalstring or null
Answer (200)
draftHashstringpreviousDraftHashstringdraftSourcestring or nulldraftSourceFormatstring or nullOne ofyaml,jsonappliedobjectapplied.fixIdstringapplied.codestringapplied.titlestringapplied.labelstringapplied.releaseTypestringOne ofinitial,major,minor,patch,noneapplied.nextReleaseobject or nullreviewobjectThe draft reviewed again after the fix.review.draftHashstringreview.savedbooleanFalse when unsaved source was reviewed.review.okbooleanFalse when the source does not parse;errorssays why.review.errorsarray of { "path": string, "message": string }review.estimateobject or nullThe estimated tokens and cost of one call, with every list at its limit.review.findingsarrayWorst first.review.triageobject or nullThe judgment checks whentriagewas asked for; null otherwise.review.usageobject
curl -X POST "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/draft/review/suggestions/<suggestionId>/accept" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'The Definition assistant
POST /v1/organisations/{org}/decisions/{slug}/draft/assist
Ask the Definition assistant
"I'm trying to…": the Definition assistant reads this Decision through the same read tools an agent has (never the inputs of recorded runs) and answers with at most one proposal. 402 FAIR_USE_REACHED, 409 DRAFT_MOVED, 422 SUGGESTION_LIMIT.
Path
orgRequiredstringslugRequiredstring
Body
goalRequiredstringWhat the author is trying to do, in their words.draftHashOptionalstring or null409 DRAFT_MOVED when the saved draft changed since.retryOfOptionalstring or null"Try another": the id of the earlier answer to the same goal (2 asks per goal per draft).
Answer (200)
idstringgoalstringdraftHashstringintentstringOne ofadd_judgment,change_behaviour,reduce_cost,explain_behaviour,restructure,not_a_definition_changeanswerstringreadsarray of { "tool": string, "ok": boolean, "summary": string }proposal{ "kind": string, "id": string, "tool": string, "arguments": object, "why": string, "effect": { "summary": string, "detail": any JSON value }, "canAccept": boolean, "blockedReason": string or null } or null or { "kind": string, "brief": string, "suggestion": { "id": string or null, "findingId": string, "code": string, "path": string, "title": string, "outcome": string, "message": string or null, "howToFix": string, "explanation": string or null, "operations": array of any JSON value, "sourceAfter": string or null, "preservedFormatting": boolean, "diff": { "lines": any JSON value, "added": any JSON value, "removed": any JSON value } or null, "unifiedDiff": string or null, "effect": { "compiles": any JSON value, "errors": any JSON value, "change": any JSON value, "nextRelease": any JSON value, "estimate": any JSON value } or null, "verification": { "status": any JSON value, "code": any JSON value, "before": any JSON value, "after": any JSON value, "threshold": any JSON value, "removed": any JSON value, "questionIds": any JSON value, "newFindings": any JSON value, "message": any JSON value } or null, "canAccept": boolean, "attemptsLeft": integer, "provenance": { "reviewer": any JSON value, "model": any JSON value }, "usage": { "authoringCalls": any JSON value, "authoringInputTokens": any JSON value, "authoringOutputTokens": any JSON value, "modelCalls": any JSON value } } } or nullcappedbooleanattemptsLeftintegermodelstringusageobjectusage.authoringCallsintegerusage.authoringInputTokensintegerusage.authoringOutputTokensintegerusage.modelCallsinteger
curl -X POST "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/draft/assist" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"goal":"<goal>"}'POST /v1/organisations/{org}/decisions/{slug}/draft/assist/proposals/{proposalId}/accept
Accept a proposed action
Runs an action proposal as the person accepting it. 409 PROPOSAL_UNAVAILABLE or 422 PROPOSAL_REFUSED.
Path
orgRequiredstringslugRequiredstringproposalIdRequiredstring
Answer (200)
toolstringokbooleanresultany JSON valuemessagestring or null
curl -X POST "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/draft/assist/proposals/<proposalId>/accept" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN"