AgentHandel
SACP · 1.3.0-draft

Document 13 · Added in 1.3.0-draft

REST profile

A formal REST profile for the SACP calls. It says how an agent and a shop talk over HTTP: how requests are signed, how a retry is safe, how errors look, and how a price change between prepare and confirm is caught. The words MUST, MUST NOT, SHOULD and MAY are used as in RFC 2119 and RFC 8174.

What this profile is

The profile is new in 1.3.0-draft. It is additive. A shop advertises it with the capability rest.profile and the extension extensions.rest in its discovery document. A shop that does not advertise it keeps the 1.0.0, 1.1.0 and 1.2.0 behaviour. Nothing in the earlier layers is removed.

The machine-readable form is an OpenAPI 3.1 document: /openapi.yaml and /openapi.json. The request and response bodies are JSON Schemas under /schemas/. This page is the human-readable rules. If the page and the OpenAPI document disagree, report it. The page is normative for behaviour, the schemas for the shape of bodies.

Transport and TLS

Versioning and deprecation

The major version is the last segment of the base path, for example /wp-json/agent-commerce/v1. A breaking change needs a new major version and a new path. Within a major version changes are additive: new optional fields, new endpoints, new error codes, new enum values the client must tolerate. A client MUST ignore unknown members and MUST treat an unknown error code by its HTTP status.

Authentication and agent identification

Two things are kept apart. Identification says which agent is calling (this section). Authority says what that agent may commit (the mandate). A valid signature is never authority.

HTTP Message Signatures (RFC 9421)

Key discovery

A signed example with real values is in /files/example-signed-request.json. It contains the signature base, so that an implementer can verify the signature with the public key. The key pair was generated for the example and the private key was discarded.

Idempotency

A network can fail after the shop acted and before the agent heard. A retry must not buy twice. The profile follows the IETF Idempotency-Key header (a draft). The value is a Structured Field String (RFC 9651), in double quotes, 16 to 255 characters. A random UUID is recommended.

Errors

Every error is application/problem+json (RFC 9457) with the members type, title, status and code. The code is a stable string from the registry below, and type is https://agentictradestandard.org/api/#err-{code}, which resolves to the row for that code. Code-specific members from earlier versions (diff, reasons, required, retry_after_seconds) stay as extension members. The schema is problem.schema.json.

Error code registry

The registry is machine-readable at /files/sacp-error-registry.json. New codes are added in minor versions, with the version in the last column. A vendor extension MUST use a code with the prefix x_.

CodeHTTPTitleRetryMeaningSince
invalid_request400Invalid requestnoThe request is malformed: bad JSON, a missing header or a value of the wrong type that is not covered by a more specific code.1.3.0
phase_mismatch400Phase mismatchnoThe declared agent_phase does not fit the call. Example: shopping on POST /checkout/prepare.1.2.0
phase_undeclared400Phase undeclarednoThe shop advertises agent.lane and the request declares no phase.1.2.0
phase_conflict400Phase conflictnoThe body and the SACP-Agent-Phase header declare different phases.1.2.0
idempotency_key_missing400Idempotency-Key missingnoThe call requires an Idempotency-Key header and none was sent.1.3.0
version_unsupported400Version unsupportednoThe SACP-Version header names a version the shop does not serve. The body lists the supported versions.1.3.0
signature_required401Signature requirednoThe call requires an HTTP Message Signature (or a client certificate) and none was sent. The response may carry Accept-Signature.1.3.0
signature_invalid401Signature invalidnoThe signature does not verify, the key is unknown, the algorithm is not allowed, or a required component is not covered.1.3.0
signature_expired401Signature expiredyesThe created or expires parameter is outside the allowed window. Check the clock and sign again.1.3.0
replay_detected401Replay detectednoThe nonce was already used inside its window. Sign a new request with a new nonce.1.3.0
authority_denied403Authority deniednoThe mandate does not cover the terms. The reasons member lists why.1.1.0
autonomous_not_offered403Autonomous checkout not offerednocheckout_mode is autonomous and the shop does not advertise checkout.autonomous.1.2.0
not_found404Not foundnoThe product, collection or checkout does not exist, or the caller may not see it.1.3.0
terms_changed409Terms changednoA material change voided the approval. No handoff is issued and nothing is confirmed. The body carries the diff and the current terms.1.1.0
idempotency_in_progress409Idempotency in progressyesA request with the same Idempotency-Key is still running. Retry after Retry-After.1.3.0
checkout_state_conflict409Checkout state conflictnoThe checkout is in a state that does not allow this call. Example: confirm on a human_handoff checkout.1.3.0
checkout_expired410Checkout expirednoThe prepared checkout passed expires_at. Prepare a new one.1.3.0
precondition_failed412Precondition failednoIf-Match does not equal the current ETag. The checkout changed after the agent read it. Fetch it again with GET.1.3.0
payload_too_large413Payload too largenoThe body is larger than the shop accepts. The limit is 1 MiB unless the shop advertises another limit.1.3.0
unsupported_media_type415Unsupported media typenoThe Content-Type is not application/json.1.3.0
validation_failed422Validation failednoThe body is valid JSON but breaks the schema or a business rule. The errors member lists JSON Pointers.1.3.0
idempotency_key_reuse422Idempotency-Key reusednoThe Idempotency-Key was used before with a different request. Use a new key for a new request.1.3.0
approval_required428Approval requirednoThe amount is above an approval threshold. A named approver must sign an approval bound to the terms hash.1.1.0
precondition_required428Precondition requirednoThe call requires an If-Match header and none was sent.1.3.0
rate_limited429Rate limitedyesThe limit for the agent phase was exceeded. Wait Retry-After seconds.1.2.0
internal_error500Internal erroryesThe shop failed. Retry with the same Idempotency-Key.1.3.0
service_unavailable503Service unavailableyesThe shop is down or in maintenance. Retry after Retry-After.1.3.0

