{
  "openapi": "3.1.0",
  "info": {
    "title": "AgentVerify Agent API",
    "version": "1.1.0",
    "description": "Structural screening for AI-assisted deliverables. One-time owner sign-in and credential provisioning, delegated JSON purchasing, hosted payment completion and entitlement polling. Never factual verification. Includes deterministic TableCheck quote-table arithmetic checks when the catalog capability is enabled. Shared paid quota; no original-source verification.",
    "termsOfService": "https://citevella.com/terms/",
    "contact": {
      "email": "support@citevella.com"
    }
  },
  "servers": [
    {
      "url": "https://agentverify-customers.pages.dev"
    }
  ],
  "paths": {
    "/api/v1/catalog": {
      "get": {
        "operationId": "listPlans",
        "description": "Current Stripe prices in minor currency units, subscription intervals, included quota, mode and California pilot restriction.",
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Catalog"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "405": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/account": {
      "get": {
        "operationId": "getAccount",
        "description": "Poll every 15 seconds after payment. paid_access=true reflects current stored entitlement and healthy billing recovery. Never infer access from a redirect.",
        "security": [
          {
            "agentKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "405": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "revokeCurrentKey",
        "description": "Immediately revoke the presented API key. Subsequent calls return 401.",
        "security": [
          {
            "agentKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Revocation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "405": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/checkout": {
      "post": {
        "operationId": "createCheckout",
        "description": "Requires purchase-enabled key. Accepts only a plan ID from catalog. No card data accepted. Returns requires_action, payment_action.open_url and status endpoint; a human or authorized payment-capable client completes hosted Checkout. Live pilot US-CA based on request geolocation; no x402/USDC support. Server-owned tenant checkout lock and Stripe idempotency prevent duplicate sessions. Reuse returned URL; 409 requires account review.",
        "security": [
          {
            "agentKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutAction"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "405": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "plan"
                ],
                "properties": {
                  "plan": {
                    "type": "string",
                    "enum": [
                      "starter",
                      "team"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/agent-review": {
      "post": {
        "operationId": "screenDeliverable",
        "description": "Structural screening only. Does not fetch URLs or verify facts. Maximum 12,000 UTF-8 bytes. Quota is shared with the customer workspace. A 201 is a new result; 200 is a replay. Use the same body and key when retrying; changed body gives 409.",
        "security": [
          {
            "agentKey": []
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScreeningResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "405": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          },
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScreeningResult"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "title",
                  "deliverable",
                  "evidence_urls",
                  "estimated_cost_cents",
                  "budget_cents"
                ],
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "deliverable": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 5000
                  },
                  "evidence_urls": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "string",
                      "format": "uri",
                      "maxLength": 2048
                    }
                  },
                  "estimated_cost_cents": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "budget_cents": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "example": {
                  "title": "Research brief",
                  "deliverable": "Draft ready for review",
                  "evidence_urls": [
                    "https://www.iana.org/domains/reserved"
                  ],
                  "estimated_cost_cents": 10,
                  "budget_cents": 100
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{12,128}$"
            }
          }
        ]
      }
    },
    "/api/customer-agent-keys": {
      "get": {
        "operationId": "listKeys",
        "description": "Verified owner Access JWT or browser session required. Returns metadata, never token hashes or secrets.",
        "security": [
          {
            "ownerAssertion": []
          },
          {
            "ownerCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "405": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createKey",
        "description": "Verified owner session required. One-time 256-bit key. Maximum 20 active keys per workspace. Keys may be issued before purchase.",
        "security": [
          {
            "ownerAssertion": []
          },
          {
            "ownerCookie": []
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyCreated"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "405": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "label",
                  "allow_purchases"
                ],
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "allow_purchases": {
                    "type": "boolean",
                    "description": "Explicit owner delegation to create recurring-subscription Checkout sessions. Defaults are not accepted."
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "revokeKey",
        "description": "Verified owner session required. Cannot revoke a key from another tenant.",
        "security": [
          {
            "ownerAssertion": []
          },
          {
            "ownerCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Revocation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "405": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "key_id"
                ],
                "properties": {
                  "key_id": {
                    "type": "string",
                    "maxLength": 128
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tablecheck": {
      "post": {
        "operationId": "checkQuoteTable",
        "description": "Deterministic internal arithmetic and row-ID consistency only. Does not fetch source data, approve invoices or prevent duplicate actions across runs. JSON only; max 60,000 UTF-8 bytes, 1\u2013100 rows. One new request consumes one shared plan unit even if findings are present. Exact same parsed JSON serialization plus Idempotency-Key replays the saved result without another unit. Different table under the same key returns 409. Requires active paid access, healthy billing and catalog capabilities.tablecheck=true.",
        "security": [
          {
            "agentKey": []
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TableCheckResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "405": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          },
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TableCheckResult"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TableCheckInput"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{12,128}$"
            }
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "agentKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "One-time key created by a verified workspace owner."
      },
      "ownerAssertion": {
        "type": "apiKey",
        "in": "header",
        "name": "Cf-Access-Jwt-Assertion",
        "description": "Signed JWT from the dedicated customer Access audience."
      },
      "ownerCookie": {
        "type": "apiKey",
        "in": "cookie",
        "name": "CF_Authorization"
      }
    },
    "schemas": {
      "ScreeningResult": {
        "type": "object",
        "required": [
          "request_id",
          "screening_score",
          "screening_status",
          "checks",
          "review_required",
          "limitations"
        ],
        "properties": {
          "request_id": {
            "type": "string"
          },
          "screening_score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "screening_status": {
            "enum": [
              "ready_for_human_review",
              "needs_revision"
            ]
          },
          "checks": {
            "type": "object",
            "properties": {
              "evidence_urls_present": {
                "type": "boolean"
              },
              "estimated_cost_within_budget": {
                "type": "boolean"
              }
            }
          },
          "review_required": {
            "const": true
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Subscription": {
        "type": "object",
        "required": [
          "plan",
          "status",
          "period_start",
          "period_end"
        ],
        "properties": {
          "plan": {
            "enum": [
              "starter",
              "team"
            ]
          },
          "status": {
            "type": "string"
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Account": {
        "type": "object",
        "required": [
          "key_id",
          "purchase_enabled",
          "paid_access",
          "billing_healthy",
          "subscription",
          "usage",
          "next_action",
          "poll_after_seconds"
        ],
        "properties": {
          "key_id": {
            "type": "string"
          },
          "purchase_enabled": {
            "type": "boolean"
          },
          "paid_access": {
            "type": "boolean"
          },
          "billing_healthy": {
            "type": "boolean"
          },
          "subscription": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Subscription"
              },
              {
                "type": "null"
              }
            ]
          },
          "usage": {
            "type": "object",
            "required": [
              "used",
              "limit",
              "remaining"
            ],
            "properties": {
              "used": {
                "type": "integer",
                "minimum": 0
              },
              "limit": {
                "type": "integer",
                "minimum": 0
              },
              "remaining": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          "next_action": {
            "enum": [
              "submit_review",
              "purchase_or_wait_for_payment"
            ]
          },
          "poll_after_seconds": {
            "const": 15
          }
        }
      },
      "CheckoutAction": {
        "type": "object",
        "required": [
          "checkout_url",
          "status",
          "payment_action",
          "status_endpoint",
          "poll_after_seconds",
          "access_granted"
        ],
        "properties": {
          "checkout_url": {
            "type": "string",
            "format": "uri"
          },
          "resumed": {
            "type": "boolean"
          },
          "status": {
            "const": "requires_action"
          },
          "payment_action": {
            "type": "object",
            "required": [
              "type",
              "url"
            ],
            "properties": {
              "type": {
                "const": "open_url"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "status_endpoint": {
            "const": "/api/v1/account"
          },
          "poll_after_seconds": {
            "const": 15
          },
          "access_granted": {
            "const": false
          }
        }
      },
      "KeyCreated": {
        "type": "object",
        "required": [
          "key_id",
          "api_key",
          "allow_purchases",
          "shown_once"
        ],
        "properties": {
          "key_id": {
            "type": "string"
          },
          "api_key": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Shown only once. Store securely; never log it."
          },
          "allow_purchases": {
            "type": "boolean"
          },
          "shown_once": {
            "const": true
          }
        }
      },
      "KeyMetadata": {
        "type": "object",
        "required": [
          "key_id",
          "label",
          "created_at",
          "revoked_at",
          "purchase_enabled"
        ],
        "properties": {
          "key_id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "purchase_enabled": {
            "type": "integer",
            "enum": [
              0,
              1
            ]
          }
        }
      },
      "KeyList": {
        "type": "object",
        "required": [
          "keys"
        ],
        "properties": {
          "keys": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/KeyMetadata"
            }
          }
        }
      },
      "Revocation": {
        "type": "object",
        "required": [
          "key_id",
          "revoked"
        ],
        "properties": {
          "key_id": {
            "type": "string"
          },
          "revoked": {
            "const": true
          }
        }
      },
      "Plan": {
        "type": "object",
        "required": [
          "id",
          "amount_cents",
          "currency",
          "interval",
          "interval_count",
          "included_reviews"
        ],
        "properties": {
          "id": {
            "enum": [
              "starter",
              "team"
            ]
          },
          "amount_cents": {
            "type": "integer",
            "minimum": 0
          },
          "currency": {
            "type": "string",
            "description": "ISO currency code; amount in minor units"
          },
          "interval": {
            "enum": [
              "day",
              "week",
              "month",
              "year"
            ]
          },
          "interval_count": {
            "type": "integer",
            "minimum": 1
          },
          "included_reviews": {
            "type": "integer",
            "enum": [
              100,
              1000
            ]
          }
        }
      },
      "Catalog": {
        "type": "object",
        "required": [
          "product",
          "version",
          "api_enabled",
          "checkout_enabled",
          "mode",
          "plans",
          "pilot_region",
          "purchase",
          "limitations"
        ],
        "properties": {
          "product": {
            "const": "AgentVerify"
          },
          "version": {
            "const": "1.0"
          },
          "api_enabled": {
            "type": "boolean"
          },
          "checkout_enabled": {
            "type": "boolean"
          },
          "mode": {
            "enum": [
              "sandbox",
              "live"
            ]
          },
          "plans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Plan"
            }
          },
          "pilot_region": {
            "enum": [
              "US-CA",
              null
            ]
          },
          "purchase": {
            "type": "object",
            "required": [
              "endpoint",
              "method",
              "requires_purchase_enabled_key",
              "payment_completion",
              "status_endpoint"
            ],
            "properties": {
              "endpoint": {
                "const": "/api/v1/checkout"
              },
              "method": {
                "const": "POST"
              },
              "requires_purchase_enabled_key": {
                "const": true
              },
              "payment_completion": {
                "const": "hosted_checkout"
              },
              "status_endpoint": {
                "const": "/api/v1/account"
              }
            }
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "capabilities": {
            "type": "object",
            "properties": {
              "structural_review": {
                "type": "boolean"
              },
              "tablecheck": {
                "type": "boolean"
              }
            }
          },
          "usage_policy": {
            "type": "object"
          }
        }
      },
      "TableCheckAmount": {
        "type": "string",
        "pattern": "^\\d{1,9}(?:\\.\\d{1,2})?$"
      },
      "TableCheckInput": {
        "title": "TableCheck structured quote input 1.0",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "rows",
          "declared_total",
          "currency"
        ],
        "properties": {
          "rows": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "id",
                "quantity",
                "unit_price",
                "line_total"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "pattern": "\\S"
                },
                "quantity": {
                  "type": "string",
                  "pattern": "^\\d{1,6}$"
                },
                "unit_price": {
                  "$ref": "#/components/schemas/TableCheckAmount"
                },
                "line_total": {
                  "$ref": "#/components/schemas/TableCheckAmount"
                }
              }
            }
          },
          "declared_total": {
            "$ref": "#/components/schemas/TableCheckAmount"
          },
          "currency": {
            "enum": [
              "USD",
              "EUR",
              "GBP"
            ]
          }
        }
      },
      "TableCheckResult": {
        "type": "object",
        "required": [
          "engine_version",
          "schema_version",
          "service",
          "preview",
          "request_id",
          "review_required",
          "passed",
          "currency",
          "row_count",
          "totals",
          "issues",
          "limitations"
        ],
        "properties": {
          "engine_version": {
            "const": "1.1.0"
          },
          "schema_version": {
            "const": "1.0"
          },
          "service": {
            "const": "TableCheck"
          },
          "preview": {
            "const": false
          },
          "request_id": {
            "type": "string"
          },
          "review_required": {
            "const": true
          },
          "passed": {
            "type": "boolean"
          },
          "currency": {
            "enum": [
              "USD",
              "EUR",
              "GBP"
            ]
          },
          "row_count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "totals": {
            "type": "object",
            "required": [
              "declared",
              "reported_lines",
              "recalculated_lines"
            ],
            "properties": {
              "declared": {
                "type": "string"
              },
              "reported_lines": {
                "type": "string"
              },
              "recalculated_lines": {
                "type": "string"
              }
            }
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "code"
              ],
              "properties": {
                "code": {
                  "enum": [
                    "duplicate_row_id",
                    "line_total_mismatch",
                    "declared_vs_reported_total",
                    "declared_vs_recalculated_total"
                  ]
                },
                "row": {
                  "type": "integer"
                },
                "id": {
                  "type": "string"
                },
                "first_row": {
                  "type": "integer"
                },
                "expected": {
                  "type": "string"
                },
                "observed": {
                  "type": "string"
                },
                "difference": {
                  "type": "string"
                }
              }
            }
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    },
    "responses": {
      "Error": {
        "description": "Invalid request, authorization denied, conflict, exhausted quota or unavailable service. Retry only transient errors.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": [
                "error"
              ],
              "properties": {
                "error": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  }
}
