attest Docs

API reference

Record a witness observation

Records one assembly or delivery observation for a pair; an identical replay returns 200 with duplicate true, and different content for a stage already recorded returns 409.

POST/v1/witnessSandbox and Production differ

Overview #

Records one assembly or delivery observation for a pair; an identical replay returns 200 with duplicate true, and different content for a stage already recorded returns 409.

Authenticate with an environment API key in the Authorization: Bearer header. See Authentication.

Environments. Production: each newly accepted observation is one billed Verification Pass. Sandbox: recorded and counted, never billed.

Request · cURL
curl -X POST https://attestinfra.com/v1/witness \
  -H "Authorization: Bearer $ATTEST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "pairId": "pr_9c1d4e7a2b5f8e30",
    "stage": "assembly",
    "eventType": "transfer.requested",
    "eventId": "transfer_82",
    "timestamp": "2026-10-19T14:03:07.120Z",
    "source": "checkout",
    "destination": "payments",
    "action": "transfer",
    "outcome": "ok",
    "evidence": {
      "actionId": "transfer_82",
      "amount": 500,
      "currency": "USD"
    }
  }'
Request · JavaScript
const response = await fetch("https://attestinfra.com/v1/witness", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ATTEST_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "pairId": "pr_9c1d4e7a2b5f8e30",
    "stage": "assembly",
    "eventType": "transfer.requested",
    "eventId": "transfer_82",
    "timestamp": "2026-10-19T14:03:07.120Z",
    "source": "checkout",
    "destination": "payments",
    "action": "transfer",
    "outcome": "ok",
    "evidence": {
      "actionId": "transfer_82",
      "amount": 500,
      "currency": "USD"
    }
  }),
});
console.log(response.status, await response.json());
Request · Python
import json, os, urllib.request
request = urllib.request.Request(
    "https://attestinfra.com/v1/witness",
    method="POST",
    headers={
        "Authorization": "Bearer " + os.environ["ATTEST_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps({
        "pairId": "pr_9c1d4e7a2b5f8e30",
        "stage": "assembly",
        "eventType": "transfer.requested",
        "eventId": "transfer_82",
        "timestamp": "2026-10-19T14:03:07.120Z",
        "source": "checkout",
        "destination": "payments",
        "action": "transfer",
        "outcome": "ok",
        "evidence": {
            "actionId": "transfer_82",
            "amount": 500,
            "currency": "USD",
        },
    }).encode(),
)
with urllib.request.urlopen(request) as response:
    print(response.status, json.loads(response.read()))

Parameters #

NameTypeRequiredDescription
pairIdstring (body)RequiredClient-generated identifier shared by both observations of one boundary crossing. pattern ^[A-Za-z0-9_-]{16,128}$
stageassembly | delivery (body)Requiredassembly before the operation crosses the boundary, delivery after.
eventTypestring (body)RequiredClassification of the operation. Must match across stages to reconcile as matched. 1–255 characters
eventIdstring (body)RequiredYour identifier for the operation. 1–255 characters
timestampstring (body)RequiredWhen the observation was made, in UTC. Part of the observation's identity: a retry must reuse it exactly.
sourcestring (body)OptionalWhere the observation was made. On delivery, compared with the assembly destination. 1–255 characters
destinationstring (body)OptionalWhere the operation is headed. On assembly, compared with the delivery source. 1–255 characters
actionstring (body)RequiredThe operation. Must match across stages to reconcile as matched. 1–255 characters
outcomestring (body)OptionalResult reported by the observer. Not compared during reconciliation. 1–255 characters
evidenceobject (body)RequiredThe boundary invariants you want compared, for example an action ID and amount. Must match across stages to reconcile as matched.

Response #

200 An identical observation was already recorded for this stage. No new Verification Pass.

201 A new observation was accepted.

Response fields #

