Skip to content

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
Terminal
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

  • slugRequiredstring
  • nameRequiredstring
  • descriptionOptionalstring or null
  • definitionOptionalobject
    An initial draft, for example from a template or the authoring model.
  • sourceOptionalstring
    The initial draft as YAML or JSON source, instead of definition: TypeFuse parses it, keeps it exactly as written, and refuses it with the exact path of any problem.
  • sourceFormatOptionalstring
    One of yaml, json

Answer (200)

  • idstring
  • slugstring
  • addressstring
    organisation/decision: the Decision's identifier.
  • namestring
  • descriptionstring or null
  • categorystring or null
    Cached output from the platform's deployed Decision categoriser.
  • categorySourcestring or null
    Which classifier set the category, and its version.
  • draftobject
    The authored Definition: format: 3, model, state_schema, optional context and questions.
  • draftHashstring
  • draftSourcestring
    YAML authored by the user, preserved exactly.
  • draftSourceFormatstring
    One of yaml, json
  • readmeMarkdownstring
    Markdown documentation edited with the draft and frozen on publish.
  • readmeHashstring
  • createdAtstring
  • updatedAtstring
  • archivedAtstring or null
    When it was archived; null while in use.
  • archivedByinteger or null
    Who archived it; null while in use.
  • agentsobject
    What it tells agents, and whether it's offered to them.
  • agents.offeredboolean
    Agents the organisation allows can find it and call it wherever it's deployed.
  • agents.whenToUsestring or null
  • agents.whenNotToUsestring or null
  • agents.exampleIntentsarray of string
Terminal
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

  • orgRequiredstring
  • slugRequiredstring

Answer (200)

  • idstring
  • slugstring
  • addressstring
    organisation/decision: the Decision's identifier.
  • namestring
  • descriptionstring or null
  • categorystring or null
    Cached output from the platform's deployed Decision categoriser.
  • categorySourcestring or null
    Which classifier set the category, and its version.
  • draftobject
    The authored Definition: format: 3, model, state_schema, optional context and questions.
  • draftHashstring
  • draftSourcestring
    YAML authored by the user, preserved exactly.
  • draftSourceFormatstring
    One of yaml, json
  • readmeMarkdownstring
    Markdown documentation edited with the draft and frozen on publish.
  • readmeHashstring
  • createdAtstring
  • updatedAtstring
  • archivedAtstring or null
    When it was archived; null while in use.
  • archivedByinteger or null
    Who archived it; null while in use.
  • agentsobject
    What it tells agents, and whether it's offered to them.
  • agents.offeredboolean
    Agents the organisation allows can find it and call it wherever it's deployed.
  • agents.whenToUsestring or null
  • agents.whenNotToUsestring or null
  • agents.exampleIntentsarray of string
Terminal
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

  • orgRequiredstring
  • slugRequiredstring

Body

  • nameRequiredstring
  • descriptionRequiredstring or null

Answer (200)

  • idstring
  • slugstring
  • addressstring
    organisation/decision: the Decision's identifier.
  • namestring
  • descriptionstring or null
  • categorystring or null
    Cached output from the platform's deployed Decision categoriser.
  • categorySourcestring or null
    Which classifier set the category, and its version.
  • draftobject
    The authored Definition: format: 3, model, state_schema, optional context and questions.
  • draftHashstring
  • draftSourcestring
    YAML authored by the user, preserved exactly.
  • draftSourceFormatstring
    One of yaml, json
  • readmeMarkdownstring
    Markdown documentation edited with the draft and frozen on publish.
  • readmeHashstring
  • createdAtstring
  • updatedAtstring
  • archivedAtstring or null
    When it was archived; null while in use.
  • archivedByinteger or null
    Who archived it; null while in use.
  • agentsobject
    What it tells agents, and whether it's offered to them.
  • agents.offeredboolean
    Agents the organisation allows can find it and call it wherever it's deployed.
  • agents.whenToUsestring or null
  • agents.whenNotToUsestring or null
  • agents.exampleIntentsarray of string
Terminal
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

  • orgRequiredstring
  • slugRequiredstring

Body

  • toRequiredstring
    The organisation to move to; the caller must be an owner or admin of both.
  • dryRunOptionalboolean
    Report what would move, and what stops it, without changing anything.