Pagination

Lists use cursors, not offsets. The request carries limit (1 to 100, default 20; the shop may advertise lower numbers) and cursor. The answer carries items and next_cursor, which is null on the last page. The cursor is opaque. A shop MUST keep a cursor valid for at least 10 minutes. An expired cursor answers 422 validation_failed with the pointer /cursor. Results can change between pages, so an agent MUST NOT assume a stable snapshot. A GET list (none exists yet) uses the query parameters limit and cursor and the Link header with rel="next" (RFC 8288).

Rate limits

ETag, If-Match and price changes

Between prepare and confirm the world can change: a price, a stock level, a shipping cost, the expiry. Two different checks catch this, and they answer different questions.

CheckQuestionAnswer on failure
If-Match with the checkout ETagIs the checkout the agent holds still the current one?412 precondition_failed (428 precondition_required if the header is missing). Read the checkout again with GET.
terms_hash in the confirm bodyDo the live terms still equal the terms that were approved?409 terms_changed with a diff and the current terms. Under the default tolerance of zero any price increase is material. See approved terms.

The checkout resource

POST /checkout/prepare creates a checkout. Its status moves along these edges and never backwards:

StatusMeaningNext
awaiting_humanhuman_handoff. The handoff URL is issued. A person completes it with the merchant.confirmed, expired, cancelled, failed
ready_to_confirmautonomous. The terms are bound. The agent may call confirm.confirmed, expired, cancelled, failed
confirmedAn order exists (order.order_id). Terminal.—
expired, cancelled, failedTerminal. Nothing was charged by this checkout.—

Formats

KindFormatExample
MoneyObject {"amount", "currency"}. amount is a decimal string in major units with the exponent of the currency (ISO 4217): two decimals for SEK, none for JPY. currency is the ISO 4217 alphabetic code. JSON numbers are not used for money, because binary floating point cannot hold 0.10.{"amount":"1290.00","currency":"SEK"}
TimestampRFC 3339 date-time in UTC with the suffix Z. No local offsets.2026-12-04T09:15:00Z
DateISO 8601 calendar date, YYYY-MM-DD.2026-12-09
CountryISO 3166-1 alpha-2, upper case. A postcode is sent only when the carrier needs it for the quote. A street address is never part of a shopping call.SE
QuantityPositive integer.1
IdentifiersOpaque strings, at most 128 characters, case sensitive. The client never parses them.co_7f3a91
Hashsha256: and 64 lower-case hex characters over RFC 8785 canonical JSON.sha256:8042…f1fb

The agent reference

The agent reference is a critical data element. It answers one audit question: which agent, under which mandate, made this order. Added in 1.3.0-draft from community feedback.