FieldTypeDescription
pairIdstringThe pair identifier.
lifecycleOPEN | FINALIZEDOPEN until finalize is called.
reconciliationStatusmatched | divergent | incomplete | orphanednull while OPEN with one stage. Fixed once FINALIZED.
assemblyObservedbooleanattest holds an assembly observation.
deliveryObservedbooleanattest holds a delivery observation. false does not mean the operation failed or did not run.
finalizedbooleantrue once finalize has been called.
executionStateunknownAlways unknown. Observations cannot prove whether your operation executed.
divergencesarrayEach compared field that differs between stages.
assemblyobject | null
deliveryobject | null
finalizedAtstring | nullWhen the pair was finalized.
reconciliationFormatattest-witness-reconciliation-v1Format of the finalized reconciliation record.
reconciliationDigeststring | nullSHA-256 of the canonical finalized reconciliation record.
acceptedbooleanAlways true on success.
duplicatebooleantrue if this exact observation was already recorded.
Response · 200
{
  "pairId": "pr_9c1d4e7a2b5f8e30",
  "lifecycle": "OPEN",
  "reconciliationStatus": null,
  "assemblyObserved": true,
  "deliveryObserved": false,
  "finalized": false,
  "executionState": "unknown",
  "divergences": [],
  "assembly": {
    "accepted": true,
    "evidenceHash": "ee76c475080687b51e6b4cc3cfb3846e985db8d88b4c26afd33fdb8963be5248",
    "receiptId": "moni_wit_25920e7d-f381-4205-ad6a-85656cb4d60a",
    "outcome": "ok"
  },
  "delivery": null,
  "finalizedAt": null,
  "reconciliationFormat": null,
  "reconciliationDigest": null,
  "accepted": true,
  "duplicate": true
}
Response · 201
{
  "pairId": "pr_9c1d4e7a2b5f8e30",
  "lifecycle": "OPEN",
  "reconciliationStatus": null,
  "assemblyObserved": true,
  "deliveryObserved": false,
  "finalized": false,
  "executionState": "unknown",
  "divergences": [],
  "assembly": {
    "accepted": true,
    "evidenceHash": "ee76c475080687b51e6b4cc3cfb3846e985db8d88b4c26afd33fdb8963be5248",
    "receiptId": "moni_wit_25920e7d-f381-4205-ad6a-85656cb4d60a",
    "outcome": "ok"
  },
  "delivery": null,
  "finalizedAt": null,
  "reconciliationFormat": null,
  "reconciliationDigest": null,
  "accepted": true,
  "duplicate": false
}

Errors #

StatuserrorcodeMeaning
400pairId is malformedINVALID_WITNESS_OBSERVATIONThe observation failed validation.
400timestamp must be an ISO-8601 UTC stringWITNESS_INVALID_TIMESTAMPThe observation failed validation.
400evidence must be a plain objectWITNESS_INVALID_EVIDENCEThe observation failed validation.
401Invalid API key—The API key is missing, unknown, revoked, or belongs to an environment that is not active.
409conflicting duplicate witness observationWITNESS_CONFLICTThe stage already holds a different observation, or the pair is finalized.
409witness pair is finalizedWITNESS_FINALIZEDThe stage already holds a different observation, or the pair is finalized.
413JSON payload exceeds the configured limit—The request body is larger than 1 MB.
500Witness observation failed—The observation could not be recorded.

All error bodies and their causes are listed in Errors.

Response · 400 · Invalid field
{
  "error": "pairId is malformed",
  "code": "INVALID_WITNESS_OBSERVATION"
}
Response · 400 · Invalid timestamp
{
  "error": "timestamp must be an ISO-8601 UTC string",
  "code": "WITNESS_INVALID_TIMESTAMP"
}
Response · 400 · Invalid evidence
{
  "error": "evidence must be a plain object",
  "code": "WITNESS_INVALID_EVIDENCE"
}
Response · 401
{
  "error": "Invalid API key"
}