Answer (200)

It answers with no body.

Terminal
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

  • orgRequiredstring
  • slugRequiredstring

Answer (200)

  • forwardsarray
Terminal
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

  • orgRequiredstring
  • slugRequiredstring
  • fromRequiredstring

Answer (200)

  • forwardsarray
Terminal
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

  • orgRequiredstring
  • slugRequiredstring

Answer (200)

  • idstring
  • slugstring
  • addressstring
    organisation/decision: the Decision's identifier.
  • namestring
  • descriptionstring or null
  • categorystring or null
    Cached output from the platform's deployed Decision categoriser.
  • categorySourcestring or null
    Which classifier set the category, and its version.
  • draftobject
    The authored Definition: format: 3, model, state_schema, optional context and questions.
  • draftHashstring
  • draftSourcestring
    YAML authored by the user, preserved exactly.
  • draftSourceFormatstring
    One of yaml, json
  • readmeMarkdownstring
    Markdown documentation edited with the draft and frozen on publish.
  • readmeHashstring
  • createdAtstring
  • updatedAtstring
  • archivedAtstring or null
    When it was archived; null while in use.
  • archivedByinteger or null
    Who archived it; null while in use.
  • agentsobject
    What it tells agents, and whether it's offered to them.
  • agents.offeredboolean
    Agents the organisation allows can find it and call it wherever it's deployed.
  • agents.whenToUsestring or null
  • agents.whenNotToUsestring or null
  • agents.exampleIntentsarray of string
Terminal
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

  • orgRequiredstring
  • slugRequiredstring

Answer (200)

  • idstring
  • slugstring
  • addressstring
    organisation/decision: the Decision's identifier.
  • namestring
  • descriptionstring or null
  • categorystring or null
    Cached output from the platform's deployed Decision categoriser.
  • categorySourcestring or null
    Which classifier set the category, and its version.
  • draftobject
    The authored Definition: format: 3, model, state_schema, optional context and questions.
  • draftHashstring
  • draftSourcestring
    YAML authored by the user, preserved exactly.
  • draftSourceFormatstring
    One of yaml, json
  • readmeMarkdownstring
    Markdown documentation edited with the draft and frozen on publish.
  • readmeHashstring
  • createdAtstring
  • updatedAtstring
  • archivedAtstring or null
    When it was archived; null while in use.
  • archivedByinteger or null
    Who archived it; null while in use.
  • agentsobject
    What it tells agents, and whether it's offered to them.
  • agents.offeredboolean
    Agents the organisation allows can find it and call it wherever it's deployed.
  • agents.whenToUsestring or null
  • agents.whenNotToUsestring or null
  • agents.exampleIntentsarray of string
Terminal
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

  • orgRequiredstring
  • slugRequiredstring

Body

  • markdownRequiredstring

Answer (200)

  • idstring
  • slugstring
  • addressstring
    organisation/decision: the Decision's identifier.
  • namestring
  • descriptionstring or null
  • categorystring or null
    Cached output from the platform's deployed Decision categoriser.
  • categorySourcestring or null
    Which classifier set the category, and its version.
  • draftobject
    The authored Definition: format: 3, model, state_schema, optional context and questions.
  • draftHashstring
  • draftSourcestring
    YAML authored by the user, preserved exactly.
  • draftSourceFormatstring
    One of yaml, json
  • readmeMarkdownstring
    Markdown documentation edited with the draft and frozen on publish.
  • readmeHashstring
  • createdAtstring
  • updatedAtstring
  • archivedAtstring or null
    When it was archived; null while in use.
  • archivedByinteger or null
    Who archived it; null while in use.
  • agentsobject
    What it tells agents, and whether it's offered to them.
  • agents.offeredboolean
    Agents the organisation allows can find it and call it wherever it's deployed.
  • agents.whenToUsestring or null
  • agents.whenNotToUsestring or null
  • agents.exampleIntentsarray of string
Terminal
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

  • orgRequiredstring
  • slugRequiredstring

Body

  • definitionOptionalobject
    The parsed draft. Leave it out to have TypeFuse parse source.
  • sourceRequiredstring
    YAML authored by the user, preserved exactly.
  • sourceFormatRequiredstring
    One of yaml, json

