{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agentictradestandard.org/schemas/discovery.schema.json",
  "title": "SACP discovery document",
  "description": "Shop discovery document served at /.well-known/sacp.json (alias /.well-known/agent-commerce). Added in SACP 1.3.0-draft. Unknown members are allowed so that extensions do not break clients.",
  "type": "object",
  "required": [
    "protocol",
    "version",
    "capabilities",
    "endpoints"
  ],
  "properties": {
    "protocol": {
      "const": "sacp"
    },
    "version": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(-draft)?$"
    },
    "name": {
      "type": "string"
    },
    "capabilities": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[a-z]+(\\.[a-z_]+)+$"
      },
      "uniqueItems": true
    },
    "endpoints": {
      "type": "object",
      "additionalProperties": {
        "type": "string",
        "pattern": "^/"
      }
    },
    "payment_handoff": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "identity_handoff": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "extensions": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "rest": {
          "type": "object",
          "required": [
            "profile",
            "level"
          ],
          "properties": {
            "profile": {
              "type": "string",
              "description": "REST profile version, for example 1.3."
            },
            "level": {
              "enum": [
                "rest-core",
                "rest-checkout",
                "rest-enterprise"
              ]
            },
            "versions": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Major versions served, for example [\"1\"]."
            },
            "openapi": {
              "type": "string",
              "format": "uri"
            },
            "jwks_uri": {
              "type": "string"
            },
            "signature": {
              "type": "object",
              "properties": {
                "algorithms": {
                  "type": "array",
                  "items": {
                    "enum": [
                      "ed25519",
                      "ecdsa-p256-sha256"
                    ]
                  }
                },
                "required_for": {
                  "type": "array",
                  "items": {
                    "enum": [
                      "shopping",
                      "checkout"
                    ]
                  }
                },
                "max_clock_skew_seconds": {
                  "type": "integer",
                  "maximum": 60
                },
                "max_validity_seconds": {
                  "type": "integer",
                  "maximum": 300
                },
                "mtls": {
                  "type": "boolean"
                }
              }
            },
            "idempotency": {
              "type": "object",
              "properties": {
                "retention_seconds": {
                  "type": "integer",
                  "minimum": 86400
                }
              }
            },
            "pagination": {
              "type": "object",
              "properties": {
                "max_limit": {
                  "type": "integer"
                },
                "default_limit": {
                  "type": "integer"
                }
              }
            },
            "max_body_bytes": {
              "type": "integer"
            },
            "webhooks": {
              "type": "boolean"
            }
          }
        }
      }
    }
  },
  "additionalProperties": true
}
