Reference
API: Runs and audit
Recorded calls, the Change history and exports of both.
Part of the API reference: requests carry a personal access token as Authorization: Bearer <token>, and bodies and answers are JSON.
Runs
GET /v1/organisations/{org}/decisions/{slug}/runs
List runs
target narrows to draft runs or runs of published versions; environment narrows further.
Path
orgRequiredstringslugRequiredstring
Query
targetOptionalstringOne ofdraft,version,allenvironmentOptionalstringreferenceOptionalstringlimitOptionalintegeroffsetOptionalinteger
Answer (200)
runsarrayOne page, newest first.?environment=takes "all", "production", "draft" (the Sandbox, where draft runs are filed) or a comma-separated list.totalintegerEvery run the filter matches, across all pages.byEnvironmentarray of { "environment": string, "runs": integer, "failed": integer }
curl "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/runs" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN"GET /v1/organisations/{org}/decisions/{slug}/runs/{runId}
Get a run
Path
orgRequiredstringslugRequiredstringrunIdRequiredstring
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 "https://api.typefuse.dev/v1/organisations/acme/decisions/refunds/runs/<runId>" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN"Audit and exports
GET /v1/organisations/{org}/audit
Read the audit trail
The audit trail, newest first. Filters: type, subjectType, subjectId, actor (user id), decision (slug), before (event id), limit.
Path
orgRequiredstring
Query
typeOptionalstringsubjectTypeOptionalstringsubjectIdOptionalstringactorOptionalintegerdecisionOptionalstringbeforeOptionalstringlimitOptionalinteger
Answer (200)
eventsarraynextBeforestring or nullPass asbeforefor the next page; null at the end.typesarray of stringEvent types seen in this organisation.
curl "https://api.typefuse.dev/v1/organisations/acme/audit" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN"GET /v1/organisations/{org}/exports
List exports
The organisation's exports, newest first; with decision (a slug), only those narrowed to that Decision. Owners, admins and viewers.
Path
orgRequiredstring
Query
decisionOptionalstring
Answer (200)
exportsarrayNewest first, the latest fifty.
curl "https://api.typefuse.dev/v1/organisations/acme/exports" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN"POST /v1/organisations/{org}/exports
Start an export
Exports from Audit. Owners, admins and viewers. A small export is built while the request waits (201, status ready, with a downloadUrl); a larger one is queued (202) and the person is notified when it is ready. 413 EXPORT_TOO_LARGE past 50,000 rows (5,000 with inputs and outputs). Each is recorded as an ExportCreated audit event.
Path
orgRequiredstring
Body
kindRequiredstringOne ofcalls,changes,evidenceformatRequiredstringcsv or json for calls and changes; zip for an evidence pack.One ofcsv,json,zipfromOptionalstring or integerISO 8601 or unix milliseconds, inclusive.toOptionalstring or integerISO 8601 or unix milliseconds, exclusive.decisionOptionalstringA Decision's slug; required for an evidence pack.environmentsOptionalarray of stringEnvironment slugs; "sandbox" (or "draft") for Sandbox runs.includePayloadsOptionalbooleanCalls and evidence packs: include each call's input and the state sent to the model, where still stored.
Answer (201)
idstringkindstringOne ofcalls,changes,evidenceformatstringOne ofcsv,json,zipstatusstringqueued and running while it is built; ready to download; failed; expired once its file is deleted.One ofqueued,running,ready,failed,expiredwhatstringWhat it holds, in words.filtersobjectWhat an export was narrowed to.filters.fromstring or nullISO 8601, inclusive; null for no start.filters.tostring or nullISO 8601, exclusive; null for no end.filters.decisionstring or nullA Decision's slug.filters.environmentsarray of string or nullEnvironment slugs ("sandbox" for the Sandbox); null for every environment.filters.includePayloadsbooleanCalls only: each call's input and the state sent to the model, where still stored.rowsinteger or nullCalls or changes in the file; for an evidence pack, the calls in its period.sizeBytesinteger or nullfilenamestring or nullerrorstring or nullbackgroundbooleanBuilt after the response; the person is notified when it is ready.requestedByobjectrequestedBy.idintegerrequestedBy.namestringcreatedAtstringcompletedAtstring or nullexpiresAtstring or nullWhen the file is deleted: seven days after it is ready.downloadUrlstring or nullA signed link that downloads the file without signing in, valid until downloadExpiresAt (at most an hour).downloadExpiresAtstring or null
curl -X POST "https://api.typefuse.dev/v1/organisations/acme/exports" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"kind":"calls","format":"csv"}'GET /v1/organisations/{org}/exports/{id}
Get an export
Path
orgRequiredstringidRequiredstring
Answer (200)
idstringkindstringOne ofcalls,changes,evidenceformatstringOne ofcsv,json,zipstatusstringqueued and running while it is built; ready to download; failed; expired once its file is deleted.One ofqueued,running,ready,failed,expiredwhatstringWhat it holds, in words.filtersobjectWhat an export was narrowed to.filters.fromstring or nullISO 8601, inclusive; null for no start.filters.tostring or nullISO 8601, exclusive; null for no end.filters.decisionstring or nullA Decision's slug.filters.environmentsarray of string or nullEnvironment slugs ("sandbox" for the Sandbox); null for every environment.filters.includePayloadsbooleanCalls only: each call's input and the state sent to the model, where still stored.rowsinteger or nullCalls or changes in the file; for an evidence pack, the calls in its period.sizeBytesinteger or nullfilenamestring or nullerrorstring or nullbackgroundbooleanBuilt after the response; the person is notified when it is ready.requestedByobjectrequestedBy.idintegerrequestedBy.namestringcreatedAtstringcompletedAtstring or nullexpiresAtstring or nullWhen the file is deleted: seven days after it is ready.downloadUrlstring or nullA signed link that downloads the file without signing in, valid until downloadExpiresAt (at most an hour).downloadExpiresAtstring or null
curl "https://api.typefuse.dev/v1/organisations/acme/exports/<id>" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN"GET /v1/organisations/{org}/exports/{id}/download
Download an export
The file itself (CSV, JSON or zip). 409 EXPORT_NOT_READY while it is built; 410 EXPORT_EXPIRED after seven days.
Path
orgRequiredstringidRequiredstring
Answer (200)
It answers with no body.
curl "https://api.typefuse.dev/v1/organisations/acme/exports/<id>/download" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN"GET /v1/organisations/{org}/exports/{id}/evidence
Download an evidence pack
An evidence pack as the app shows it: the facts its PDF is typeset from, and its files. 404 for other exports.
Path
orgRequiredstringidRequiredstring
Answer (200)
exportobjectA file exported from Audit: the Decision log ("calls") or the Change history ("changes") as CSV or JSON, or a Decision's evidence pack ("evidence", a zip with a PDF summary).export.idstringexport.kindstringOne ofcalls,changes,evidenceexport.formatstringOne ofcsv,json,zipexport.statusstringqueued and running while it is built; ready to download; failed; expired once its file is deleted.One ofqueued,running,ready,failed,expiredexport.whatstringWhat it holds, in words.export.filtersobjectWhat an export was narrowed to.export.rowsinteger or nullCalls or changes in the file; for an evidence pack, the calls in its period.export.sizeBytesinteger or nullexport.filenamestring or nullexport.errorstring or nullexport.backgroundbooleanBuilt after the response; the person is notified when it is ready.export.requestedByobjectexport.createdAtstringexport.completedAtstring or nullexport.expiresAtstring or nullWhen the file is deleted: seven days after it is ready.export.downloadUrlstring or nullA signed link that downloads the file without signing in, valid until downloadExpiresAt (at most an hour).export.downloadExpiresAtstring or nullsummaryobject or nullNull until the pack is ready, after it expires, or for a pack made before packs could be viewed.summary.organisationobjectsummary.decisionobjectAn evidence pack's Decision.summary.periodobjectsummary.generatedAtstringsummary.generatedBystringsummary.definitionobjectWhat the Decision decides, as published in the newest release the pack covers.summary.livearraysummary.evaluationsarraysummary.approvalsarraysummary.callsobjectsummary.proofobjectsummary.filesarray
curl "https://api.typefuse.dev/v1/organisations/acme/exports/<id>/evidence" \
-H "Authorization: Bearer $TYPEFUSE_TOKEN"