{
  "openapi": "3.1.0",
  "info": {
    "title": "TheWavly API",
    "version": "2026-11-23",
    "summary": "Check every AI agent purchase against what the user approved, before the money moves.",
    "description": "Amounts are in paise. Writes accept an Idempotency-Key. Every response carries a Request-Id. Restricted keys carry scopes; each operation lists the scope it needs in x-wavly-scope. Signed formats are described at /spec.",
    "contact": {
      "url": "https://thewavly.com/#apply"
    },
    "termsOfService": "https://thewavly.com/terms"
  },
  "servers": [
    {
      "url": "https://thewavly.com"
    }
  ],
  "security": [
    {
      "secretKey": []
    }
  ],
  "tags": [
    {
      "name": "Mandates"
    },
    {
      "name": "Checks"
    },
    {
      "name": "Approvals"
    },
    {
      "name": "Payment tokens"
    },
    {
      "name": "Payments"
    },
    {
      "name": "Disputes"
    },
    {
      "name": "Agents"
    },
    {
      "name": "Agent registry"
    },
    {
      "name": "Webhooks"
    },
    {
      "name": "Events"
    },
    {
      "name": "Personal data"
    },
    {
      "name": "Verification"
    },
    {
      "name": "Service"
    }
  ],
  "paths": {
    "/v1/mandates": {
      "post": {
        "summary": "Record what the user approved",
        "tags": [
          "Mandates"
        ],
        "x-wavly-scope": "mandates:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MandateInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Mandate"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "summary": "List mandates",
        "tags": [
          "Mandates"
        ],
        "x-wavly-scope": "mandates:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "starting_after",
            "in": "query",
            "description": "An id from the previous page",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "agent",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Mandate"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/mandates/import": {
      "post": {
        "summary": "Import an AP2 or Verifiable Intent open mandate",
        "tags": [
          "Mandates"
        ],
        "x-wavly-scope": "mandates:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Mandate"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/mandates/{id}": {
      "get": {
        "summary": "Retrieve a mandate with its versions",
        "tags": [
          "Mandates"
        ],
        "x-wavly-scope": "mandates:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Mandate id",
            "schema": {
              "type": "string",
              "pattern": "^mdt_[\\w-]{6,40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Mandate"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/mandates/{id}/revoke": {
      "post": {
        "summary": "Revoke a mandate; every later check stops",
        "tags": [
          "Mandates"
        ],
        "x-wavly-scope": "mandates:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Mandate id",
            "schema": {
              "type": "string",
              "pattern": "^mdt_[\\w-]{6,40}$"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "maxLength": 300
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Mandate"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/checks": {
      "post": {
        "summary": "Check a purchase just before paying",
        "tags": [
          "Checks"
        ],
        "x-wavly-scope": "checks:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Check"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "summary": "List checks",
        "tags": [
          "Checks"
        ],
        "x-wavly-scope": "checks:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "starting_after",
            "in": "query",
            "description": "An id from the previous page",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mandate",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "agent",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "decision",
            "in": "query",
            "schema": {
              "enum": [
                "proceed",
                "ask",
                "stop"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Check"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/checks/{id}": {
      "get": {
        "summary": "Retrieve a check",
        "tags": [
          "Checks"
        ],
        "x-wavly-scope": "checks:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Check id",
            "schema": {
              "type": "string",
              "pattern": "^chk_[\\w-]{6,40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Check"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/checks/{id}/outcome": {
      "post": {
        "summary": "Report what happened to the money",
        "tags": [
          "Checks"
        ],
        "x-wavly-scope": "checks:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Check id",
            "schema": {
              "type": "string",
              "pattern": "^chk_[\\w-]{6,40}$"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "status"
                ],
                "properties": {
                  "status": {
                    "enum": [
                      "paid",
                      "failed",
                      "cancelled"
                    ]
                  },
                  "payment_reference": {
                    "type": "string",
                    "maxLength": 120
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Check"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/checks/{id}/payment_token": {
      "post": {
        "summary": "Issue a new single-use payment token",
        "tags": [
          "Payment tokens"
        ],
        "x-wavly-scope": "checks:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Check id",
            "schema": {
              "type": "string",
              "pattern": "^chk_[\\w-]{6,40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentToken"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/checks/{id}/evidence": {
      "get": {
        "summary": "Download the signed evidence pack",
        "tags": [
          "Checks"
        ],
        "x-wavly-scope": "checks:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Check id",
            "schema": {
              "type": "string",
              "pattern": "^chk_[\\w-]{6,40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "See /spec section 5"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/approvals/{id}": {
      "get": {
        "summary": "Whether the user approved or declined",
        "tags": [
          "Approvals"
        ],
        "x-wavly-scope": "approvals:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Approval id",
            "schema": {
              "type": "string",
              "pattern": "^apv_[\\w-]{6,40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Approval"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/payment_tokens/inspect": {
      "post": {
        "summary": "Inspect a payment token (for payment providers, no key needed)",
        "tags": [
          "Payment tokens"
        ],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "token"
                ],
                "properties": {
                  "token": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/payment_tokens/redeem": {
      "post": {
        "summary": "Redeem a payment token once, just before charging",
        "tags": [
          "Payment tokens"
        ],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "token",
                  "amount_paise",
                  "payment_reference"
                ],
                "properties": {
                  "token": {
                    "type": "string"
                  },
                  "amount_paise": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Amount in paise (₹1 = 100 paise)"
                  },
                  "payee": {
                    "type": "string"
                  },
                  "merchant": {
                    "type": "string"
                  },
                  "payment_reference": {
                    "type": "string"
                  },
                  "currency": {
                    "const": "INR"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/payment_tokens/fulfilment": {
      "post": {
        "summary": "Report what happened to the order, as the redeemer (no key needed)",
        "tags": [
          "Payment tokens"
        ],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/FulfilmentInput"
                  },
                  {
                    "type": "object",
                    "required": [
                      "token",
                      "release_key"
                    ],
                    "properties": {
                      "token": {
                        "type": "string"
                      },
                      "release_key": {
                        "type": "string",
                        "description": "Returned once, by the redemption. Proves the caller redeemed the token."
                      },
                      "party": {
                        "enum": [
                          "merchant",
                          "payment_participant"
                        ],
                        "default": "merchant"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Fulfilment"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/checks/{id}/fulfilment": {
      "post": {
        "summary": "Report what happened to the order",
        "tags": [
          "Checks"
        ],
        "x-wavly-scope": "checks:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Check id",
            "schema": {
              "type": "string",
              "pattern": "^chk_[\\w-]{6,40}$"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/FulfilmentInput"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "party": {
                        "enum": [
                          "merchant",
                          "payment_participant",
                          "agent_operator",
                          "organisation"
                        ],
                        "default": "organisation"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Fulfilment"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "summary": "List the fulfilment reports for a check, oldest first",
        "tags": [
          "Checks"
        ],
        "x-wavly-scope": "checks:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Check id",
            "schema": {
              "type": "string",
              "pattern": "^chk_[\\w-]{6,40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Fulfilment"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/payment_tokens/release": {
      "post": {
        "summary": "Give an approval back when the charge failed after redemption (no key needed)",
        "tags": [
          "Payment tokens"
        ],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "token",
                  "release_key"
                ],
                "properties": {
                  "token": {
                    "type": "string"
                  },
                  "release_key": {
                    "type": "string",
                    "description": "Returned once, by the redemption"
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 200
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/payments": {
      "post": {
        "summary": "Report a real debit for reconciliation",
        "tags": [
          "Payments"
        ],
        "x-wavly-scope": "payments:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payment"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "summary": "List reported debits with a summary",
        "tags": [
          "Payments"
        ],
        "x-wavly-scope": "payments:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "starting_after",
            "in": "query",
            "description": "An id from the previous page",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "enum": [
                "matched",
                "over_amount",
                "unchecked"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Payment"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/disputes": {
      "post": {
        "summary": "Open a dispute on a check",
        "tags": [
          "Disputes"
        ],
        "x-wavly-scope": "disputes:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DisputeInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Dispute"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "summary": "List disputes",
        "tags": [
          "Disputes"
        ],
        "x-wavly-scope": "disputes:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "starting_after",
            "in": "query",
            "description": "An id from the previous page",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "enum": [
                "open",
                "appealed",
                "resolved",
                "closed",
                "withdrawn"
              ]
            }
          },
          {
            "name": "check",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "assignee",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "A member id, `me` (the signed-in member, in the dashboard) or `none` for unassigned"
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "enum": [
                "due"
              ]
            },
            "description": "`due`: the work queue, open and appealed disputes with the nearest deadline first"
          },
          {
            "name": "overdue",
            "in": "query",
            "schema": {
              "enum": [
                "true"
              ]
            },
            "description": "Only disputes past their deadline"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Dispute"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/security_events": {
      "get": {
        "summary": "The security log: sign-ins, failed attempts, lockouts, keys, roles, exports, erasures and single sign-on changes, newest first, kept a year",
        "tags": [
          "Events"
        ],
        "x-wavly-scope": "security_events:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "starting_after",
            "in": "query",
            "description": "An id from the previous page",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "severity",
            "in": "query",
            "schema": {
              "enum": [
                "info",
                "warn",
                "high"
              ]
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "const": "security_event"
                          },
                          "id": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "severity": {
                            "enum": [
                              "info",
                              "warn",
                              "high"
                            ]
                          },
                          "actor": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "ip": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "user_agent": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "detail": {
                            "type": "object"
                          },
                          "created_at": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/disputes/stats": {
      "get": {
        "summary": "Desk figures: the queue, time to a finding, share within the service level, minutes per case, appeals overturned",
        "tags": [
          "Disputes"
        ],
        "x-wavly-scope": "disputes:read",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 365,
              "default": 30
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeskStats"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/disputes/{id}/parties": {
      "post": {
        "summary": "Ask a party to respond: a link to the case, no account needed",
        "tags": [
          "Disputes"
        ],
        "x-wavly-scope": "disputes:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Dispute id",
            "schema": {
              "type": "string",
              "pattern": "^dsp_[\\w-]{6,40}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "party",
                  "name"
                ],
                "properties": {
                  "party": {
                    "enum": [
                      "merchant",
                      "agent_operator",
                      "payment_participant"
                    ]
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "email": {
                    "type": "string",
                    "description": "TheWavly emails the link when email is on. The link is returned either way."
                  },
                  "include_evidence": {
                    "type": "boolean",
                    "default": false,
                    "description": "Also show the evidence other parties gave"
                  },
                  "expires_in_days": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 30,
                    "default": 14
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "dispute_party"
                    },
                    "id": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "description": "Shown once. Anyone with it can respond for the party."
                    },
                    "notified": {
                      "type": "boolean"
                    },
                    "expires_at": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "summary": "List the parties asked to respond, with whether they opened the link and responded",
        "tags": [
          "Disputes"
        ],
        "x-wavly-scope": "disputes:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Dispute id",
            "schema": {
              "type": "string",
              "pattern": "^dsp_[\\w-]{6,40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/disputes/{id}/parties/{party_id}/revoke": {
      "post": {
        "summary": "Withdraw a party's link",
        "tags": [
          "Disputes"
        ],
        "x-wavly-scope": "disputes:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Dispute id",
            "schema": {
              "type": "string",
              "pattern": "^dsp_[\\w-]{6,40}$"
            }
          },
          {
            "name": "party_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^dpt_[\\w-]{6,40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/disputes/{id}/assign": {
      "post": {
        "summary": "Assign a dispute to a member, or unassign it",
        "tags": [
          "Disputes"
        ],
        "x-wavly-scope": "disputes:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Dispute id",
            "schema": {
              "type": "string",
              "pattern": "^dsp_[\\w-]{6,40}$"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "assignee"
                ],
                "properties": {
                  "assignee": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "A member's id or email, or null to unassign. An appeal cannot be assigned to anyone who decided the finding under appeal."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Dispute"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/disputes/{id}": {
      "get": {
        "summary": "Retrieve a dispute",
        "tags": [
          "Disputes"
        ],
        "x-wavly-scope": "disputes:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Dispute id",
            "schema": {
              "type": "string",
              "pattern": "^dsp_[\\w-]{6,40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Dispute"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/disputes/{id}/evidence": {
      "post": {
        "summary": "Add evidence",
        "tags": [
          "Disputes"
        ],
        "x-wavly-scope": "disputes:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Dispute id",
            "schema": {
              "type": "string",
              "pattern": "^dsp_[\\w-]{6,40}$"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvidenceInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Dispute"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/disputes/{id}/resolve": {
      "post": {
        "summary": "Record a signed finding and remedy",
        "tags": [
          "Disputes"
        ],
        "x-wavly-scope": "disputes:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Dispute id",
            "schema": {
              "type": "string",
              "pattern": "^dsp_[\\w-]{6,40}$"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResolveInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Dispute"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/disputes/{id}/appeal": {
      "post": {
        "summary": "Appeal within 14 days",
        "tags": [
          "Disputes"
        ],
        "x-wavly-scope": "disputes:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Dispute id",
            "schema": {
              "type": "string",
              "pattern": "^dsp_[\\w-]{6,40}$"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "reason"
                ],
                "properties": {
                  "reason": {
                    "type": "string"
                  },
                  "party": {
                    "$ref": "#/components/schemas/Party"
                  },
                  "evidence": {
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/EvidenceInput"
                      },
                      {
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/EvidenceInput"
                        }
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Dispute"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/disputes/{id}/withdraw": {
      "post": {
        "summary": "Withdraw a dispute",
        "tags": [
          "Disputes"
        ],
        "x-wavly-scope": "disputes:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Dispute id",
            "schema": {
              "type": "string",
              "pattern": "^dsp_[\\w-]{6,40}$"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Dispute"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/disputes/{id}/remedy": {
      "post": {
        "summary": "Record a remedy step",
        "tags": [
          "Disputes"
        ],
        "x-wavly-scope": "disputes:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Dispute id",
            "schema": {
              "type": "string",
              "pattern": "^dsp_[\\w-]{6,40}$"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "status"
                ],
                "properties": {
                  "status": {
                    "enum": [
                      "promised",
                      "initiated",
                      "settled"
                    ]
                  },
                  "reference": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Dispute"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/agents": {
      "get": {
        "summary": "List agents with their TheWavly Score",
        "tags": [
          "Agents"
        ],
        "x-wavly-scope": "agents:read",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AgentScore"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/score/method": {
      "get": {
        "summary": "The TheWavly Score method: weights, prior, window and confidence levels (public)",
        "tags": [
          "Agents"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "method": {
                      "type": "string"
                    },
                    "window_days": {
                      "type": "integer"
                    },
                    "prior_checks": {
                      "type": "integer"
                    },
                    "weights": {
                      "type": "object"
                    },
                    "confidence": {
                      "type": "object"
                    },
                    "formula": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/agents/{agent}/score": {
      "get": {
        "summary": "An agent's TheWavly Score and track record",
        "tags": [
          "Agents"
        ],
        "x-wavly-scope": "agents:read",
        "parameters": [
          {
            "name": "agent",
            "in": "path",
            "required": true,
            "description": "Your name for the agent",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][\\w.:-]{0,79}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentScore"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/agents/{agent}/keys": {
      "get": {
        "summary": "List an agent's signing keys",
        "tags": [
          "Agents"
        ],
        "x-wavly-scope": "agents:read",
        "parameters": [
          {
            "name": "agent",
            "in": "path",
            "required": true,
            "description": "Your name for the agent",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][\\w.:-]{0,79}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AgentKey"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "summary": "Register an agent's public key",
        "tags": [
          "Agents"
        ],
        "x-wavly-scope": "agents:write",
        "parameters": [
          {
            "name": "agent",
            "in": "path",
            "required": true,
            "description": "Your name for the agent",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][\\w.:-]{0,79}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jwk"
                ],
                "properties": {
                  "jwk": {
                    "type": "object",
                    "description": "Ed25519 (OKP) or P-256 (EC) public JWK"
                  },
                  "label": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentKey"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/agents/{agent}/keys/{kid}/revoke": {
      "post": {
        "summary": "Revoke an agent key",
        "tags": [
          "Agents"
        ],
        "x-wavly-scope": "agents:write",
        "parameters": [
          {
            "name": "agent",
            "in": "path",
            "required": true,
            "description": "Your name for the agent",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][\\w.:-]{0,79}$"
            }
          },
          {
            "name": "kid",
            "in": "path",
            "required": true,
            "description": "Key id (RFC 7638 thumbprint)",
            "schema": {
              "type": "string",
              "pattern": "^[\\w-]{20,64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentKey"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/registry/agents": {
      "post": {
        "summary": "Register an agent in the public registry",
        "tags": [
          "Agent registry"
        ],
        "x-wavly-scope": "agents:write",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegistryAgentInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryAgentOwned"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "summary": "The public directory of verified agents (add ?mine=true with a key for your own)",
        "tags": [
          "Agent registry"
        ],
        "security": [],
        "parameters": [
          {
            "name": "mine",
            "in": "query",
            "description": "true, with your secret key, lists your own agents",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RegistryAgent"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/registry/agents/{agent}": {
      "get": {
        "summary": "An agent's public profile and track record",
        "tags": [
          "Agent registry"
        ],
        "security": [],
        "parameters": [
          {
            "name": "agent",
            "in": "path",
            "required": true,
            "description": "Registry id (agt_…) or public handle",
            "schema": {
              "type": "string",
              "pattern": "^(agt_[\\w-]{6,40}|[a-z0-9-]{3,40})$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryAgent"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/registry/agents/{agent}/jwks": {
      "get": {
        "summary": "An agent's active public keys",
        "tags": [
          "Agent registry"
        ],
        "security": [],
        "parameters": [
          {
            "name": "agent",
            "in": "path",
            "required": true,
            "description": "Registry id (agt_…) or public handle",
            "schema": {
              "type": "string",
              "pattern": "^(agt_[\\w-]{6,40}|[a-z0-9-]{3,40})$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keys": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/registry/agents/{agent}/manage": {
      "get": {
        "summary": "Your agent, with its verification token",
        "tags": [
          "Agent registry"
        ],
        "x-wavly-scope": "agents:read",
        "parameters": [
          {
            "name": "agent",
            "in": "path",
            "required": true,
            "description": "Registry id (agt_…) or public handle",
            "schema": {
              "type": "string",
              "pattern": "^(agt_[\\w-]{6,40}|[a-z0-9-]{3,40})$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryAgentOwned"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/registry/agents/{agent}/verify": {
      "post": {
        "summary": "Prove you control the agent's website (reads /.well-known/wavly-agents.json)",
        "tags": [
          "Agent registry"
        ],
        "x-wavly-scope": "agents:write",
        "parameters": [
          {
            "name": "agent",
            "in": "path",
            "required": true,
            "description": "Registry id (agt_…) or public handle",
            "schema": {
              "type": "string",
              "pattern": "^(agt_[\\w-]{6,40}|[a-z0-9-]{3,40})$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryAgentOwned"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/registry/agents/{agent}/keys": {
      "post": {
        "summary": "Add a signing key to your registered agent",
        "tags": [
          "Agent registry"
        ],
        "x-wavly-scope": "agents:write",
        "parameters": [
          {
            "name": "agent",
            "in": "path",
            "required": true,
            "description": "Registry id (agt_…) or public handle",
            "schema": {
              "type": "string",
              "pattern": "^(agt_[\\w-]{6,40}|[a-z0-9-]{3,40})$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jwk"
                ],
                "properties": {
                  "jwk": {
                    "type": "object",
                    "description": "Ed25519 (OKP) or P-256 (EC) public JWK"
                  },
                  "label": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentKey"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/registry/agents/{agent}/keys/{kid}/revoke": {
      "post": {
        "summary": "Revoke a registered agent's key",
        "tags": [
          "Agent registry"
        ],
        "x-wavly-scope": "agents:write",
        "parameters": [
          {
            "name": "agent",
            "in": "path",
            "required": true,
            "description": "Registry id (agt_…) or public handle",
            "schema": {
              "type": "string",
              "pattern": "^(agt_[\\w-]{6,40}|[a-z0-9-]{3,40})$"
            }
          },
          {
            "name": "kid",
            "in": "path",
            "required": true,
            "description": "Key id (RFC 7638 thumbprint)",
            "schema": {
              "type": "string",
              "pattern": "^[\\w-]{20,64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentKey"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/registry/verify": {
      "post": {
        "summary": "For merchants: should I accept this agent's order? (no key needed)",
        "tags": [
          "Agent registry"
        ],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "agent"
                ],
                "properties": {
                  "agent": {
                    "type": "string",
                    "description": "Registry id or handle the agent gave you"
                  },
                  "payment_token": {
                    "type": "string",
                    "description": "The TheWavly payment token for this order"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderVerification"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/webhook_endpoints": {
      "post": {
        "summary": "Add a webhook endpoint",
        "tags": [
          "Webhooks"
        ],
        "x-wavly-scope": "webhooks:write",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "description": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Includes the signing secret, shown once"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "summary": "List webhook endpoints",
        "tags": [
          "Webhooks"
        ],
        "x-wavly-scope": "webhooks:read",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/webhook_endpoints/{id}": {
      "delete": {
        "summary": "Delete a webhook endpoint",
        "tags": [
          "Webhooks"
        ],
        "x-wavly-scope": "webhooks:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Endpoint id",
            "schema": {
              "type": "string",
              "pattern": "^we_[\\w-]{6,40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/events": {
      "get": {
        "summary": "The audit log",
        "tags": [
          "Events"
        ],
        "x-wavly-scope": "events:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "starting_after",
            "in": "query",
            "description": "An id from the previous page",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ],
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Event"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "summary": "This month's live checks, desk cases and estimated charge",
        "tags": [
          "Service"
        ],
        "x-wavly-scope": "billing:read",
        "parameters": [
          {
            "name": "month",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/invoices": {
      "get": {
        "summary": "Your GST invoices, newest month first: issued tax invoices and drafts waiting for billing details",
        "tags": [
          "Service"
        ],
        "x-wavly-scope": "billing:read",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Invoice"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/invoices/{id}": {
      "get": {
        "summary": "One GST invoice",
        "tags": [
          "Service"
        ],
        "x-wavly-scope": "billing:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Invoice id",
            "schema": {
              "type": "string",
              "pattern": "^txi_[\\w-]{6,40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/credit_notes": {
      "get": {
        "summary": "Credit notes TheWavly has issued against your invoices: refunds, goodwill credits and corrections",
        "tags": [
          "Service"
        ],
        "x-wavly-scope": "billing:read",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CreditNote"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/credit_notes/{id}": {
      "get": {
        "summary": "One credit note",
        "tags": [
          "Service"
        ],
        "x-wavly-scope": "billing:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Credit note id",
            "schema": {
              "type": "string",
              "pattern": "^crn_[\\w-]{6,40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditNote"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/end_users/erase": {
      "post": {
        "summary": "Erase one end user's personal data",
        "tags": [
          "Personal data"
        ],
        "x-wavly-scope": "end_users:erase",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "approved_by"
                ],
                "properties": {
                  "approved_by": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/orgs/{org}/jwks": {
      "get": {
        "summary": "An organisation's public signing keys",
        "tags": [
          "Verification"
        ],
        "security": [],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "Organisation id",
            "schema": {
              "type": "string",
              "pattern": "^org_[\\w-]{8,40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keys": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/verify": {
      "post": {
        "summary": "Check any TheWavly token's signature",
        "tags": [
          "Verification"
        ],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "token"
                ],
                "properties": {
                  "token": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "valid": {
                      "type": "boolean"
                    },
                    "payload": {
                      "type": "object"
                    },
                    "reason": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/health": {
      "get": {
        "summary": "Service health, for uptime monitors",
        "tags": [
          "Service"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "enum": [
                        "ok",
                        "degraded"
                      ]
                    },
                    "api_version": {
                      "type": "string"
                    },
                    "store": {
                      "type": "string"
                    },
                    "email": {
                      "type": "boolean",
                      "description": "Email sending is configured; this does not assert inbox delivery."
                    },
                    "release": {
                      "type": "string",
                      "description": "Deployed Git commit, when the hosting provider supplies it."
                    },
                    "store_ms": {
                      "type": "integer"
                    },
                    "time": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/openapi.json": {
      "get": {
        "summary": "This document",
        "tags": [
          "Service"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "secretKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "A secret key, sk_test_… or sk_live_…. Restricted keys carry scopes: security_events:read, mandates:read, mandates:write, checks:read, checks:write, approvals:read, disputes:read, disputes:write, payments:read, payments:write, agents:read, agents:write, webhooks:read, webhooks:write, events:read, end_users:erase, billing:read"
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "description": "Repeat a write safely: the same key and body return the first answer.",
        "schema": {
          "type": "string",
          "maxLength": 200
        }
      }
    },
    "responses": {
      "Error": {
        "description": "An error",
        "headers": {
          "Request-Id": {
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": [
                "error"
              ],
              "properties": {
                "error": {
                  "type": "object",
                  "required": [
                    "code",
                    "message"
                  ],
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "field": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "CreditNote": {
        "type": "object",
        "required": [
          "object",
          "id",
          "number",
          "invoice",
          "total_minor",
          "currency"
        ],
        "properties": {
          "total_minor": {
            "type": "integer",
            "description": "Paise for INR or cents for USD"
          },
          "currency": {
            "enum": [
              "INR",
              "USD"
            ]
          },
          "document_url": {
            "type": "string",
            "format": "uri",
            "description": "Original finance-issued USD credit note"
          },
          "object": {
            "const": "credit_note"
          },
          "id": {
            "type": "string",
            "pattern": "^crn_"
          },
          "number": {
            "type": "string",
            "description": "Domestic credit note number or finance-issued USD credit reference"
          },
          "issued_at": {
            "type": "integer"
          },
          "reason": {
            "enum": [
              "refund",
              "goodwill",
              "correction",
              "service_issue"
            ]
          },
          "note": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          },
          "invoice": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "number": {
                "type": "string"
              },
              "issued_at": {
                "type": "integer"
              },
              "month": {
                "type": "string"
              }
            }
          },
          "kind": {
            "enum": [
              "intra",
              "inter"
            ]
          },
          "taxable_paise": {
            "type": "integer"
          },
          "cgst_paise": {
            "type": "integer"
          },
          "sgst_paise": {
            "type": "integer"
          },
          "igst_paise": {
            "type": "integer"
          },
          "total_tax_paise": {
            "type": "integer"
          },
          "total_paise": {
            "type": "integer"
          },
          "emailed_at": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "Invoice": {
        "type": "object",
        "required": [
          "object",
          "id",
          "month",
          "status",
          "total_minor",
          "currency"
        ],
        "properties": {
          "total_minor": {
            "type": "integer",
            "description": "Paise for INR or cents for USD"
          },
          "document_url": {
            "type": "string",
            "format": "uri",
            "description": "Original finance-issued USD invoice"
          },
          "object": {
            "const": "invoice"
          },
          "id": {
            "type": "string",
            "pattern": "^txi_"
          },
          "month": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}$"
          },
          "status": {
            "enum": [
              "issued",
              "draft"
            ],
            "description": "issued: an issued INR or USD invoice. draft: an INR preview pending billing details"
          },
          "number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Domestic invoice number or finance-issued USD invoice reference"
          },
          "issued_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "supplier": {
            "type": "object"
          },
          "customer": {
            "type": "object"
          },
          "place_of_supply": {
            "type": [
              "string",
              "null"
            ]
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "description": {
                  "type": "string"
                },
                "quantity": {
                  "type": "integer"
                },
                "rate_paise": {
                  "type": "integer"
                },
                "amount_paise": {
                  "type": "integer"
                }
              }
            }
          },
          "taxable_paise": {
            "type": "integer"
          },
          "kind": {
            "enum": [
              "intra",
              "inter"
            ],
            "description": "intra: CGST and SGST at 9% each. inter: IGST at 18%"
          },
          "cgst_paise": {
            "type": "integer"
          },
          "sgst_paise": {
            "type": "integer"
          },
          "igst_paise": {
            "type": "integer"
          },
          "total_tax_paise": {
            "type": "integer"
          },
          "total_paise": {
            "type": "integer"
          },
          "gst_rate": {
            "const": 18
          },
          "currency": {
            "enum": [
              "INR",
              "USD"
            ]
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Party": {
        "enum": [
          "customer",
          "agent_operator",
          "merchant",
          "payment_participant",
          "organisation"
        ]
      },
      "Rules": {
        "type": "object",
        "required": [
          "items",
          "max_amount_paise"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Allowed items; \"*\" for any"
          },
          "max_amount_paise": {
            "type": "integer",
            "minimum": 1,
            "description": "Amount in paise (₹1 = 100 paise)"
          },
          "min_amount_paise": {
            "type": "integer",
            "minimum": 1,
            "description": "Amount in paise (₹1 = 100 paise)"
          },
          "max_quantity": {
            "type": "integer"
          },
          "budget_paise": {
            "type": "integer",
            "minimum": 1,
            "description": "Amount in paise (₹1 = 100 paise)"
          },
          "max_purchases": {
            "type": "integer"
          },
          "merchants": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "payees": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "UPI addresses"
          },
          "deliver_to": {
            "type": "string"
          },
          "currency": {
            "const": "INR"
          },
          "approval_ttl_seconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 86400
          },
          "require_agent_signature": {
            "type": "boolean"
          },
          "conditions": {
            "type": "array",
            "maxItems": 20,
            "description": "Conditions on purchase.terms; a missing term asks, a failed one stops",
            "items": {
              "type": "object",
              "required": [
                "term"
              ],
              "properties": {
                "term": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]{0,39}$"
                },
                "equals": {},
                "at_least": {
                  "type": "number"
                },
                "at_most": {
                  "type": "number"
                },
                "one_of": {
                  "type": "array"
                },
                "label": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "MandateInput": {
        "type": "object",
        "required": [
          "instruction",
          "approved_by",
          "rules"
        ],
        "properties": {
          "instruction": {
            "type": "string",
            "maxLength": 1000
          },
          "approved_by": {
            "type": "string",
            "description": "Your reference for the user, not their name or phone"
          },
          "agent": {
            "type": "string"
          },
          "rules": {
            "$ref": "#/components/schemas/Rules"
          },
          "starts_at": {
            "type": "integer"
          },
          "expires_at": {
            "type": "integer"
          },
          "expires_in_seconds": {
            "type": "integer"
          },
          "previous": {
            "type": "string",
            "description": "Make a new version of this mandate"
          },
          "metadata": {
            "type": "object"
          }
        }
      },
      "ImportInput": {
        "type": "object",
        "required": [
          "credential",
          "approved_by"
        ],
        "properties": {
          "credential": {
            "type": "string",
            "description": "SD-JWT presentation"
          },
          "issuer_jwks": {
            "type": "object"
          },
          "issuer_jwks_url": {
            "type": "string"
          },
          "approved_by": {
            "type": "string"
          },
          "defaults": {
            "type": "object"
          },
          "allow_unverified": {
            "type": "boolean"
          }
        }
      },
      "Mandate": {
        "type": "object",
        "properties": {
          "object": {
            "const": "mandate"
          },
          "id": {
            "type": "string"
          },
          "version": {
            "type": "integer"
          },
          "livemode": {
            "type": "boolean"
          },
          "status": {
            "enum": [
              "active",
              "scheduled",
              "expired",
              "revoked",
              "superseded"
            ]
          },
          "instruction": {
            "type": "string"
          },
          "approved_by": {
            "type": "string"
          },
          "agent": {
            "type": [
              "string",
              "null"
            ]
          },
          "rules": {
            "$ref": "#/components/schemas/Rules"
          },
          "usage": {
            "type": "object"
          },
          "token": {
            "type": "string"
          },
          "upi": {
            "type": "object"
          },
          "starts_at": {
            "type": "integer"
          },
          "expires_at": {
            "type": "integer"
          }
        }
      },
      "Purchase": {
        "type": "object",
        "required": [
          "item",
          "amount_paise"
        ],
        "properties": {
          "item": {
            "type": "string"
          },
          "item_id": {
            "type": "string"
          },
          "amount_paise": {
            "type": "integer",
            "minimum": 1,
            "description": "Amount in paise (₹1 = 100 paise)"
          },
          "quantity": {
            "type": "integer"
          },
          "currency": {
            "const": "INR"
          },
          "merchant": {
            "type": "string"
          },
          "payee": {
            "type": "string"
          },
          "deliver_to": {
            "type": "string"
          },
          "reference": {
            "type": "string",
            "description": "Your order id"
          },
          "terms": {
            "type": "object",
            "description": "The terms the agent was shown, such as refundable or free_cancellation_hours",
            "additionalProperties": {
              "type": [
                "string",
                "number",
                "boolean"
              ]
            }
          }
        }
      },
      "CheckInput": {
        "type": "object",
        "required": [
          "mandate",
          "purchase"
        ],
        "properties": {
          "mandate": {
            "type": "string",
            "description": "Mandate id or token"
          },
          "purchase": {
            "$ref": "#/components/schemas/Purchase"
          },
          "agent": {
            "type": "string"
          },
          "agent_signature": {
            "type": "string",
            "description": "Compact JWS from the agent's key; see /spec section 4"
          },
          "metadata": {
            "type": "object"
          }
        }
      },
      "Result": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string"
          },
          "expected": {},
          "actual": {},
          "result": {
            "enum": [
              "match",
              "ask",
              "stop"
            ]
          }
        }
      },
      "Check": {
        "type": "object",
        "properties": {
          "object": {
            "const": "check"
          },
          "id": {
            "type": "string"
          },
          "decision": {
            "enum": [
              "proceed",
              "ask",
              "stop"
            ]
          },
          "status": {
            "enum": [
              "held",
              "awaiting_approval",
              "stopped",
              "declined",
              "paid",
              "released",
              "expired"
            ]
          },
          "purchase": {
            "$ref": "#/components/schemas/Purchase"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Result"
            }
          },
          "receipt": {
            "type": "string"
          },
          "verify_url": {
            "type": "string",
            "description": "Public page that verifies the receipt in the browser. Share it with the user or merchant."
          },
          "ap2_receipt": {
            "type": "string"
          },
          "approval": {
            "type": [
              "object",
              "null"
            ]
          },
          "payment_token": {
            "$ref": "#/components/schemas/PaymentToken"
          },
          "agent": {
            "type": [
              "string",
              "null"
            ]
          },
          "agent_verification": {
            "type": "object"
          },
          "hold_expires_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "payment_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment": {
            "type": [
              "object",
              "null"
            ],
            "description": "Who says money moved",
            "properties": {
              "confirmation": {
                "enum": [
                  "agent_reported",
                  "provider_redeemed",
                  "debit_reconciled",
                  "charge_failed",
                  "failed",
                  "cancelled"
                ]
              },
              "debited_amount_paise": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "independently_confirmed": {
                "const": false
              }
            }
          }
        }
      },
      "PaymentToken": {
        "type": "object",
        "properties": {
          "object": {
            "const": "payment_token"
          },
          "token": {
            "type": "string"
          },
          "expires_at": {
            "type": "integer"
          },
          "max_amount_paise": {
            "type": "integer",
            "minimum": 1,
            "description": "Amount in paise (₹1 = 100 paise)"
          },
          "payee": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "Approval": {
        "type": "object",
        "properties": {
          "object": {
            "const": "approval"
          },
          "id": {
            "type": "string"
          },
          "check": {
            "type": "string"
          },
          "status": {
            "enum": [
              "pending",
              "approved",
              "declined",
              "expired"
            ]
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "PaymentInput": {
        "type": "object",
        "required": [
          "payment_reference",
          "amount_paise"
        ],
        "properties": {
          "payment_reference": {
            "type": "string"
          },
          "amount_paise": {
            "type": "integer",
            "minimum": 1,
            "description": "Amount in paise (₹1 = 100 paise)"
          },
          "payee": {
            "type": "string"
          },
          "merchant": {
            "type": "string"
          },
          "paid_at": {
            "type": "integer"
          },
          "source": {
            "enum": [
              "razorpay",
              "cashfree",
              "pine_labs",
              "payu",
              "juspay",
              "phonepe",
              "paytm",
              "bank_statement",
              "other"
            ]
          },
          "check": {
            "type": "string"
          }
        }
      },
      "Payment": {
        "type": "object",
        "properties": {
          "object": {
            "const": "payment"
          },
          "id": {
            "type": "string"
          },
          "payment_reference": {
            "type": "string"
          },
          "amount_paise": {
            "type": "integer",
            "minimum": 1,
            "description": "Amount in paise (₹1 = 100 paise)"
          },
          "status": {
            "enum": [
              "matched",
              "over_amount",
              "unchecked"
            ]
          },
          "check": {
            "type": [
              "string",
              "null"
            ]
          },
          "detail": {
            "type": "string"
          }
        }
      },
      "FulfilmentInput": {
        "type": "object",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "enum": [
              "delivered",
              "partially_delivered",
              "not_delivered",
              "returned",
              "refunded",
              "cancelled"
            ]
          },
          "items": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "object",
              "required": [
                "description"
              ],
              "properties": {
                "description": {
                  "type": "string",
                  "maxLength": 200
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 0,
                  "default": 1
                }
              }
            }
          },
          "amount_paise": {
            "type": "integer",
            "minimum": 1,
            "description": "Required for refunded: the amount refunded, at most the amount paid"
          },
          "occurred_at": {
            "type": "integer",
            "description": "Unix seconds; defaults to now"
          },
          "carrier": {
            "type": "string",
            "maxLength": 80
          },
          "tracking_reference": {
            "type": "string",
            "maxLength": 120
          },
          "note": {
            "type": "string",
            "maxLength": 1000
          }
        }
      },
      "Fulfilment": {
        "type": "object",
        "properties": {
          "object": {
            "const": "fulfilment"
          },
          "id": {
            "type": "string"
          },
          "check": {
            "type": "string"
          },
          "livemode": {
            "type": "boolean"
          },
          "party": {
            "enum": [
              "merchant",
              "payment_participant",
              "agent_operator",
              "organisation"
            ]
          },
          "via": {
            "enum": [
              "payment_token",
              "api"
            ]
          },
          "status": {
            "type": "string"
          },
          "items": {
            "type": [
              "array",
              "null"
            ]
          },
          "amount_paise": {
            "type": [
              "integer",
              "null"
            ]
          },
          "carrier": {
            "type": [
              "string",
              "null"
            ]
          },
          "tracking_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "occurred_at": {
            "type": "integer"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "token": {
            "type": "string",
            "description": "Signed record (typ fulfilment), chained to the previous report for the check. See /spec section 2.4."
          },
          "erased": {
            "type": "boolean"
          },
          "created_at": {
            "type": "integer"
          }
        }
      },
      "EvidenceInput": {
        "type": "object",
        "required": [
          "text"
        ],
        "properties": {
          "kind": {
            "enum": [
              "statement",
              "order_confirmation",
              "delivery_record",
              "payment_record",
              "quote",
              "screenshot",
              "other"
            ]
          },
          "party": {
            "$ref": "#/components/schemas/Party"
          },
          "text": {
            "type": "string",
            "maxLength": 4000
          },
          "url": {
            "type": "string"
          }
        }
      },
      "DisputeInput": {
        "type": "object",
        "required": [
          "check",
          "reason",
          "description"
        ],
        "properties": {
          "check": {
            "type": "string"
          },
          "reason": {
            "enum": [
              "no_authority",
              "limit_breached",
              "wrong_purchase",
              "not_as_ordered",
              "duplicate_payment",
              "price_changed",
              "unclear_instruction"
            ]
          },
          "description": {
            "type": "string"
          },
          "raised_by": {
            "$ref": "#/components/schemas/Party"
          },
          "independent_review": {
            "type": "boolean",
            "description": "Ask TheWavly's independent desk to review the case (a flat fee per live case)"
          },
          "amount_paise": {
            "type": "integer",
            "minimum": 1,
            "description": "Amount in paise (₹1 = 100 paise)"
          },
          "charged_amount_paise": {
            "type": "integer",
            "minimum": 1,
            "description": "Amount in paise (₹1 = 100 paise)"
          },
          "received_at": {
            "type": "integer"
          },
          "evidence": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EvidenceInput"
            }
          }
        }
      },
      "ResolveInput": {
        "type": "object",
        "required": [
          "finding",
          "note",
          "reviewer"
        ],
        "properties": {
          "reviewer": {
            "type": "string",
            "description": "The person deciding"
          },
          "finding": {
            "enum": [
              "agent_operator",
              "merchant",
              "payment_participant",
              "shared",
              "no_breach",
              "insufficient_evidence",
              "settled"
            ]
          },
          "note": {
            "type": "string"
          },
          "handling_minutes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1440,
            "description": "Time the reviewer spent on the case, for the desk's figures. Not part of the signed finding."
          },
          "remedy": {
            "type": "object",
            "properties": {
              "type": {
                "enum": [
                  "none",
                  "refund",
                  "compensation",
                  "correction",
                  "goodwill"
                ]
              },
              "amount_paise": {
                "type": "integer",
                "minimum": 1,
                "description": "Amount in paise (₹1 = 100 paise)"
              },
              "funded_by": {
                "enum": [
                  "agent_operator",
                  "merchant",
                  "payment_participant",
                  "organisation"
                ]
              }
            }
          }
        }
      },
      "DeskStats": {
        "type": "object",
        "properties": {
          "object": {
            "const": "desk_stats"
          },
          "window_days": {
            "type": "integer"
          },
          "sla": {
            "type": "object",
            "properties": {
              "first_finding_hours": {
                "type": "integer"
              },
              "appeal_decision_hours": {
                "type": "integer"
              }
            }
          },
          "queue": {
            "type": "object",
            "description": "open, appealed, overdue, due_within_24_hours, unassigned, and by_assignee [{assignee, open, overdue}]"
          },
          "first_findings": {
            "type": "integer"
          },
          "hours_to_first_finding": {
            "type": "object",
            "properties": {
              "median": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "p90": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          },
          "within_sla_percent": {
            "type": [
              "number",
              "null"
            ]
          },
          "handling_minutes": {
            "type": "object",
            "properties": {
              "cases": {
                "type": "integer"
              },
              "median": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "p90": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "total": {
                "type": "integer"
              }
            }
          },
          "appeals_decided": {
            "type": "integer"
          },
          "appeals_overturned": {
            "type": "integer"
          }
        }
      },
      "Dispute": {
        "type": "object",
        "properties": {
          "object": {
            "const": "dispute"
          },
          "assignee": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "sla": {
            "type": [
              "object",
              "null"
            ],
            "description": "The next deadline while the dispute needs a decision",
            "properties": {
              "stage": {
                "enum": [
                  "first_finding",
                  "appeal_decision"
                ]
              },
              "due_at": {
                "type": "integer"
              },
              "overdue": {
                "type": "boolean"
              },
              "hours_left": {
                "type": "number"
              }
            }
          },
          "id": {
            "type": "string"
          },
          "check": {
            "type": "string"
          },
          "status": {
            "enum": [
              "open",
              "appealed",
              "resolved",
              "closed",
              "withdrawn"
            ]
          },
          "case": {
            "type": "integer"
          },
          "suggestion": {
            "type": "object"
          },
          "finding": {
            "type": [
              "object",
              "null"
            ]
          },
          "decisions": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "remedy": {
            "type": [
              "object",
              "null"
            ]
          },
          "evidence": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "respond_by": {
            "type": "integer"
          },
          "appeal_until": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "AgentScore": {
        "type": "object",
        "properties": {
          "object": {
            "const": "agent_score"
          },
          "agent": {
            "type": "string"
          },
          "score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "confidence": {
            "enum": [
              "low",
              "medium",
              "high"
            ]
          },
          "track_record": {
            "type": "object"
          },
          "explanation": {
            "type": "string"
          }
        }
      },
      "AgentKey": {
        "type": "object",
        "properties": {
          "object": {
            "const": "agent_key"
          },
          "kid": {
            "type": "string"
          },
          "agent": {
            "type": "string"
          },
          "alg": {
            "enum": [
              "EdDSA",
              "ES256"
            ]
          },
          "status": {
            "enum": [
              "active",
              "revoked"
            ]
          },
          "jwk": {
            "type": "object"
          }
        }
      },
      "RegistryRecord": {
        "type": "object",
        "description": "Counted from checks the agent signed with a registry key, last 90 days",
        "properties": {
          "checks": {
            "type": "integer"
          },
          "proceed": {
            "type": "integer"
          },
          "ask": {
            "type": "integer"
          },
          "stop": {
            "type": "integer"
          },
          "paid": {
            "type": "integer"
          },
          "paid_paise": {
            "type": "integer"
          },
          "disputes": {
            "type": "integer"
          },
          "upheld": {
            "type": "integer"
          }
        }
      },
      "RegistryAgentInput": {
        "type": "object",
        "required": [
          "handle",
          "name",
          "website"
        ],
        "properties": {
          "handle": {
            "type": "string",
            "pattern": "^[a-z0-9-]{3,40}$"
          },
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "website": {
            "type": "string",
            "description": "A public domain you control, such as acme.in"
          },
          "description": {
            "type": "string",
            "maxLength": 300
          }
        }
      },
      "RegistryAgent": {
        "type": "object",
        "properties": {
          "object": {
            "const": "registry_agent"
          },
          "id": {
            "type": "string"
          },
          "handle": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "publisher": {
            "type": "string"
          },
          "website": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "status": {
            "enum": [
              "registered",
              "verified",
              "suspended"
            ]
          },
          "verified": {
            "type": "boolean"
          },
          "verified_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "keys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentKey"
            }
          },
          "profile_url": {
            "type": "string"
          },
          "badge_url": {
            "type": "string"
          },
          "jwks_url": {
            "type": "string"
          },
          "record": {
            "type": "object",
            "properties": {
              "live": {
                "$ref": "#/components/schemas/RegistryRecord"
              },
              "test": {
                "$ref": "#/components/schemas/RegistryRecord"
              }
            }
          }
        }
      },
      "RegistryAgentOwned": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RegistryAgent"
          },
          {
            "type": "object",
            "properties": {
              "verification": {
                "type": "object",
                "properties": {
                  "method": {
                    "const": "well_known"
                  },
                  "url": {
                    "type": "string"
                  },
                  "token": {
                    "type": "string"
                  },
                  "file": {
                    "type": "object",
                    "description": "Serve this JSON at url"
                  }
                }
              }
            }
          }
        ]
      },
      "OrderVerification": {
        "type": "object",
        "properties": {
          "object": {
            "const": "order_verification"
          },
          "accept": {
            "type": "boolean"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "agent": {
            "type": [
              "object",
              "null"
            ]
          },
          "payment": {
            "type": [
              "object",
              "null"
            ]
          }
        }
      },
      "Event": {
        "type": "object",
        "properties": {
          "object": {
            "const": "event"
          },
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "object_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "data": {
            "type": "object"
          },
          "created_at": {
            "type": "integer"
          }
        }
      }
    }
  }
}