Answer (200)

  • idstring
  • slugstring
  • addressstring
    organisation/decision: the Decision's identifier.
  • namestring
  • descriptionstring or null
  • categorystring or null
    Cached output from the platform's deployed Decision categoriser.
  • categorySourcestring or null
    Which classifier set the category, and its version.
  • draftobject
    The authored Definition: format: 3, model, state_schema, optional context and questions.
  • draftHashstring
  • draftSourcestring
    YAML authored by the user, preserved exactly.
  • draftSourceFormatstring
    One of yaml, json
  • readmeMarkdownstring
    Markdown documentation edited with the draft and frozen on publish.
  • readmeHashstring
  • createdAtstring
  • updatedAtstring
  • archivedAtstring or null
    When it was archived; null while in use.
  • archivedByinteger or null
    Who archived it; null while in use.
  • agentsobject
    What it tells agents, and whether it's offered to them.
  • agents.offeredboolean
    Agents the organisation allows can find it and call it wherever it's deployed.
  • agents.whenToUsestring or null
  • agents.whenNotToUsestring or null
  • agents.exampleIntentsarray of string
Terminal
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

  • orgRequiredstring
  • slugRequiredstring

Answer (200)

  • okboolean
  • planobject
    The compiled ExecutionPlan. Its shape is owned by
  • errorsarray of { "path": string, "message": string }
  • estimateobject
    Present whenever the draft parses, compiled or not.
  • estimate.fixedTokensinteger
    Overhead, context and ordinary questions: paid on every call.
  • estimate.eacharray of { "question": string, "each": string, "maxItems": integer, "tokensPerItem": integer }
  • estimate.questionTokensAtMaxinteger
  • estimate.inputTokensAtMaxinteger
    Caller input at its limits, estimated from state_schema (maxLength where declared).
  • estimate.requestTokensAtMaxinteger
  • advicearray
Terminal
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

  • orgRequiredstring
  • slugRequiredstring

Headers

  • X-TypeSafe-KeyOptionalstring

Body

  • inputRequiredstring or object or array
    Dynamic TypeSafe state: a string, object, or array, checked by state_schema.

