{
  "openapi": "3.1.0",
  "info": {
    "title": "ScopeProof API",
    "version": "0.1.0",
    "description": "Machine-verifiable authorization checks for autonomous agents before consequential actions."
  },
  "servers": [
    {
      "url": "https://scopeproof.davisvillelabs.com"
    }
  ],
  "paths": {
    "/v1/preflight": {
      "post": {
        "operationId": "scopeproof.preflight",
        "summary": "Validate a ScopeProof authority envelope without a substantive verdict",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "authority",
                  "action"
                ],
                "additionalProperties": false,
                "properties": {
                  "authority": {
                    "type": "object",
                    "required": [
                      "allowedActions",
                      "allowedResources"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "schemaVersion": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "principal": {
                        "type": "string",
                        "maxLength": 160
                      },
                      "issuedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "notBefore": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "expiresAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "allowedActions": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 64,
                        "items": {
                          "type": "string"
                        }
                      },
                      "deniedActions": {
                        "type": "array",
                        "maxItems": 64,
                        "items": {
                          "type": "string"
                        }
                      },
                      "allowedResources": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 64,
                        "items": {
                          "type": "string"
                        }
                      },
                      "deniedResources": {
                        "type": "array",
                        "maxItems": 64,
                        "items": {
                          "type": "string"
                        }
                      },
                      "methods": {
                        "type": "array",
                        "maxItems": 24,
                        "items": {
                          "type": "string"
                        }
                      },
                      "tools": {
                        "type": "array",
                        "maxItems": 64,
                        "items": {
                          "type": "string"
                        }
                      },
                      "environments": {
                        "type": "array",
                        "maxItems": 32,
                        "items": {
                          "type": "string"
                        }
                      },
                      "dataClasses": {
                        "type": "array",
                        "maxItems": 32,
                        "items": {
                          "type": "string"
                        }
                      },
                      "maxSpend": {
                        "type": "object",
                        "required": [
                          "amountMinor",
                          "currency"
                        ],
                        "additionalProperties": false,
                        "properties": {
                          "amountMinor": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          }
                        }
                      },
                      "allowDestructive": {
                        "type": "boolean"
                      },
                      "allowIrreversible": {
                        "type": "boolean"
                      },
                      "approvalRequiredFor": {
                        "type": "array",
                        "maxItems": 32,
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "action": {
                    "type": "object",
                    "required": [
                      "type",
                      "resource"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "type": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "resource": {
                        "type": "string",
                        "maxLength": 1024
                      },
                      "method": {
                        "type": "string",
                        "maxLength": 12
                      },
                      "tool": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "environment": {
                        "type": "string",
                        "maxLength": 80
                      },
                      "dataClass": {
                        "type": "string",
                        "maxLength": 80
                      },
                      "amount": {
                        "type": "object",
                        "required": [
                          "amountMinor",
                          "currency"
                        ],
                        "additionalProperties": false,
                        "properties": {
                          "amountMinor": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          }
                        }
                      },
                      "destructive": {
                        "type": "boolean",
                        "description": "Set true when the proposed action is destructive even if its action type or HTTP method is not intrinsically classified as destructive."
                      },
                      "irreversible": {
                        "type": "boolean"
                      }
                    }
                  },
                  "context": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "humanApprovalPresent": {
                        "type": "boolean",
                        "description": "Caller assertion that required human approval has already occurred. ScopeProof records this as caller-asserted and does not independently verify the human identity or approval event."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Preflight result"
          },
          "400": {
            "description": "Invalid input"
          }
        }
      }
    },
    "/v1/actions/check": {
      "post": {
        "operationId": "scopeproof.check_action",
        "summary": "Check whether one proposed action is within supplied authority",
        "description": "Paid $0.01 stablecoin operation. HTTP supports configured x402 and/or MPP Tempo.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "authority",
                  "action"
                ],
                "additionalProperties": false,
                "properties": {
                  "authority": {
                    "type": "object",
                    "required": [
                      "allowedActions",
                      "allowedResources"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "schemaVersion": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "principal": {
                        "type": "string",
                        "maxLength": 160
                      },
                      "issuedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "notBefore": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "expiresAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "allowedActions": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 64,
                        "items": {
                          "type": "string"
                        }
                      },
                      "deniedActions": {
                        "type": "array",
                        "maxItems": 64,
                        "items": {
                          "type": "string"
                        }
                      },
                      "allowedResources": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 64,
                        "items": {
                          "type": "string"
                        }
                      },
                      "deniedResources": {
                        "type": "array",
                        "maxItems": 64,
                        "items": {
                          "type": "string"
                        }
                      },
                      "methods": {
                        "type": "array",
                        "maxItems": 24,
                        "items": {
                          "type": "string"
                        }
                      },
                      "tools": {
                        "type": "array",
                        "maxItems": 64,
                        "items": {
                          "type": "string"
                        }
                      },
                      "environments": {
                        "type": "array",
                        "maxItems": 32,
                        "items": {
                          "type": "string"
                        }
                      },
                      "dataClasses": {
                        "type": "array",
                        "maxItems": 32,
                        "items": {
                          "type": "string"
                        }
                      },
                      "maxSpend": {
                        "type": "object",
                        "required": [
                          "amountMinor",
                          "currency"
                        ],
                        "additionalProperties": false,
                        "properties": {
                          "amountMinor": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          }
                        }
                      },
                      "allowDestructive": {
                        "type": "boolean"
                      },
                      "allowIrreversible": {
                        "type": "boolean"
                      },
                      "approvalRequiredFor": {
                        "type": "array",
                        "maxItems": 32,
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "action": {
                    "type": "object",
                    "required": [
                      "type",
                      "resource"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "type": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "resource": {
                        "type": "string",
                        "maxLength": 1024
                      },
                      "method": {
                        "type": "string",
                        "maxLength": 12
                      },
                      "tool": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "environment": {
                        "type": "string",
                        "maxLength": 80
                      },
                      "dataClass": {
                        "type": "string",
                        "maxLength": 80
                      },
                      "amount": {
                        "type": "object",
                        "required": [
                          "amountMinor",
                          "currency"
                        ],
                        "additionalProperties": false,
                        "properties": {
                          "amountMinor": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          }
                        }
                      },
                      "destructive": {
                        "type": "boolean",
                        "description": "Set true when the proposed action is destructive even if its action type or HTTP method is not intrinsically classified as destructive."
                      },
                      "irreversible": {
                        "type": "boolean"
                      }
                    }
                  },
                  "context": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "humanApprovalPresent": {
                        "type": "boolean",
                        "description": "Caller assertion that required human approval has already occurred. ScopeProof records this as caller-asserted and does not independently verify the human identity or approval event."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorization decision and receipt"
          },
          "402": {
            "description": "Machine payment required"
          },
          "422": {
            "description": "Authority envelope insufficient"
          }
        }
      }
    },
    "/v1/receipts/verify": {
      "post": {
        "operationId": "scopeproof.verify_receipt",
        "summary": "Verify a ScopeProof receipt",
        "responses": {
          "200": {
            "description": "Receipt verification result"
          }
        }
      }
    },
    "/v1/capabilities": {
      "get": {
        "operationId": "scopeproof.capabilities",
        "responses": {
          "200": {
            "description": "Machine-readable capabilities"
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "scopeproof.health",
        "responses": {
          "200": {
            "description": "Health and runtime configuration"
          }
        }
      }
    }
  },
  "x-scopeproof-commerce": {
    "enabled": true,
    "durablePersistence": true,
    "operation": "scopeproof.check_action",
    "priceCents": 1,
    "currency": "USD",
    "stablecoinOnly": true,
    "methods": {
      "http": [
        "tempo",
        "x402"
      ],
      "mcp": [
        "tempo"
      ]
    }
  }
}