MemberMeaning
key_idThe RFC 7638 thumbprint of the key that signed the prepare call.
mandate_idThe mandate_id of the mandate presented with the call. Absent when none was presented.
checkout_idThe checkout.
refThe compact form key_id/mandate_id/checkout_id, with - for an absent mandate. At most 256 characters. It fits a payment reference or a metadata field.
"agent_reference": {
  "key_id": "dRkgvMoKa5Kry4nJd8QjnqBSOxvTzyWiXd9NVAFLYRQ",
  "mandate_id": "mnd_2026_12_0042",
  "checkout_id": "co_7f3a91",
  "ref": "dRkgvMoKa5Kry4nJd8QjnqBSOxvTzyWiXd9NVAFLYRQ/mnd_2026_12_0042/co_7f3a91"
}

Webhooks

Webhooks are optional (webhooks: true in discovery). The agent gives a webhook object in POST /checkout/prepare: an HTTPS url and the events it wants: checkout.confirmed, checkout.expired, checkout.cancelled, checkout.failed. The body is the event envelope WebhookEvent of rest.schema.json with the checkout resource.

Security considerations

ThreatDefence in this profile
Replay of a signed requestSignature window of 300 seconds, a nonce remembered per key, an idempotency key, and a checkout that commits at most once.
Price or terms change after approvalterms_hash binding, a re-quote at confirm, ETag with If-Match, and a tolerance that defaults to zero.
An agent acting outside its mandateThe signing key thumbprint must equal agent.key_thumbprint in the mandate. The mandate and approvals are checked against the exact terms hash at confirm, and the mandate status is read fresh.
A stolen or leaked keyShort signature lifetime, key removal from the directory, mandate revocation, and per-agent rate limits and alerts.
Enumeration of checkoutsUnguessable ids bound to the creating agent. 404 for a foreign id.
Webhook abuse (SSRF)HTTPS only, no redirects, address checks, no credentials, signed deliveries.
Oversized or malformed input1 MiB body limit, strict schemas, 413, 415 and 422 answers, rate limits per agent.
Cross-site calls from a browserNo wildcard CORS on checkout endpoints. Signatures are not available to page scripts.
A downgrade to a weaker schemeShared-secret MACs are not accepted. The shop advertises the algorithms it allows and rejects the rest with 401 signature_invalid.

Privacy and data minimisation

Conformance levels

A shop declares one level in extensions.rest.level. A higher level includes every requirement of the lower one. The keywords are those of RFC 2119 and RFC 8174. The numbers in this profile (a 300 second signature window, 60 seconds of skew, 24 hours to 30 days of idempotency retention, a 1 MiB body, 12 months of deprecation notice, the webhook retry schedule, 10 minute cursors) are draft defaults, open for feedback: send comments to info@linespotting.com.