Answer (200)

  • idstring
  • versionIdstring or null
    Null when the run executed the draft; see draftHash.
  • draftHashstring or null
  • rolestring or null
    For served runs, which part of the deployment this was; null otherwise.One of primary, variant, compatible, shadow
  • environmentstring
  • sourcestring
  • actorTypestring
  • actorIdstring
  • startedAtstring
  • latencyMsinteger
  • inputstring or object or array
    Dynamic TypeSafe state: a string, object, or array, checked by state_schema.
  • answersobject or null
    Native TypeSafe answers, keyed by question id; a list in item order for an each question.
  • inputTokensinteger or null
    Input tokens, as the provider reported them.
  • outputTokensinteger or null
  • itemCountinteger or null
    Items judged by per-item (each) questions; null for a Decision without them.
  • statusstring
  • errorstring or null
  • applicationIdstring or null
    The calling software (its key's Application); null for sandbox and test runs.
  • referenceobject or null
    What the call was about, in the caller's terms.
  • reference.typestring
  • reference.idstring
  • correlationIdstring or null
    The thread of calls it belongs to.
  • sealIdstring or null
    The seal that fixed its content in the audit chain; null until the next seal.
  • responseOriginstring or null
    Where the provider's response came from: provider when TypeFuse received it from TypeSafe itself (Managed, BYOK), caller when 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 of provider, caller
  • planHashstring
  • completedAtstring
  • stateobject
    The state exactly as sent to the provider.
  • providerstring
  • providerModelstring or null
  • providerRequestIdstring or null
  • usageobject or null
  • usage.inputTokensinteger
  • usage.outputTokensinteger
  • proofobject
    On a single run: its content hashes and seal.
  • proof.planHashstring
  • proof.inputHashstring or null
  • proof.stateHashstring or null
  • proof.answersHashstring or null
  • proof.sealobject or null
  • versionNumberinteger or null
    On a single run: the number of the version it ran (versionId's), null for a draft run.
  • servedByobject or null
    On 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.deploymentIdstring
  • servedBy.liveAtstring
    When the deployment went live.
  • servedBy.requestedByobject or null
    The person or deploy token that asked for it; null when neither is known any more.
  • servedBy.approvedBystring or null
  • servedBy.approvedAtstring or null
  • servedBy.selfApprovedboolean
    The person who approved it also asked for it (the only owner or admin).
  • notStoredstring
    Present 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; input is then empty and state is {}.
Terminal
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

  • orgRequiredstring
  • slugRequiredstring

Body

  • sourceOptionalstring
  • sourceFormatOptionalstring
    One of yaml, json
  • triageOptionalboolean
    Also run the assistant review's judgment checks: one model call, whose answer is kept for each question.

Answer (200)

  • draftHashstring
  • savedboolean
    False when unsaved source was reviewed.
  • okboolean
    False when the source does not parse; errors says why.
  • errorsarray of { "path": string, "message": string }
  • estimateobject or null
    The estimated tokens and cost of one call, with every list at its limit.
  • estimate.fixedTokensinteger
    Overhead, context and ordinary questions: paid on every call.
  • estimate.eacharray of { "question": string, "each": string, "maxItems": integer, "tokensPerItem": integer }
  • estimate.questionTokensAtMaxinteger
  • estimate.inputTokensAtMaxinteger
    Caller input at its limits, estimated from state_schema (maxLength where declared).
  • estimate.requestTokensAtMaxinteger
  • findingsarray
    Worst first.
  • triageobject or null
    The judgment checks when triage was asked for; null otherwise.
  • triage.statusstring
    not_permitted: viewers and read-only tokens get the rule checks only; nothing was asked.One of ok, unavailable, failed, rate_limited, not_permitted
  • triage.messagestring or null
  • triage.retryAfterSecondsinteger or null
  • triage.reviewerobject or null
  • triage.findingsarray
    Worst first.
  • triage.worthALookarray
  • triage.passedinteger
  • triage.totalQuestionsinteger
  • triage.reviewedQuestionsinteger
  • triage.cachedQuestionsinteger
  • triage.askedQuestionsinteger
  • triage.usageobject
  • usageobject
  • usage.modelCallsinteger
    0 for the rule checks; at most 1 with triage.
  • usage.authoringCallsinteger
Terminal
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

  • orgRequiredstring
  • slugRequiredstring

Body

  • fixIdRequiredstring
  • draftHashOptionalstring or null
    The draft the fix was offered for; 409 DRAFT_MOVED when it changed since.

Answer (200)

  • draftHashstring
  • previousDraftHashstring
  • draftSourcestring or null
  • draftSourceFormatstring or null
    One of yaml, json
  • appliedobject
  • applied.fixIdstring
  • applied.codestring
  • applied.titlestring
  • applied.labelstring
  • applied.releaseTypestring
    One of initial, major, minor, patch, none
  • applied.nextReleaseobject or null
  • reviewobject
    The draft reviewed again after the fix.
  • review.draftHashstring
  • review.savedboolean
    False when unsaved source was reviewed.
  • review.okboolean
    False when the source does not parse; errors says why.
  • review.errorsarray of { "path": string, "message": string }
  • review.estimateobject or null
    The estimated tokens and cost of one call, with every list at its limit.
  • review.findingsarray
    Worst first.
  • review.triageobject or null
    The judgment checks when triage was asked for; null otherwise.
  • review.usageobject
Terminal
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

  • orgRequiredstring
  • slugRequiredstring

Body

  • findingIdRequiredstring
    <check>:<path>, as a review returned it.
  • reasonRequiredstring
    not_a_problem: the check was wrong (how the checks are improved); not_now: set aside.One of not_a_problem, not_now
  • probabilityOptionalnumber or null
    The judgment check's probability as shown; ignored for a rule check.
  • reviewerOptionalstring or null
    Which review check made the finding, with its version, for a judgment check.
  • subjectHashOptionalstring or null
    findingSubjectHash of the source the person saw; the saved draft's when absent.

Answer (200)

  • dismissedstring
  • reasonstring
    One of not_a_problem, not_now
  • hiddenobject or null
    The hidden finding, for not_a_problem; null for not_now.
  • hidden.findingIdstring
    <check>:<path>.
  • hidden.codestring
  • hidden.pathstring
  • hidden.subjectHashstring
    findingSubjectHash (
  • hidden.dismissedAtinteger
    Unix seconds.
Terminal
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

  • orgRequiredstring
  • slugRequiredstring

Body

  • findingIdRequiredstring
  • draftHashOptionalstring or null
    The 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 null
    Pass it to /draft/review/suggestions/{id}/accept; null when there is no rewrite.
  • findingIdstring
  • codestring
  • pathstring
  • titlestring
  • outcomestring
    One of suggested, no_rewrite
  • messagestring or null
  • howToFixstring
  • explanationstring or null
  • operationsarray of { "op": string, "path": string, "value": any JSON value, "to": string }
  • sourceAfterstring or null
  • preservedFormattingboolean
  • diffobject or null
  • diff.linesarray of { "kind": string, "text": string }
  • diff.addedinteger
  • diff.removedinteger
  • unifiedDiffstring or null
  • effectobject or null
    What a fix would do: whether it compiles, its release and the cost of one call.
  • effect.compilesboolean
  • effect.errorsarray of { "path": string, "message": string }
  • effect.changeobject
    This change alone.
  • effect.nextReleaseobject or null
    The draft's next release with this change, against the latest published version.
  • effect.estimateobject
  • verificationobject or null
  • verification.statusstring
    One of verified, not_verified, unavailable
  • verification.codestring
  • verification.beforenumber
  • verification.afternumber or null
    The same check re-asked on the rewrite; null when the question was removed.
  • verification.thresholdnumber
  • verification.removedboolean
  • verification.questionIdsarray of string
  • verification.newFindingsarray of { "id": string, "code": string, "path": string, "title": string, "probability": number }
  • verification.messagestring or null
  • canAcceptboolean
  • attemptsLeftinteger
    Rewrites left for this finding on this draft (2 in all; 422 SUGGESTION_LIMIT after).
  • provenanceobject
  • provenance.reviewerstring
  • provenance.modelstring
  • usageobject
  • usage.authoringCallsinteger
  • usage.authoringInputTokensinteger
  • usage.authoringOutputTokensinteger
  • usage.modelCallsinteger
Terminal
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

  • orgRequiredstring
  • slugRequiredstring
  • suggestionIdRequiredstring

Body

  • draftHashOptionalstring or null

Answer (200)

  • draftHashstring
  • previousDraftHashstring
  • draftSourcestring or null
  • draftSourceFormatstring or null
    One of yaml, json
  • appliedobject
  • applied.fixIdstring
  • applied.codestring
  • applied.titlestring
  • applied.labelstring
  • applied.releaseTypestring
    One of initial, major, minor, patch, none
  • applied.nextReleaseobject or null
  • reviewobject
    The draft reviewed again after the fix.
  • review.draftHashstring
  • review.savedboolean
    False when unsaved source was reviewed.
  • review.okboolean
    False when the source does not parse; errors says why.
  • review.errorsarray of { "path": string, "message": string }
  • review.estimateobject or null
    The estimated tokens and cost of one call, with every list at its limit.
  • review.findingsarray
    Worst first.
  • review.triageobject or null
    The judgment checks when triage was asked for; null otherwise.
  • review.usageobject
Terminal
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

  • orgRequiredstring
  • slugRequiredstring

Body

  • goalRequiredstring
    What the author is trying to do, in their words.
  • draftHashOptionalstring or null
    409 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)

  • idstring
  • goalstring
  • draftHashstring
  • intentstring
    One of add_judgment, change_behaviour, reduce_cost, explain_behaviour, restructure, not_a_definition_change
  • answerstring
  • readsarray 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 null
  • cappedboolean
  • attemptsLeftinteger
  • modelstring
  • usageobject
  • usage.authoringCallsinteger
  • usage.authoringInputTokensinteger
  • usage.authoringOutputTokensinteger
  • usage.modelCallsinteger
Terminal
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

  • orgRequiredstring
  • slugRequiredstring
  • proposalIdRequiredstring

Answer (200)

  • toolstring
  • okboolean
  • resultany JSON value
  • messagestring or null
Terminal
curl -X POST "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/draft/assist/proposals/<proposalId>/accept" \
  -H "Authorization: Bearer $TYPEFUSE_TOKEN"