{
  "openapi": "3.0.3",
  "info": {
    "title": "instaClaim Public API",
    "version": "1.0.0",
    "description": "External developer API for instaClaim (api.instaclaim.app). Authenticate with X-API-Key using pk_test_* or pk_live_* keys. Write routes require an Idempotency-Key header."
  },
  "servers": [
    {
      "url": "https://api.instaclaim.app"
    }
  ],
  "paths": {
    "/v1": {
      "get": {
        "operationId": "getCapabilities",
        "summary": "Get API capabilities",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "API version and capability catalog"
          },
          "401": {
            "description": "Missing or invalid API key"
          }
        },
        "x-required-scopes": []
      }
    },
    "/v1/auth/context": {
      "get": {
        "operationId": "getAuthContext",
        "summary": "Get authenticated API key context",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Authenticated key context"
          },
          "401": {
            "description": "Missing or invalid API key"
          }
        },
        "x-required-scopes": []
      }
    },
    "/v1/claim-projects": {
      "get": {
        "operationId": "listClaimProjects",
        "summary": "List claim projects",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "active",
                "archived"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON response"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "403": {
            "description": "Insufficient scope"
          }
        },
        "x-required-scopes": [
          "claim_projects:read"
        ]
      },
      "post": {
        "operationId": "createClaimProject",
        "summary": "Create claim project",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "periodStart",
                  "periodEnd"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "clientReference": {
                    "type": "string",
                    "maxLength": 200,
                    "nullable": true
                  },
                  "periodStart": {
                    "type": "string",
                    "format": "date"
                  },
                  "periodEnd": {
                    "type": "string",
                    "format": "date"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "draft",
                      "active",
                      "archived"
                    ]
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": true
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created claim project"
          },
          "400": {
            "description": "Invalid request body or missing idempotency key"
          },
          "403": {
            "description": "Insufficient scope"
          },
          "409": {
            "description": "Idempotency key or unique project conflict"
          }
        },
        "x-required-scopes": [
          "claim_projects:write"
        ]
      }
    },
    "/v1/claim-projects/{project_id}": {
      "get": {
        "operationId": "getClaimProject",
        "summary": "Get claim project by ID",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "project_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON response"
          },
          "404": {
            "description": "Claim project not found"
          }
        },
        "x-required-scopes": [
          "claim_projects:read"
        ]
      },
      "patch": {
        "operationId": "updateClaimProject",
        "summary": "Update claim project by ID",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "project_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "clientReference": {
                    "type": "string",
                    "maxLength": 200,
                    "nullable": true
                  },
                  "periodStart": {
                    "type": "string",
                    "format": "date"
                  },
                  "periodEnd": {
                    "type": "string",
                    "format": "date"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "draft",
                      "active",
                      "archived"
                    ]
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": true
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON response"
          },
          "400": {
            "description": "Invalid request body or missing idempotency key"
          },
          "404": {
            "description": "Claim project not found"
          },
          "409": {
            "description": "Idempotency key or unique project conflict"
          }
        },
        "x-required-scopes": [
          "claim_projects:write"
        ]
      }
    },
    "/v1/expense-categories": {
      "get": {
        "operationId": "listExpenseCategories",
        "summary": "List expense categories",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "project_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "archived"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON response"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "403": {
            "description": "Insufficient scope"
          }
        },
        "x-required-scopes": [
          "expense_categories:read"
        ]
      },
      "post": {
        "operationId": "createExpenseCategory",
        "summary": "Create expense category",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "code",
                  "name"
                ],
                "properties": {
                  "projectId": {
                    "type": "string",
                    "format": "uuid",
                    "nullable": true
                  },
                  "code": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "sourceProvider": {
                    "type": "string",
                    "enum": [
                      "manual"
                    ],
                    "description": "Manual only until Xero and QuickBooks adapters are verified."
                  },
                  "sourceMapping": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "archived"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created expense category"
          },
          "400": {
            "description": "Invalid request body or related project"
          },
          "403": {
            "description": "Insufficient scope"
          },
          "409": {
            "description": "Idempotency key or unique category conflict"
          }
        },
        "x-required-scopes": [
          "expense_categories:write"
        ]
      }
    },
    "/v1/expense-categories/{category_id}": {
      "get": {
        "operationId": "getExpenseCategory",
        "summary": "Get expense category by ID",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "category_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON response"
          },
          "404": {
            "description": "Expense category not found"
          }
        },
        "x-required-scopes": [
          "expense_categories:read"
        ]
      },
      "patch": {
        "operationId": "updateExpenseCategory",
        "summary": "Update expense category by ID",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "category_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "projectId": {
                    "type": "string",
                    "format": "uuid",
                    "nullable": true
                  },
                  "code": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "sourceProvider": {
                    "type": "string",
                    "enum": [
                      "manual"
                    ],
                    "description": "Manual only until Xero and QuickBooks adapters are verified."
                  },
                  "sourceMapping": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "archived"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON response"
          },
          "400": {
            "description": "Invalid request body or related project"
          },
          "404": {
            "description": "Expense category not found"
          },
          "409": {
            "description": "Idempotency key or unique category conflict"
          }
        },
        "x-required-scopes": [
          "expense_categories:write"
        ]
      }
    },
    "/v1/report-configurations": {
      "get": {
        "operationId": "listReportConfigurations",
        "summary": "List report configurations",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "project_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "ready",
                "archived"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON response"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "403": {
            "description": "Insufficient scope"
          }
        },
        "x-required-scopes": [
          "report_configurations:read"
        ]
      },
      "post": {
        "operationId": "createReportConfiguration",
        "summary": "Create report configuration",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "periodStart",
                  "periodEnd"
                ],
                "properties": {
                  "projectId": {
                    "type": "string",
                    "format": "uuid",
                    "nullable": true
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "accountingProvider": {
                    "type": "string",
                    "enum": [
                      "manual"
                    ],
                    "description": "Manual only until Xero and QuickBooks report adapters are verified."
                  },
                  "periodStart": {
                    "type": "string",
                    "format": "date"
                  },
                  "periodEnd": {
                    "type": "string",
                    "format": "date"
                  },
                  "categoryFilter": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "outputOptions": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "draft",
                      "ready",
                      "archived"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created report configuration"
          },
          "400": {
            "description": "Invalid request body or related project"
          },
          "403": {
            "description": "Insufficient scope"
          },
          "409": {
            "description": "Idempotency key conflict"
          }
        },
        "x-required-scopes": [
          "report_configurations:write"
        ]
      }
    },
    "/v1/report-configurations/{configuration_id}": {
      "get": {
        "operationId": "getReportConfiguration",
        "summary": "Get report configuration by ID",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "configuration_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON response"
          },
          "404": {
            "description": "Report configuration not found"
          }
        },
        "x-required-scopes": [
          "report_configurations:read"
        ]
      },
      "patch": {
        "operationId": "updateReportConfiguration",
        "summary": "Update report configuration by ID",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "configuration_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "projectId": {
                    "type": "string",
                    "format": "uuid",
                    "nullable": true
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "accountingProvider": {
                    "type": "string",
                    "enum": [
                      "manual"
                    ],
                    "description": "Manual only until Xero and QuickBooks report adapters are verified."
                  },
                  "periodStart": {
                    "type": "string",
                    "format": "date"
                  },
                  "periodEnd": {
                    "type": "string",
                    "format": "date"
                  },
                  "categoryFilter": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "outputOptions": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "draft",
                      "ready",
                      "archived"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON response"
          },
          "400": {
            "description": "Invalid request body or related project"
          },
          "404": {
            "description": "Report configuration not found"
          },
          "409": {
            "description": "Idempotency key conflict"
          }
        },
        "x-required-scopes": [
          "report_configurations:write"
        ]
      }
    },
    "/v1/claim-reports": {
      "get": {
        "operationId": "listClaimReports",
        "summary": "List claim report runs",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "project_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "report_configuration_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "running",
                "succeeded",
                "failed",
                "cancelled"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON response"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "403": {
            "description": "Insufficient scope"
          }
        },
        "x-required-scopes": [
          "claim_reports:read"
        ]
      },
      "post": {
        "operationId": "createClaimReport",
        "summary": "Queue claim report generation",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "projectId": {
                    "type": "string",
                    "format": "uuid",
                    "nullable": true
                  },
                  "reportConfigurationId": {
                    "type": "string",
                    "format": "uuid",
                    "nullable": true
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Queued claim report run"
          },
          "400": {
            "description": "Invalid request body or related resource"
          },
          "403": {
            "description": "Insufficient scope"
          },
          "409": {
            "description": "Idempotency key conflict"
          }
        },
        "x-required-scopes": [
          "claim_reports:write"
        ]
      }
    },
    "/v1/claim-reports/{report_id}": {
      "get": {
        "operationId": "getClaimReport",
        "summary": "Get claim report by ID",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "report_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON response"
          },
          "404": {
            "description": "Claim report not found"
          }
        },
        "x-required-scopes": [
          "claim_reports:read"
        ]
      }
    },
    "/v1/bank-statements": {
      "get": {
        "operationId": "listBankStatements",
        "summary": "List bank statement redaction metadata",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "project_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "redaction_status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "queued",
                "running",
                "succeeded",
                "failed",
                "skipped"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON response"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "403": {
            "description": "Insufficient scope"
          }
        },
        "x-required-scopes": [
          "bank_statements:read"
        ]
      }
    },
    "/v1/bank-statements/{statement_id}": {
      "get": {
        "operationId": "getBankStatement",
        "summary": "Get bank statement redaction metadata by ID",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "statement_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON response"
          },
          "404": {
            "description": "Bank statement not found"
          }
        },
        "x-required-scopes": [
          "bank_statements:read"
        ]
      }
    },
    "/v1/organization": {
      "get": {
        "operationId": "getOrganization",
        "summary": "Get organization profile",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "JSON response"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "403": {
            "description": "Insufficient scope"
          }
        },
        "x-required-scopes": [
          "organization:read"
        ]
      }
    },
    "/v1/usage": {
      "get": {
        "operationId": "getUsageSummary",
        "summary": "Get API usage summary",
        "description": "Returns tenant-scoped public API usage for the current billing period, including per-capability request counts and enforced rate-limit tier state.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "JSON response"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "403": {
            "description": "Insufficient scope"
          }
        },
        "x-required-scopes": [
          "usage:read"
        ]
      }
    },
    "/v1/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "summary": "List webhooks",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook list"
          },
          "403": {
            "description": "Insufficient scope or Enterprise plan required"
          }
        },
        "x-required-scopes": [
          "webhooks:read"
        ]
      },
      "post": {
        "operationId": "createWebhook",
        "summary": "Create webhook",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Created webhook (signing secret returned once)"
          },
          "400": {
            "description": "Invalid request body"
          },
          "403": {
            "description": "Insufficient scope or Enterprise plan required"
          }
        },
        "x-required-scopes": [
          "webhooks:write"
        ]
      }
    },
    "/v1/webhooks/{webhook_id}": {
      "get": {
        "operationId": "getWebhook",
        "summary": "Get webhook by ID",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "webhook_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook details"
          },
          "404": {
            "description": "Webhook not found"
          }
        },
        "x-required-scopes": [
          "webhooks:read"
        ]
      },
      "patch": {
        "operationId": "updateWebhook",
        "summary": "Update webhook by ID",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "webhook_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated webhook"
          },
          "404": {
            "description": "Webhook not found"
          }
        },
        "x-required-scopes": [
          "webhooks:write"
        ]
      },
      "delete": {
        "operationId": "deleteWebhook",
        "summary": "Delete webhook by ID",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "webhook_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Webhook deleted"
          },
          "404": {
            "description": "Webhook not found"
          }
        },
        "x-required-scopes": [
          "webhooks:delete"
        ]
      }
    },
    "/v1/webhooks/{webhook_id}/deliveries": {
      "get": {
        "operationId": "listWebhookDeliveries",
        "summary": "List webhook delivery attempts",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "webhook_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "delivered",
                "failed"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated delivery log without payload body"
          },
          "404": {
            "description": "Webhook not found"
          }
        },
        "x-required-scopes": [
          "webhooks:deliveries:read"
        ]
      }
    },
    "/v1/audit/events": {
      "get": {
        "operationId": "listAuditEvents",
        "summary": "Export audit events (Enterprise)",
        "description": "Enterprise plan required. Requires audit:read scope. Per-key IP allowlist enforced when configured.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "until",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "action_prefix",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 120
            }
          },
          {
            "name": "actor_type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "user",
                "system",
                "api"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            }
          },
          {
            "name": "cursor_created_at",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "cursor_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON response"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "403": {
            "description": "Insufficient scope"
          }
        },
        "x-required-scopes": [
          "audit:read"
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    }
  }
}