LevelForIn short
rest-coreShopping: discovery, catalog, shipping, negotiation, collectionTLS, versioning, problem+json, formats, pagination, rate limits, agent identification
rest-checkoutCheckout with human handoffAdds signatures, idempotency, ETag and If-Match, the checkout resource, terms re-check at confirm
rest-enterpriseOrganizations with mandates and audit, and optional autonomous checkoutAdds signatures or mutual TLS on every call, signed webhooks, key rotation rules, audit ids, and the optional confirm call
IdLevelKeywordRequirement
T-1coreMUSTHTTPS with TLS 1.2 or later on every endpoint. TLS 1.3 SHOULD be offered.
T-2coreMUSTSend HSTS with max-age of at least 31536000 on the API host.
T-3coreMUSTAccept and send UTF-8 application/json. Answer 415 and 413 as specified.
T-4coreMUST NOTAnswer checkout endpoints with wildcard CORS.
V-1coreMUSTPut the major version in the base path.
V-2coreMUSTAnswer 400 version_unsupported for an unserved SACP-Version. SHOULD send SACP-Version in answers.
V-3coreMUSTMark deprecated operations with Deprecation and Sunset and keep them 12 months after announcement once the major version is final.
E-1coreMUSTReturn errors as application/problem+json with type, title, status and a registry code.
E-2coreMUST NOTPut personal data, secrets or stack traces in detail.
E-3coreSHOULDInclude trace_id in every error.
F-1coreMUSTMoney as an object with a decimal string amount and an ISO 4217 currency. No JSON numbers for money.
F-2coreMUSTTimestamps in RFC 3339 UTC with Z. Dates as YYYY-MM-DD. Countries as ISO 3166-1 alpha-2.
P-1coreMUSTPaginate lists with limit and an opaque cursor. Default 20, maximum 100. next_cursor is null on the last page. Cursors live at least 10 minutes.
R-1coreMUSTAnswer 429 rate_limited with Retry-After in seconds. SHOULD send RateLimit-Policy and RateLimit.
A-1coreMUSTRequire the agent lane declaration (agent id and phase) as in 1.2.0, and label requests by phase.
A-2coreMUSTVerify a signature that is present on a shopping call, and reject a bad one.
S-1checkoutMUSTRequire an RFC 9421 signature or mutual TLS on every checkout-phase call.
S-2checkoutMUSTCheck that the covered components include the minimum set and that Content-Digest matches the body bytes.
S-3checkoutMUSTReject a signature with expires minus created above 300 seconds, or outside 60 seconds of skew.
S-4checkoutMUSTRemember nonces per key until expires plus skew and answer 401 replay_detected for a repeat.
S-5checkoutMUST NOTAccept shared-secret MACs for agent requests. Allowed: ed25519, ecdsa-p256-sha256.
S-6checkoutMUSTBind the key to the SACP-Agent-Id, and to agent.key_thumbprint when a mandate is presented.
I-1checkoutMUSTEnforce Idempotency-Key on collection/items, prepare, confirm and cancel.
I-2checkoutMUSTReplay the stored answer for the same key and request. 422 for a different request. 409 while running. Keep 24 hours to 30 days.
I-3checkoutMUSTScope the key to the agent identity, not to the IP address.
C-1checkoutMUSTSend a strong ETag on checkout answers. Require If-Match on confirm: 428 if missing, 412 if stale.
C-2checkoutMUSTRe-quote at confirm and compare with terms_hash. 409 terms_changed outside the tolerance.
C-3checkoutMUSTCommit at most once per checkout and never after expires_at. Never change price, tax or shipping silently.
C-4checkoutMUSTMake checkout_id unguessable and bound to the creating agent. Answer 404 for a foreign id.
C-5checkoutMUSTPut agent_reference on every checkout answer, order and webhook event, and keep it unchanged through settlement and reconciliation.
W-1checkoutMUSTIf webhooks are offered: sign each delivery, https only, no redirects, address checks, retry schedule, event id for deduplication.
X-1enterpriseMUSTRequire a signature or mutual TLS on every call, shopping included.
X-2enterpriseMUSTOffer signed webhooks, and keep a replaced key in the directory for at least max_validity_seconds plus retention.
X-3enterpriseMUSTReturn audit_event_id on confirm when a mandate was checked, and check mandate status fresh.
X-5enterpriseMAYOffer autonomous checkout and POST /checkout/{checkout_id}/confirm. If offered, advertise checkout.autonomous, require a mandate that covers the exact terms, and otherwise answer 403 autonomous_not_offered.
X-6enterpriseMAYAccept standing mandates (authority.standing). Inside the policy, autonomous checkout needs no per-checkout approval. Outside it, answer 403 authority_denied with outside_standing_policy.
X-4enterpriseSHOULDOffer mutual TLS with a certificate bound to the agent key.

Examples

The values are examples. Hosts end in .example or .example.se. The signatures are real (they verify with the public key in the file) but the keys belong to no one.

1. Prepare a checkout (human handoff), signed

POST /wp-json/agent-commerce/v1/checkout/prepare HTTP/1.1
Host: shop.example.se
Content-Type: application/json
SACP-Agent-Id: agent:buyer-agent-7
SACP-Agent-Phase: checkout
SACP-Checkout-Mode: human_handoff
Idempotency-Key: "8e03978e-40d5-43e8-bc93-6894a57f9324"
Content-Digest: sha-256=:j3I/t+GrGfzTpIkdEmGSAE3bmjZs/2FZem/zZ2DZdGQ=:
Signature-Input: sacp1=("@method" "@target-uri" "content-type" "content-digest" "sacp-agent-id" "idempotency-key");created=1796374870;expires=1796375170;nonce="n-5f1c0a77d2b94e3a";keyid="dRkgvMoKa5Kry4nJd8QjnqBSOxvTzyWiXd9NVAFLYRQ";alg="ed25519";tag="sacp-1"
Signature: sacp1=:GkCJ0X9+RJdd1hGrG3jAicurPKg4rnr+RPY38IQuIgHO3VGjmZmKoaW9cuDYNZibPtP44bGiAEr2uHNTDSRyAQ==:

{
  "agent": {
    "id": "agent:buyer-agent-7",
    "name": "Example Buyer Agent",
    "agent_phase": "checkout",
    "checkout_mode": "human_handoff"
  },
  "collection_id": "col_31c8",
  "items": [
    {
      "id": "sku-1042",
      "qty": 1
    }
  ],
  "shipping": {
    "method": "home-delivery",
    "destination": {
      "country": "SE"
    }
  },
  "payment_handoff": "swish",
  "approved_terms": {
    "snapshot": {
      "sacp_terms_version": "1.1",
      "quote_id": "q_8f3a2c71",
      "merchant": {
        "id": "shop.example.se",
        "name": "Example Shop AB",
        "origin": "https://shop.example.se"
      },
      "items": [
        {
          "id": "sku-1042",
          "name": "Trail running shoes, size 43",
          "qty": 1,
          "unit_price": "1290.00",
          "line_total": "1290.00",
          "availability": "in_stock"
        }
      ],
      "currency": "SEK",
      "subtotal": "1290.00",
      "taxes": [
        {
          "type": "vat",
          "rate": "0.25",
          "amount": "269.80",
          "included": true
        }
      ],
      "shipping": {
        "method": "home-delivery",
        "carrier": "Example Carrier",
        "cost": "59.00",
        "eta_date": "2026-12-09",
        "destination": {
          "country": "SE"
        }
      },
      "total": "1349.00",
      "valid_from": "2026-12-04T09:00:00Z",
      "valid_until": "2026-12-04T09:15:00Z",
      "tolerance": {
        "price_increase_max_percent": "0",
        "price_increase_max_amount": "0.00",
        "shipping_cost_increase_max": "0.00",
        "eta_delay_max_days": 0,
        "total_increase_max": "0.00"
      }
    },
    "terms_hash": "sha256:8042bb8bd734bf15b1437a5630335263b0f6494700f4d92ef461049c1235f1fb"
  },
  "webhook": {
    "url": "https://agent.example/hooks/sacp",
    "events": [
      "checkout.confirmed",
      "checkout.expired"
    ]
  }
}

(The Content-Digest is over the compact form of this body. The exact bytes are in /files/example-signed-request.json.)
HTTP/1.1 200 OK
Content-Type: application/json
ETag: "co_7f3a91-1"
SACP-Version: 1.3
RateLimit-Policy: "checkout";q=10;w=60
RateLimit: "checkout";r=9;t=58

{
  "checkout_id": "co_7f3a91",
  "status": "awaiting_human",
  "created_at": "2026-12-04T09:01:12Z",
  "expires_at": "2026-12-04T09:15:00Z",
  "terms_hash": "sha256:8042bb8bd734bf15b1437a5630335263b0f6494700f4d92ef461049c1235f1fb",
  "handoff": {
    "type": "swish",
    "url": "https://shop.example.se/pay/co_7f3a91",
    "expires_at": "2026-12-04T09:15:00Z"
  },
  "terms_check": {
    "status": "match",
    "terms_hash": "sha256:8042bb8bd734bf15b1437a5630335263b0f6494700f4d92ef461049c1235f1fb"
  },
  "agent_reference": {
    "key_id": "dRkgvMoKa5Kry4nJd8QjnqBSOxvTzyWiXd9NVAFLYRQ",
    "checkout_id": "co_7f3a91",
    "ref": "dRkgvMoKa5Kry4nJd8QjnqBSOxvTzyWiXd9NVAFLYRQ/-/co_7f3a91"
  }
}
POST /wp-json/agent-commerce/v1/catalog/search HTTP/1.1
Host: shop.example.se
Content-Type: application/json
SACP-Agent-Id: agent:buyer-agent-7
SACP-Agent-Phase: shopping

{
  "agent": {
    "id": "agent:buyer-agent-7",
    "name": "Example Buyer Agent",
    "agent_phase": "shopping",
    "checkout_mode": "human_handoff"
  },
  "query": "trail running shoes",
  "max_price": {
    "amount": "1500.00",
    "currency": "SEK"
  },
  "limit": 2
}
HTTP/1.1 200 OK
Content-Type: application/json
SACP-Version: 1.3
RateLimit-Policy: "shopping";q=60;w=60
RateLimit: "shopping";r=58;t=41

