{
  "openapi": "3.1.0",
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "info": {
    "title": "Standard Agent Commerce Protocol (SACP) API",
    "version": "1.3.0-draft",
    "summary": "REST profile of the Standard Agent Commerce Protocol.",
    "description": "Standard Agent Commerce Protocol (SACP). The REST profile of 1.3.0-draft: catalog search, shipping quotes, negotiation, item collection, a purchase handoff and, where the shop offers it, autonomous confirmation. Human readable rules: https://standardagentcommerceprotocol.org/api/ . Handoff names are Swish, IBAN, card and crypto. A shop may name another service. BankID is identity, not a payment. The call does not carry a card number or a private key. Errors are RFC 9457 problem+json with the codes of https://standardagentcommerceprotocol.org/api/#error-registry . POST calls that change state need an Idempotency-Key. Checkout calls are signed with RFC 9421 or sent over mutual TLS. Money is a decimal string with an ISO 4217 currency. Timestamps are RFC 3339 in UTC. Every checkout, order and webhook carries agent_reference (agent key id, mandate id, checkout id), which the shop keeps through settlement and reconciliation. 1.1.0-draft added optional terms binding and an authority layer. 1.2.0-draft added the declared agent lane. Not an ISO standard.",
    "termsOfService": "https://standardagentcommerceprotocol.org/tos/",
    "contact": {
      "name": "LineSpotting AB",
      "email": "info@linespotting.com",
      "url": "https://standardagentcommerceprotocol.org/"
    },
    "license": {
      "name": "Apache-2.0",
      "identifier": "Apache-2.0"
    }
  },
  "externalDocs": {
    "description": "SACP REST profile, human readable",
    "url": "https://standardagentcommerceprotocol.org/api/"
  },
  "servers": [
    {
      "url": "https://{host}{basePath}",
      "description": "A shop. The real paths are in the discovery document.",
      "variables": {
        "host": {
          "default": "shop.example.se"
        },
        "basePath": {
          "default": "/wp-json/agent-commerce/v1",
          "description": "The major version is the last path segment (v1)."
        }
      }
    }
  ],
  "tags": [
    {
      "name": "Discovery",
      "description": "Capabilities and keys."
    },
    {
      "name": "Shopping",
      "description": "agent_phase shopping. No financial obligation."
    },
    {
      "name": "Checkout",
      "description": "agent_phase checkout. Signed. Idempotent."
    },
    {
      "name": "Webhooks",
      "description": "Shop to agent events."
    }
  ],
  "security": [
    {},
    {
      "sacpSignature": []
    },
    {
      "sacpMtls": []
    }
  ],
  "paths": {
    "/.well-known/sacp": {
      "servers": [
        {
          "url": "https://{host}",
          "variables": {
            "host": {
              "default": "shop.example.se"
            }
          }
        }
      ],
      "get": {
        "operationId": "getDiscovery",
        "tags": [
          "Discovery"
        ],
        "summary": "Discovery document",
        "description": "Capability document. A shop that follows the REST profile advertises extensions.rest. On this documentation host the same JSON is also served at /.well-known/sacp.json and /.well-known/agent-commerce.",
        "security": [
          {},
          {
            "sacpSignature": []
          },
          {
            "sacpMtls": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SacpAgentId"
          },
          {
            "$ref": "#/components/parameters/SacpAgentPhase"
          },
          {
            "$ref": "#/components/parameters/SacpCheckoutMode"
          },
          {
            "$ref": "#/components/parameters/SacpVersion"
          }
        ],
        "responses": {
          "200": {
            "description": "Capability document.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "SACP-Version": {
                "$ref": "#/components/headers/SacpVersion"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscoveryDocument"
                },
                "example": {
                  "protocol": "sacp",
                  "version": "1.3.0-draft",
                  "name": "Standard Agent Commerce Protocol",
                  "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"
                  },
                  "payment_handoff": [
                    "swish",
                    "iban",
                    "card",
                    "crypto"
                  ],
                  "identity_handoff": [
                    "bankid"
                  ],
                  "extensions": {
                    "future_rails": [
                      "ekrona",
                      "digital_euro"
                    ],
                    "terms_binding": {
                      "hash": "sha256",
                      "canonicalization": "jcs-rfc8785",
                      "max_validity_seconds": 900,
                      "signed_quotes": false
                    },
                    "authority": {
                      "levels": [
                        "consumer",
                        "enterprise"
                      ],
                      "mandate_formats": [
                        "jws"
                      ],
                      "trusted_issuers": [
                        "https://authority.example.org"
                      ]
                    },
                    "agent_lane": {
                      "phases": [
                        "shopping",
                        "checkout"
                      ],
                      "checkout_modes": [
                        "human_handoff"
                      ],
                      "identification": [
                        "body.agent",
                        "SACP-Agent-Id"
                      ],
                      "shopping_rate_limit": {
                        "requests_per_minute": 60,
                        "burst": 20
                      },
                      "checkout_rate_limit": {
                        "requests_per_minute": 10,
                        "burst": 3
                      }
                    },
                    "rest": {
                      "profile": "1.3",
                      "level": "rest-checkout",
                      "versions": [
                        "1"
                      ],
                      "openapi": "https://standardagentcommerceprotocol.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
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/.well-known/jwks.json": {
      "servers": [
        {
          "url": "https://{host}",
          "variables": {
            "host": {
              "default": "shop.example.se"
            }
          }
        }
      ],
      "get": {
        "operationId": "getJwks",
        "tags": [
          "Discovery"
        ],
        "summary": "Shop signing keys (JWKS)",
        "description": "Public keys of the shop. They verify quote_signature, webhook signatures and any signed response. The path is the default. extensions.rest.jwks_uri names the real location.",
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "JSON Web Key Set (RFC 7517).",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "SACP-Version": {
                "$ref": "#/components/headers/SacpVersion"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Jwks"
                },
                "example": {
                  "keys": [
                    {
                      "kty": "OKP",
                      "crv": "Ed25519",
                      "x": "9Dbny4XWHeMh_N_kO4T4GTtb7goRZaJ1BBHJxJTqkk0",
                      "kid": "wUnyhuKK3awE7ycENiuc4yzof6zFazcQ4V0pPSa8NLc",
                      "use": "sig",
                      "alg": "EdDSA"
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/catalog/search": {
      "post": {
        "operationId": "searchCatalog",
        "tags": [
          "Shopping"
        ],
        "summary": "Search products",
        "description": "Cursor pagination. Pass next_cursor as cursor to read the next page. Results can change between pages.",
        "security": [
          {},
          {
            "sacpSignature": []
          },
          {
            "sacpMtls": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SacpAgentId"
          },
          {
            "$ref": "#/components/parameters/SacpAgentPhase"
          },
          {
            "$ref": "#/components/parameters/SacpCheckoutMode"
          },
          {
            "$ref": "#/components/parameters/SacpVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKeyOptional"
          },
          {
            "$ref": "#/components/parameters/SignatureInput"
          },
          {
            "$ref": "#/components/parameters/Signature"
          },
          {
            "$ref": "#/components/parameters/ContentDigest"
          },
          {
            "$ref": "#/components/parameters/SignatureAgent"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchRequest"
              },
              "example": {
                "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
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A page of matching products.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "SACP-Version": {
                "$ref": "#/components/headers/SacpVersion"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductList"
                },
                "example": {
                  "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"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/catalog/product/{id}": {
      "get": {
        "operationId": "getProduct",
        "tags": [
          "Shopping"
        ],
        "summary": "Get product details",
        "security": [
          {},
          {
            "sacpSignature": []
          },
          {
            "sacpMtls": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "$ref": "#/components/parameters/SacpAgentId"
          },
          {
            "$ref": "#/components/parameters/SacpAgentPhase"
          },
          {
            "$ref": "#/components/parameters/SacpCheckoutMode"
          },
          {
            "$ref": "#/components/parameters/SacpVersion"
          },
          {
            "$ref": "#/components/parameters/SignatureInput"
          },
          {
            "$ref": "#/components/parameters/Signature"
          },
          {
            "$ref": "#/components/parameters/ContentDigest"
          },
          {
            "$ref": "#/components/parameters/SignatureAgent"
          }
        ],
        "responses": {
          "200": {
            "description": "The product.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "SACP-Version": {
                "$ref": "#/components/headers/SacpVersion"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                },
                "example": {
                  "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"
                }
              }
            }
          },
          "304": {
            "description": "Not modified. Sent when If-None-Match matches the ETag."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/shipping/quote": {
      "post": {
        "operationId": "quoteShipping",
        "tags": [
          "Shopping"
        ],
        "summary": "Get shipping quotes",
        "security": [
          {},
          {
            "sacpSignature": []
          },
          {
            "sacpMtls": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SacpAgentId"
          },
          {
            "$ref": "#/components/parameters/SacpAgentPhase"
          },
          {
            "$ref": "#/components/parameters/SacpCheckoutMode"
          },
          {
            "$ref": "#/components/parameters/SacpVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKeyOptional"
          },
          {
            "$ref": "#/components/parameters/SignatureInput"
          },
          {
            "$ref": "#/components/parameters/Signature"
          },
          {
            "$ref": "#/components/parameters/ContentDigest"
          },
          {
            "$ref": "#/components/parameters/SignatureAgent"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ShippingQuoteRequest"
              },
              "example": {
                "agent": {
                  "id": "agent:buyer-agent-7",
                  "name": "Example Buyer Agent",
                  "agent_phase": "shopping",
                  "checkout_mode": "human_handoff"
                },
                "items": [
                  {
                    "id": "sku-1042",
                    "qty": 1
                  }
                ],
                "destination": {
                  "country": "SE",
                  "postcode": "11122"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Shipping options.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "SACP-Version": {
                "$ref": "#/components/headers/SacpVersion"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingQuoteResponse"
                },
                "example": {
                  "options": [
                    {
                      "method": "home-delivery",
                      "carrier": "Example Carrier",
                      "cost": {
                        "amount": "59.00",
                        "currency": "SEK"
                      },
                      "eta_date": "2026-12-09"
                    }
                  ],
                  "valid_until": "2026-12-04T09:15:00Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/negotiation/offer": {
      "post": {
        "operationId": "negotiateOffer",
        "tags": [
          "Shopping"
        ],
        "summary": "Negotiate an offer",
        "description": "A counter-offer or acceptance. It does not create an order.",
        "security": [
          {},
          {
            "sacpSignature": []
          },
          {
            "sacpMtls": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SacpAgentId"
          },
          {
            "$ref": "#/components/parameters/SacpAgentPhase"
          },
          {
            "$ref": "#/components/parameters/SacpCheckoutMode"
          },
          {
            "$ref": "#/components/parameters/SacpVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKeyOptional"
          },
          {
            "$ref": "#/components/parameters/SignatureInput"
          },
          {
            "$ref": "#/components/parameters/Signature"
          },
          {
            "$ref": "#/components/parameters/ContentDigest"
          },
          {
            "$ref": "#/components/parameters/SignatureAgent"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OfferRequest"
              },
              "example": {
                "agent": {
                  "id": "agent:buyer-agent-7",
                  "name": "Example Buyer Agent",
                  "agent_phase": "shopping",
                  "checkout_mode": "human_handoff"
                },
                "item": {
                  "id": "sku-1042",
                  "qty": 1
                },
                "proposal": {
                  "unit_price": {
                    "amount": "1200.00",
                    "currency": "SEK"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The answer to the offer. No order is created.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "SACP-Version": {
                "$ref": "#/components/headers/SacpVersion"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OfferResponse"
                },
                "example": {
                  "status": "countered",
                  "counter": {
                    "unit_price": {
                      "amount": "1250.00",
                      "currency": "SEK"
                    }
                  },
                  "valid_until": "2026-12-04T09:15:00Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/collection/items": {
      "post": {
        "operationId": "collectItems",
        "tags": [
          "Shopping"
        ],
        "summary": "Collect items",
        "description": "Builds a collection (a cart). It does not create an order.",
        "security": [
          {},
          {
            "sacpSignature": []
          },
          {
            "sacpMtls": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SacpAgentId"
          },
          {
            "$ref": "#/components/parameters/SacpAgentPhase"
          },
          {
            "$ref": "#/components/parameters/SacpCheckoutMode"
          },
          {
            "$ref": "#/components/parameters/SacpVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/SignatureInput"
          },
          {
            "$ref": "#/components/parameters/Signature"
          },
          {
            "$ref": "#/components/parameters/ContentDigest"
          },
          {
            "$ref": "#/components/parameters/SignatureAgent"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionRequest"
              },
              "example": {
                "agent": {
                  "id": "agent:buyer-agent-7",
                  "name": "Example Buyer Agent",
                  "agent_phase": "shopping",
                  "checkout_mode": "human_handoff"
                },
                "items": [
                  {
                    "id": "sku-1042",
                    "qty": 1
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The collection with current prices. No order is created.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "SACP-Version": {
                "$ref": "#/components/headers/SacpVersion"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionResponse"
                },
                "example": {
                  "collection_id": "col_31c8",
                  "items": [
                    {
                      "id": "sku-1042",
                      "qty": 1,
                      "unit_price": {
                        "amount": "1290.00",
                        "currency": "SEK"
                      }
                    }
                  ],
                  "subtotal": {
                    "amount": "1290.00",
                    "currency": "SEK"
                  },
                  "expires_at": "2026-12-04T09:30:00Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/checkout/prepare": {
      "post": {
        "operationId": "prepareCheckout",
        "tags": [
          "Checkout"
        ],
        "summary": "Prepare the purchase handoff",
        "description": "Creates a checkout resource. With human_handoff the answer carries a handoff URL and the status awaiting_human. With autonomous the status is ready_to_confirm and the agent calls confirm next. With approved_terms the shop re-quotes and compares the live terms with the approved snapshot (409 terms_changed on a material change). With authority it checks the mandate against the same terms (403, 428). A shop that advertises terms.binding or authority.mandate must follow https://standardagentcommerceprotocol.org/intent-binding/ and https://standardagentcommerceprotocol.org/authority/. When the shop advertises agent.lane, agent_phase must be checkout (https://standardagentcommerceprotocol.org/phases/). The call must be signed (RFC 9421) or sent over mutual TLS.",
        "security": [
          {
            "sacpSignature": []
          },
          {
            "sacpMtls": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SacpAgentId"
          },
          {
            "$ref": "#/components/parameters/SacpAgentPhase"
          },
          {
            "$ref": "#/components/parameters/SacpCheckoutMode"
          },
          {
            "$ref": "#/components/parameters/SacpVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/SignatureInput"
          },
          {
            "$ref": "#/components/parameters/Signature"
          },
          {
            "$ref": "#/components/parameters/ContentDigest"
          },
          {
            "$ref": "#/components/parameters/SignatureAgent"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrepareRequest"
              },
              "example": {
                "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"
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The checkout resource. No card number. No private key.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "SACP-Version": {
                "$ref": "#/components/headers/SacpVersion"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Checkout"
                },
                "example": {
                  "checkout_id": "co_7f3a91",
                  "status": "ready_to_confirm",
                  "created_at": "2026-12-04T09:01:12Z",
                  "expires_at": "2026-12-04T09:15:00Z",
                  "terms_hash": "sha256:8042bb8bd734bf15b1437a5630335263b0f6494700f4d92ef461049c1235f1fb",
                  "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": "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_check": {
                    "status": "match",
                    "terms_hash": "sha256:8042bb8bd734bf15b1437a5630335263b0f6494700f4d92ef461049c1235f1fb"
                  },
                  "agent_reference": {
                    "key_id": "dRkgvMoKa5Kry4nJd8QjnqBSOxvTzyWiXd9NVAFLYRQ",
                    "mandate_id": "mnd_2026_12_0042",
                    "checkout_id": "co_7f3a91",
                    "ref": "dRkgvMoKa5Kry4nJd8QjnqBSOxvTzyWiXd9NVAFLYRQ/mnd_2026_12_0042/co_7f3a91"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "428": {
            "$ref": "#/components/responses/PreconditionRequired"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/checkout/{checkout_id}": {
      "get": {
        "operationId": "getCheckout",
        "tags": [
          "Checkout"
        ],
        "summary": "Read a checkout",
        "description": "Status of a prepared checkout. Poll with If-None-Match, or listen to the webhook. The ETag is the value for If-Match on confirm.",
        "security": [
          {
            "sacpSignature": []
          },
          {
            "sacpMtls": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CheckoutId"
          },
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/SacpAgentId"
          },
          {
            "$ref": "#/components/parameters/SacpAgentPhase"
          },
          {
            "$ref": "#/components/parameters/SacpCheckoutMode"
          },
          {
            "$ref": "#/components/parameters/SacpVersion"
          },
          {
            "$ref": "#/components/parameters/SignatureInput"
          },
          {
            "$ref": "#/components/parameters/Signature"
          },
          {
            "$ref": "#/components/parameters/ContentDigest"
          },
          {
            "$ref": "#/components/parameters/SignatureAgent"
          }
        ],
        "responses": {
          "200": {
            "description": "The checkout.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "SACP-Version": {
                "$ref": "#/components/headers/SacpVersion"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Checkout"
                },
                "example": {
                  "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"
                  }
                }
              }
            }
          },
          "304": {
            "description": "Not modified."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/checkout/{checkout_id}/confirm": {
      "post": {
        "operationId": "confirmCheckout",
        "tags": [
          "Checkout"
        ],
        "summary": "Confirm an autonomous checkout",
        "description": "Commits an order. Only for a checkout prepared with checkout_mode autonomous, and only when the shop advertises checkout.autonomous. The shop checks, in this order: signature, Idempotency-Key, If-Match (412), state (409 checkout_state_conflict, 410), the live terms against terms_hash (409 terms_changed), and the mandate (403, 428). Nothing is confirmed unless all pass. The call is idempotent for the same Idempotency-Key.",
        "security": [
          {
            "sacpSignature": []
          },
          {
            "sacpMtls": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CheckoutId"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/SacpAgentId"
          },
          {
            "$ref": "#/components/parameters/SacpAgentPhase"
          },
          {
            "$ref": "#/components/parameters/SacpCheckoutMode"
          },
          {
            "$ref": "#/components/parameters/SacpVersion"
          },
          {
            "$ref": "#/components/parameters/SignatureInput"
          },
          {
            "$ref": "#/components/parameters/Signature"
          },
          {
            "$ref": "#/components/parameters/ContentDigest"
          },
          {
            "$ref": "#/components/parameters/SignatureAgent"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfirmRequest"
              },
              "example": {
                "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"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The checkout with status confirmed and an order.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "SACP-Version": {
                "$ref": "#/components/headers/SacpVersion"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Checkout"
                },
                "example": {
                  "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"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "428": {
            "$ref": "#/components/responses/PreconditionRequired"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/checkout/{checkout_id}/cancel": {
      "post": {
        "operationId": "cancelCheckout",
        "tags": [
          "Checkout"
        ],
        "summary": "Cancel a checkout",
        "description": "Cancels a checkout that is not confirmed. Idempotent. A confirmed checkout answers 409 checkout_state_conflict.",
        "security": [
          {
            "sacpSignature": []
          },
          {
            "sacpMtls": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CheckoutId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/SacpAgentId"
          },
          {
            "$ref": "#/components/parameters/SacpAgentPhase"
          },
          {
            "$ref": "#/components/parameters/SacpCheckoutMode"
          },
          {
            "$ref": "#/components/parameters/SacpVersion"
          },
          {
            "$ref": "#/components/parameters/SignatureInput"
          },
          {
            "$ref": "#/components/parameters/Signature"
          },
          {
            "$ref": "#/components/parameters/ContentDigest"
          },
          {
            "$ref": "#/components/parameters/SignatureAgent"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The checkout with status cancelled.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "SACP-Version": {
                "$ref": "#/components/headers/SacpVersion"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Checkout"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    }
  },
  "webhooks": {
    "checkoutEvent": {
      "post": {
        "operationId": "receiveCheckoutEvent",
        "tags": [
          "Webhooks"
        ],
        "summary": "Checkout event (shop to agent)",
        "description": "The shop calls the webhook URL the agent gave in POST /checkout/prepare. The shop signs the call with RFC 9421 and its key from jwks_uri (tag sacp-webhook-1). Delivery is at least once. The receiver verifies the signature, deduplicates on SACP-Webhook-Id, answers 2xx within 10 seconds, and reads the checkout again with GET when order matters.",
        "security": [
          {
            "sacpWebhookSignature": []
          }
        ],
        "parameters": [
          {
            "name": "SACP-Webhook-Id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/SignatureInput"
          },
          {
            "$ref": "#/components/parameters/Signature"
          },
          {
            "$ref": "#/components/parameters/ContentDigest"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              },
              "example": {
                "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"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Received. Any 2xx counts as received."
          },
          "400": {
            "description": "Rejected. The shop does not retry a 4xx other than 408, 425 and 429."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "sacpSignature": {
        "type": "apiKey",
        "in": "header",
        "name": "Signature",
        "description": "HTTP Message Signatures (RFC 9421). The Signature header is used together with Signature-Input and Content-Digest. The key id is the RFC 7638 thumbprint of the agent key. tag=\"sacp-1\". See https://standardagentcommerceprotocol.org/api/#identification ."
      },
      "sacpMtls": {
        "type": "mutualTLS",
        "description": "Mutual TLS (RFC 8705 style certificate bound identity). An alternative to the signature for enterprise agents."
      },
      "sacpWebhookSignature": {
        "type": "apiKey",
        "in": "header",
        "name": "Signature",
        "description": "RFC 9421 signature by the shop key, tag=\"sacp-webhook-1\"."
      }
    },
    "parameters": {
      "SacpAgentId": {
        "name": "SACP-Agent-Id",
        "in": "header",
        "required": false,
        "description": "Stable agent identifier. Required on every request when the shop advertises agent.lane. Equivalent to agent.id in a POST body. When the call is signed the value is a covered component, so the shop can bind it to the key.",
        "schema": {
          "type": "string"
        }
      },
      "SacpAgentPhase": {
        "name": "SACP-Agent-Phase",
        "in": "header",
        "required": false,
        "description": "shopping or checkout. Required on every request when the shop advertises agent.lane. Equivalent to agent.agent_phase. GET requests declare the phase only with this header. See https://standardagentcommerceprotocol.org/phases/.",
        "schema": {
          "type": "string",
          "enum": [
            "shopping",
            "checkout"
          ]
        }
      },
      "SacpCheckoutMode": {
        "name": "SACP-Checkout-Mode",
        "in": "header",
        "required": false,
        "description": "human_handoff or autonomous. Required when SACP-Agent-Phase is checkout. Equivalent to agent.checkout_mode.",
        "schema": {
          "type": "string",
          "enum": [
            "human_handoff",
            "autonomous"
          ]
        }
      },
      "SacpVersion": {
        "name": "SACP-Version",
        "in": "header",
        "required": false,
        "description": "Minor version the agent was written for, for example 1.3. A shop that cannot serve it answers 400 version_unsupported. Without the header the shop serves its latest minor version of the major version in the URL.",
        "schema": {
          "type": "string",
          "pattern": "^[0-9]+\\.[0-9]+$"
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "RFC 9651 Structured Field String, in double quotes, 16 to 255 characters. A random UUID is recommended. Unique per logical request and per agent.",
        "schema": {
          "type": "string",
          "minLength": 18,
          "maxLength": 257
        },
        "example": "\"8e03978e-40d5-43e8-bc93-6894a57f9324\""
      },
      "IdempotencyKeyOptional": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Same format as for the required form. The shop SHOULD honor it.",
        "schema": {
          "type": "string",
          "minLength": 18,
          "maxLength": 257
        }
      },
      "IfMatch": {
        "name": "If-Match",
        "in": "header",
        "required": true,
        "description": "The ETag the agent read from the checkout (RFC 9110). A mismatch answers 412 precondition_failed. A missing header answers 428 precondition_required.",
        "schema": {
          "type": "string"
        }
      },
      "Signature": {
        "name": "Signature",
        "in": "header",
        "required": false,
        "description": "RFC 9421 Signature field.",
        "schema": {
          "type": "string"
        }
      },
      "SignatureInput": {
        "name": "Signature-Input",
        "in": "header",
        "required": false,
        "description": "RFC 9421 Signature-Input field. Covered components, created, expires, nonce, keyid, alg and tag=\"sacp-1\".",
        "schema": {
          "type": "string"
        }
      },
      "SignatureAgent": {
        "name": "Signature-Agent",
        "in": "header",
        "required": false,
        "description": "HTTPS URL of the agent key directory (a JWKS). Optional. Draft practice from the web bot auth work in the IETF.",
        "schema": {
          "type": "string",
          "format": "uri"
        }
      },
      "ContentDigest": {
        "name": "Content-Digest",
        "in": "header",
        "required": false,
        "description": "RFC 9530 digest of the body, sha-256. Covered by the signature on every POST.",
        "schema": {
          "type": "string"
        }
      },
      "CheckoutId": {
        "name": "checkout_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      }
    },
    "headers": {
      "SacpVersion": {
        "description": "Minor version that produced the answer.",
        "schema": {
          "type": "string",
          "example": "1.3"
        }
      },
      "ETag": {
        "description": "Strong entity tag of the checkout. It changes when terms_hash, status or expires_at changes.",
        "schema": {
          "type": "string"
        }
      },
      "RateLimit": {
        "description": "IETF RateLimit header field (draft). Remaining quota and seconds until reset, for example \"checkout\";r=7;t=42.",
        "schema": {
          "type": "string"
        }
      },
      "RateLimitPolicy": {
        "description": "IETF RateLimit-Policy header field (draft). Quota and window, for example \"checkout\";q=10;w=60.",
        "schema": {
          "type": "string"
        }
      },
      "RetryAfter": {
        "description": "Seconds to wait (RFC 9110).",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "IdempotentReplayed": {
        "description": "true when the answer is a stored replay of the first request with this Idempotency-Key.",
        "schema": {
          "type": "string",
          "enum": [
            "true"
          ]
        }
      },
      "AcceptSignature": {
        "description": "RFC 9421 Accept-Signature. The signature parameters the shop requires.",
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "InvalidRequest": {
        "description": "invalid_request, validation_failed, version_unsupported, idempotency_key_missing or a phase error (phase_mismatch, phase_undeclared, phase_conflict).",
        "content": {
          "application/problem+json": {
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/ProblemPhase"
                },
                {
                  "$ref": "#/components/schemas/Problem"
                }
              ]
            },
            "example": {
              "type": "https://standardagentcommerceprotocol.org/api/#err-phase_mismatch",
              "title": "Phase mismatch",
              "status": 400,
              "code": "phase_mismatch",
              "instance": "/checkout/prepare",
              "retryable": false,
              "declared": "shopping",
              "required": "checkout",
              "path": "/checkout/prepare"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "signature_required, signature_invalid, signature_expired or replay_detected.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "example": {
              "type": "https://standardagentcommerceprotocol.org/api/#err-signature_required",
              "title": "Signature required",
              "status": 401,
              "code": "signature_required",
              "retryable": false
            }
          }
        },
        "headers": {
          "Accept-Signature": {
            "$ref": "#/components/headers/AcceptSignature"
          }
        }
      },
      "Forbidden": {
        "description": "authority_denied or autonomous_not_offered.",
        "content": {
          "application/problem+json": {
            "schema": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/ProblemAuthorityDenied"
                },
                {
                  "$ref": "#/components/schemas/ProblemAutonomousNotOffered"
                }
              ]
            },
            "example": {
              "type": "https://standardagentcommerceprotocol.org/api/#err-autonomous_not_offered",
              "title": "Autonomous checkout not offered",
              "status": 403,
              "code": "autonomous_not_offered",
              "retryable": false,
              "checkout_mode": "autonomous"
            }
          }
        }
      },
      "NotFound": {
        "description": "not_found.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "example": {
              "type": "https://standardagentcommerceprotocol.org/api/#err-not_found",
              "title": "Not found",
              "status": 404,
              "code": "not_found",
              "retryable": false
            }
          }
        }
      },
      "Conflict": {
        "description": "terms_changed, idempotency_in_progress or checkout_state_conflict.",
        "content": {
          "application/problem+json": {
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/ProblemTermsChanged"
                },
                {
                  "$ref": "#/components/schemas/Problem"
                }
              ]
            },
            "example": {
              "type": "https://standardagentcommerceprotocol.org/api/#err-idempotency_in_progress",
              "title": "Idempotency in progress",
              "status": 409,
              "code": "idempotency_in_progress",
              "retryable": true,
              "retry_after_seconds": 2
            }
          }
        },
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        }
      },
      "Gone": {
        "description": "checkout_expired.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "example": {
              "type": "https://standardagentcommerceprotocol.org/api/#err-checkout_expired",
              "title": "Checkout expired",
              "status": 410,
              "code": "checkout_expired",
              "retryable": false
            }
          }
        }
      },
      "PreconditionFailed": {
        "description": "precondition_failed. The checkout changed after the agent read it.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "example": {
              "type": "https://standardagentcommerceprotocol.org/api/#err-precondition_failed",
              "title": "Precondition failed",
              "status": 412,
              "code": "precondition_failed",
              "retryable": false
            }
          }
        }
      },
      "Unprocessable": {
        "description": "validation_failed or idempotency_key_reuse.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "example": {
              "type": "https://standardagentcommerceprotocol.org/api/#err-validation_failed",
              "title": "Validation failed",
              "status": 422,
              "code": "validation_failed",
              "retryable": false,
              "errors": [
                {
                  "pointer": "/items/0/qty",
                  "detail": "Must be at least 1."
                }
              ]
            }
          }
        }
      },
      "PreconditionRequired": {
        "description": "approval_required or precondition_required.",
        "content": {
          "application/problem+json": {
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/ProblemApprovalRequired"
                },
                {
                  "$ref": "#/components/schemas/Problem"
                }
              ]
            },
            "example": {
              "type": "https://standardagentcommerceprotocol.org/api/#err-precondition_required",
              "title": "Precondition required",
              "status": 428,
              "code": "precondition_required",
              "retryable": false
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "rate_limited.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemRateLimited"
            },
            "example": {
              "type": "https://standardagentcommerceprotocol.org/api/#err-rate_limited",
              "title": "Rate limited",
              "status": 429,
              "code": "rate_limited",
              "retryable": true,
              "agent_phase": "shopping",
              "retry_after_seconds": 30
            }
          }
        },
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          },
          "RateLimit": {
            "$ref": "#/components/headers/RateLimit"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          }
        }
      },
      "ServerError": {
        "description": "internal_error or service_unavailable.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "example": {
              "type": "https://standardagentcommerceprotocol.org/api/#err-service_unavailable",
              "title": "Service unavailable",
              "status": 503,
              "code": "service_unavailable",
              "retryable": true,
              "retry_after_seconds": 60
            }
          }
        },
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        }
      }
    },
    "schemas": {
      "Problem": {
        "title": "SACP problem details",
        "description": "RFC 9457 problem details as used by the SACP REST profile. Media type application/problem+json. Added in SACP 1.3.0-draft. Code specific members are defined in checkout-outcomes.schema.json and agent-lane-outcomes.schema.json.",
        "type": "object",
        "required": [
          "type",
          "title",
          "status",
          "code"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "description": "URI that identifies the problem type. For SACP codes it is https://standardagentcommerceprotocol.org/api/#err-{code}."
          },
          "title": {
            "type": "string",
            "description": "Short summary. The same for every occurrence of the code."
          },
          "status": {
            "type": "integer",
            "minimum": 400,
            "maximum": 599
          },
          "detail": {
            "type": "string",
            "description": "Explanation of this occurrence. No personal data, no secrets."
          },
          "instance": {
            "type": "string",
            "format": "uri-reference"
          },
          "code": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]*$",
            "description": "Stable SACP error code from the registry."
          },
          "trace_id": {
            "type": "string",
            "maxLength": 128,
            "description": "Opaque id the shop can find in its logs."
          },
          "retryable": {
            "type": "boolean"
          },
          "retry_after_seconds": {
            "type": "integer",
            "minimum": 0
          },
          "errors": {
            "type": "array",
            "description": "Used by validation_failed.",
            "items": {
              "type": "object",
              "required": [
                "pointer",
                "detail"
              ],
              "additionalProperties": false,
              "properties": {
                "pointer": {
                  "type": "string",
                  "description": "JSON Pointer (RFC 6901) to the value."
                },
                "detail": {
                  "type": "string"
                }
              }
            }
          },
          "supported_versions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Used by version_unsupported."
          }
        },
        "additionalProperties": true
      },
      "ProblemTermsChanged": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "$ref": "https://standardagentcommerceprotocol.org/schemas/checkout-outcomes.schema.json#/$defs/TermsChanged"
          }
        ]
      },
      "ProblemApprovalRequired": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "$ref": "https://standardagentcommerceprotocol.org/schemas/checkout-outcomes.schema.json#/$defs/ApprovalRequired"
          }
        ]
      },
      "ProblemAuthorityDenied": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "$ref": "https://standardagentcommerceprotocol.org/schemas/checkout-outcomes.schema.json#/$defs/AuthorityDenied"
          }
        ]
      },
      "ProblemRateLimited": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "$ref": "https://standardagentcommerceprotocol.org/schemas/agent-lane-outcomes.schema.json#/$defs/RateLimited"
          }
        ]
      },
      "ProblemPhase": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "oneOf": [
              {
                "$ref": "https://standardagentcommerceprotocol.org/schemas/agent-lane-outcomes.schema.json#/$defs/PhaseMismatch"
              },
              {
                "$ref": "https://standardagentcommerceprotocol.org/schemas/agent-lane-outcomes.schema.json#/$defs/PhaseUndeclared"
              },
              {
                "$ref": "https://standardagentcommerceprotocol.org/schemas/agent-lane-outcomes.schema.json#/$defs/PhaseConflict"
              }
            ]
          }
        ]
      },
      "ProblemAutonomousNotOffered": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "$ref": "https://standardagentcommerceprotocol.org/schemas/agent-lane-outcomes.schema.json#/$defs/AutonomousNotOffered"
          }
        ]
      },
      "Money": {
        "$ref": "https://standardagentcommerceprotocol.org/schemas/rest.schema.json#/$defs/Money"
      },
      "Product": {
        "$ref": "https://standardagentcommerceprotocol.org/schemas/rest.schema.json#/$defs/Product"
      },
      "ProductList": {
        "$ref": "https://standardagentcommerceprotocol.org/schemas/rest.schema.json#/$defs/ProductList"
      },
      "SearchRequest": {
        "$ref": "https://standardagentcommerceprotocol.org/schemas/rest.schema.json#/$defs/SearchRequest"
      },
      "ShippingQuoteRequest": {
        "$ref": "https://standardagentcommerceprotocol.org/schemas/rest.schema.json#/$defs/ShippingQuoteRequest"
      },
      "ShippingQuoteResponse": {
        "$ref": "https://standardagentcommerceprotocol.org/schemas/rest.schema.json#/$defs/ShippingQuoteResponse"
      },
      "OfferRequest": {
        "$ref": "https://standardagentcommerceprotocol.org/schemas/rest.schema.json#/$defs/OfferRequest"
      },
      "OfferResponse": {
        "$ref": "https://standardagentcommerceprotocol.org/schemas/rest.schema.json#/$defs/OfferResponse"
      },
      "CollectionRequest": {
        "$ref": "https://standardagentcommerceprotocol.org/schemas/rest.schema.json#/$defs/CollectionRequest"
      },
      "CollectionResponse": {
        "$ref": "https://standardagentcommerceprotocol.org/schemas/rest.schema.json#/$defs/CollectionResponse"
      },
      "PrepareRequest": {
        "$ref": "https://standardagentcommerceprotocol.org/schemas/rest.schema.json#/$defs/PrepareRequest"
      },
      "Checkout": {
        "$ref": "https://standardagentcommerceprotocol.org/schemas/rest.schema.json#/$defs/Checkout"
      },
      "ConfirmRequest": {
        "$ref": "https://standardagentcommerceprotocol.org/schemas/rest.schema.json#/$defs/ConfirmRequest"
      },
      "CancelRequest": {
        "$ref": "https://standardagentcommerceprotocol.org/schemas/rest.schema.json#/$defs/CancelRequest"
      },
      "WebhookEvent": {
        "$ref": "https://standardagentcommerceprotocol.org/schemas/rest.schema.json#/$defs/WebhookEvent"
      },
      "Jwks": {
        "$ref": "https://standardagentcommerceprotocol.org/schemas/rest.schema.json#/$defs/Jwks"
      },
      "DiscoveryDocument": {
        "$ref": "https://standardagentcommerceprotocol.org/schemas/discovery.schema.json"
      }
    }
  }
}