{
  "items": [
    {
      "id": "sku-1042",
      "name": "Trail running shoes, size 43",
      "gtin": "7350012345678",
      "price": {
        "amount": "1290.00",
        "currency": "SEK"
      },
      "availability": "in_stock",
      "url": "https://shop.example.se/p/sku-1042"
    },
    {
      "id": "sku-2210",
      "name": "Trail running shoes, size 43, wide",
      "price": {
        "amount": "1390.00",
        "currency": "SEK"
      },
      "availability": "preorder"
    }
  ],
  "next_cursor": "eyJvIjoyfQ"
}

3. Confirm after the price rose (409)

POST /wp-json/agent-commerce/v1/checkout/co_7f3a91/confirm HTTP/1.1
Host: shop.example.se
Content-Type: application/json
If-Match: "co_7f3a91-1"
Idempotency-Key: "1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed"
SACP-Agent-Id: agent:buyer-agent-7
SACP-Agent-Phase: checkout
SACP-Checkout-Mode: autonomous
Signature-Input: sacp1=(…);tag="sacp-1"
Signature: sacp1=:…:

{
  "agent": {
    "id": "agent:buyer-agent-7",
    "name": "Example Buyer Agent",
    "agent_phase": "checkout",
    "checkout_mode": "autonomous"
  },
  "terms_hash": "sha256:8042bb8bd734bf15b1437a5630335263b0f6494700f4d92ef461049c1235f1fb",
  "authority": {
    "mandate_ref": "https://authority.example.org/mandates/mnd_2026_12_0042"
  }
}
HTTP/1.1 409 Conflict
Content-Type: application/problem+json

{
  "type": "https://agentictradestandard.org/api/#err-terms_changed",
  "title": "Terms changed",
  "status": 409,
  "code": "terms_changed",
  "detail": "The unit price rose from 1290.00 to 1390.00 SEK. The approval no longer covers the offer.",
  "retryable": false,
  "approved_terms_hash": "sha256:8042bb8bd734bf15b1437a5630335263b0f6494700f4d92ef461049c1235f1fb",
  "current_terms_hash": "sha256:04a669ab1d22ffccdd4bc5e6e2a4b997a72b38c8a7ab46b45f4ed627a435af7b",
  "within_tolerance": false,
  "reconfirm_required": true,
  "diff": [
    {
      "path": "items[0].unit_price",
      "approved": "1290.00",
      "current": "1390.00",
      "change": "increase",
      "material": true
    },
    {
      "path": "total",
      "approved": "1349.00",
      "current": "1449.00",
      "change": "increase",
      "material": true
    }
  ],
  "current_terms": {
    "sacp_terms_version": "1.1",
    "quote_id": "q_8f3a2c71",
    "merchant": {
      "id": "shop.example.se",
      "name": "Example Shop AB",
      "origin": "https://shop.example.se"
    },
    "items": [
      {
        "id": "sku-1042",
        "name": "Trail running shoes, size 43",
        "qty": 1,
        "unit_price": "1390.00",
        "line_total": "1390.00",
        "availability": "in_stock"
      }
    ],
    "currency": "SEK",
    "subtotal": "1390.00",
    "taxes": [
      {
        "type": "vat",
        "rate": "0.25",
        "amount": "289.80",
        "included": true
      }
    ],
    "shipping": {
      "method": "home-delivery",
      "carrier": "Example Carrier",
      "cost": "59.00",
      "eta_date": "2026-12-09",
      "destination": {
        "country": "SE"
      }
    },
    "total": "1449.00",
    "valid_from": "2026-12-04T09:00:00Z",
    "valid_until": "2026-12-04T09:15:00Z",
    "tolerance": {
      "price_increase_max_percent": "0",
      "price_increase_max_amount": "0.00",
      "shipping_cost_increase_max": "0.00",
      "eta_delay_max_days": 0,
      "total_increase_max": "0.00"
    }
  }
}

4. Confirm with a stale ETag (412)

HTTP/1.1 412 Precondition Failed
Content-Type: application/problem+json

{
  "type": "https://agentictradestandard.org/api/#err-precondition_failed",
  "title": "Precondition failed",
  "status": 412,
  "code": "precondition_failed",
  "detail": "The checkout changed after it was read. Read it again with GET /checkout/co_7f3a91.",
  "instance": "/checkout/co_7f3a91/confirm",
  "retryable": false
}

5. A retry and a reused key

# Same Idempotency-Key, same body, after a lost answer:
HTTP/1.1 200 OK
Idempotent-Replayed: true
Content-Type: application/json

(the stored answer of the first call, byte for byte)

# Same Idempotency-Key, different body:
HTTP/1.1 422 Unprocessable Content
Content-Type: application/problem+json

{
  "type": "https://agentictradestandard.org/api/#err-idempotency_key_reuse",
  "title": "Idempotency-Key reused",
  "status": 422,
  "code": "idempotency_key_reuse",
  "detail": "This key was used with a different request.",
  "retryable": false
}

6. Rate limited (429)

HTTP/1.1 429 Too Many Requests
Content-Type: application/problem+json
Retry-After: 30
RateLimit-Policy: "shopping";q=60;w=60
RateLimit: "shopping";r=0;t=30

{
  "type": "https://agentictradestandard.org/api/#err-rate_limited",
  "title": "Rate limited",
  "status": 429,
  "code": "rate_limited",
  "retryable": true,
  "agent_phase": "shopping",
  "retry_after_seconds": 30
}

7. A webhook delivery

POST /hooks/sacp HTTP/1.1
Host: agent.example
Content-Type: application/json
SACP-Webhook-Id: evt_01je5q7m2k
Content-Digest: sha-256=:GIjHKB6MJeyIhBhZzXulQPn+9tUxBVjoePRPaV9RBvE=:
Signature-Input: sacpwh=("@method" "@target-uri" "content-type" "content-digest" "sacp-webhook-id");created=1796375262;expires=1796375562;nonce="w-91d03be4c7a8";keyid="wUnyhuKK3awE7ycENiuc4yzof6zFazcQ4V0pPSa8NLc";alg="ed25519";tag="sacp-webhook-1"
Signature: sacpwh=:KJGBvPCfASnL2ZgnBUNSzkqZnaSEX0QQD5HulDouZg9RboorQ9FNM3BtZxJYPbw5z8omjrhJnZG0PbStK5LsCA==:

{
  "id": "evt_01je5q7m2k",
  "type": "checkout.confirmed",
  "created": "2026-12-04T09:07:42Z",
  "checkout_id": "co_7f3a91",
  "agent_reference": {
    "key_id": "dRkgvMoKa5Kry4nJd8QjnqBSOxvTzyWiXd9NVAFLYRQ",
    "mandate_id": "mnd_2026_12_0042",
    "checkout_id": "co_7f3a91",
    "ref": "dRkgvMoKa5Kry4nJd8QjnqBSOxvTzyWiXd9NVAFLYRQ/mnd_2026_12_0042/co_7f3a91"
  },
  "data": {
    "checkout": {
      "checkout_id": "co_7f3a91",
      "status": "confirmed",
      "created_at": "2026-12-04T09:01:12Z",
      "expires_at": "2026-12-04T09:15:00Z",
      "terms_hash": "sha256:8042bb8bd734bf15b1437a5630335263b0f6494700f4d92ef461049c1235f1fb",
      "order": {
        "order_id": "ord_5521",
        "confirmed_at": "2026-12-04T09:07:41Z",
        "agent_reference": {
          "key_id": "dRkgvMoKa5Kry4nJd8QjnqBSOxvTzyWiXd9NVAFLYRQ",
          "mandate_id": "mnd_2026_12_0042",
          "checkout_id": "co_7f3a91",
          "ref": "dRkgvMoKa5Kry4nJd8QjnqBSOxvTzyWiXd9NVAFLYRQ/mnd_2026_12_0042/co_7f3a91"
        }
      },
      "authority_check": {
        "status": "covered",
        "mandate_id": "mnd_2026_12_0042",
        "level": "consumer",
        "approvals_verified": [
          "apr_2026_12_9917"
        ],
        "audit_event_id": "aud_88123"
      },
      "agent_reference": {
        "key_id": "dRkgvMoKa5Kry4nJd8QjnqBSOxvTzyWiXd9NVAFLYRQ",
        "mandate_id": "mnd_2026_12_0042",
        "checkout_id": "co_7f3a91",
        "ref": "dRkgvMoKa5Kry4nJd8QjnqBSOxvTzyWiXd9NVAFLYRQ/mnd_2026_12_0042/co_7f3a91"
      }
    }
  }
}

(The Content-Digest is over the compact form. See /files/example-signed-webhook.json.)

8. Discovery with the REST profile

{
  "capabilities": [
    "catalog.search",
    "catalog.product",
    "shipping.quote",
    "negotiation.offer",
    "collection.items",
    "checkout.handoff",
    "checkout.status",
    "terms.binding",
    "authority.mandate",
    "agent.lane",
    "rest.profile"
  ],
  "endpoints": {
    "catalog_search": "/wp-json/agent-commerce/v1/catalog/search",
    "catalog_product": "/wp-json/agent-commerce/v1/catalog/product/{id}",
    "shipping_quote": "/wp-json/agent-commerce/v1/shipping/quote",
    "negotiation_offer": "/wp-json/agent-commerce/v1/negotiation/offer",
    "collection_items": "/wp-json/agent-commerce/v1/collection/items",
    "checkout_prepare": "/wp-json/agent-commerce/v1/checkout/prepare",
    "checkout_status": "/wp-json/agent-commerce/v1/checkout/{checkout_id}",
    "checkout_cancel": "/wp-json/agent-commerce/v1/checkout/{checkout_id}/cancel",
    "jwks": "/.well-known/jwks.json"
  },
  "extensions": {
    "rest": {
      "profile": "1.3",
      "level": "rest-checkout",
      "versions": [
        "1"
      ],
      "openapi": "https://agentictradestandard.org/openapi.json",
      "jwks_uri": "/.well-known/jwks.json",
      "signature": {
        "algorithms": [
          "ed25519",
          "ecdsa-p256-sha256"
        ],
        "required_for": [
          "checkout"
        ],
        "max_clock_skew_seconds": 60,
        "max_validity_seconds": 300,
        "mtls": false
      },
      "idempotency": {
        "retention_seconds": 86400
      },
      "pagination": {
        "default_limit": 20,
        "max_limit": 100
      },
      "max_body_bytes": 1048576,
      "webhooks": true
    }
  }
}

Machine-readable files

Questions

How does an agent authenticate to a SACP shop?

With HTTP Message Signatures (RFC 9421) or mutual TLS. Every checkout call is signed over the method, the target URI, the body digest, the agent id and the idempotency key, with a window of at most 300 seconds and a one-time nonce. The key thumbprint must match the mandate. A valid signature identifies the agent. It is never authority to commit.

How does SACP stop a retry from buying twice?

Every state-changing POST carries an Idempotency-Key. The shop stores the first answer and returns it again, with Idempotent-Replayed: true, for the same key and request. A different request with the same key gets 422 idempotency_key_reuse, and a request that is still running gets 409 idempotency_in_progress. A checkout also commits at most once.

What error format does SACP use?

RFC 9457 problem+json. Every error has type, title, status and a stable code from the SACP error registry, for example terms_changed, approval_required, rate_limited or precondition_failed. The type is a URL on this site that explains the code. The registry is at /api/#error-registry and /files/sacp-error-registry.json.

What happens if the price changes between prepare and confirm?

Two checks run. If-Match with the checkout ETag catches a checkout that changed after it was read (412 precondition_failed). The terms_hash in the confirm body is compared with a fresh quote and catches a changed price (409 terms_changed with a diff). Under the default tolerance of zero any price increase is material, and nothing is committed.

Is there an OpenAPI document for SACP?

Yes. SACP 1.3.0-draft publishes an OpenAPI 3.1 document at /openapi.yaml and /openapi.json with request and response schemas, security schemes, error responses, and webhooks. It passes redocly lint with no warnings. The human-readable REST profile is at /api/.

What are the SACP REST conformance levels?

rest-core is shopping: TLS, versioning, problem+json, formats, pagination and rate limits. rest-checkout adds signatures, idempotency, ETag with If-Match, the checkout resource and the terms re-check at confirm. rest-enterprise adds signatures or mutual TLS on every call, signed webhooks, key rotation rules, audit ids and the optional autonomous confirm call. A shop declares its level in extensions.rest.level.

What is the SACP agent reference and why must a shop keep it?

The agent reference is key_id, mandate_id and checkout_id, plus a compact ref string. Every checkout answer, order and webhook event must carry it, and the shop must persist it through settlement and reconciliation. It lets a merchant, a PSP or an auditor tie an order to the exact agent key and mandate.

Rendered from docs/api.md in LinespottingOrg/AgentHandelStandard. December 2026 draft. Not an ISO standard.