{
  "openapi": "3.1.0",
  "info": {
    "title": "ByteMax Partner API",
    "version": "v1",
    "description": "API keys are required for every operation, including quotes. Monetary values are integer strings in cents: BRL, CNY and USD use scale 2. BRL → CNY and BRL → USD are supported; the target must match the merchant wallet currency. Quotes simulate; order creation recalculates. Unknown fields are rejected. Idempotency-Key values of orders are shared with the previous API endpoints. A webhook event names its change and the object it happened to, with the path that answers it: read the object from the API before acting. Events may be duplicated or arrive out of order; deduplicate by event id. Responses produced before a request reaches the API, such as the rate limit of the edge or a maintenance window, may lack code and X-Request-Id; rely on the HTTP status for them."
  },
  "servers": [
    {
      "url": "https://bytemax.exchange/api/v1"
    }
  ],
  "security": [
    {
      "ApiKey": []
    }
  ],
  "paths": {
    "/quote": {
      "get": {
        "operationId": "quote",
        "summary": "Quote",
        "parameters": [
          {
            "name": "source_currency",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "const": "BRL"
            }
          },
          {
            "name": "target_currency",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "CNY",
                "USD"
              ]
            }
          },
          {
            "name": "source_amount_cents",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]*$",
              "maxLength": 32
            }
          },
          {
            "name": "target_amount_cents",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]*$",
              "maxLength": 32
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current resource or completed replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/quote"
                },
                "example": {
                  "source_currency": "BRL",
                  "source_amount_cents": "10000",
                  "target_currency": "CNY",
                  "target_amount_cents": "12500"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "400": {
            "description": "A parameter, field or header is missing or malformed, or an amount is outside the limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INVALID_INPUT",
                  "message": "The request has missing, unknown or malformed fields. Check names and formats; amounts are strings of digits such as \"10000\"."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "401": {
            "description": "The API key is missing, malformed or no longer valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "UNAUTHORIZED",
                  "message": "A valid API key is required."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "403": {
            "description": "The account or the calling IP address may not use the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "API_IP_NOT_ALLOWED",
                  "message": "This IP address is not on the allowed IP list of the account. Add it on the API page of the dashboard."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "404": {
            "description": "The resource does not exist in this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "NOT_FOUND",
                  "message": "Endpoint not found."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "409": {
            "description": "The request conflicts with the state of the resource or with an earlier use of the Idempotency-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "WALLET_CURRENCY_MISMATCH",
                  "message": "The target currency must match the account wallet currency."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "429": {
            "description": "Call limit exceeded. Wait for the time in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests. Wait for the seconds in Retry-After before calling again."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before calling again."
              }
            }
          },
          "500": {
            "description": "Unexpected failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INTERNAL_ERROR",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "503": {
            "description": "A service needed by the operation is temporarily unavailable. Retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "SERVICE_UNAVAILABLE",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          }
        },
        "description": "Query only. Provide both currencies and exactly one amount in cents; repeated and unknown parameters are rejected.",
        "x-query-schema": {
          "$ref": "#/components/schemas/moneyInput"
        }
      }
    },
    "/orders": {
      "post": {
        "operationId": "createOrder",
        "summary": "Create order",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{1,80}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current resource or completed replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/order"
                },
                "example": {
                  "id": "ord_example",
                  "status": "pending_payment",
                  "source_currency": "BRL",
                  "source_amount_cents": "10000",
                  "target_currency": "CNY",
                  "target_amount_cents": "12500",
                  "refunded_source_amount_cents": "0",
                  "blocked_source_amount_cents": "0",
                  "payment": {
                    "url": "https://bytemax.exchange/pt-br/payment/0123456789abcdef0123456789abcdef",
                    "pix_copy_paste": "00020101021226820014br.gov.bcb.pix2560pix.example/qr/v2/0123456789abcdef0123456789abcdef5204000053039865406100.005802BR5907BYTEMAX6009SAO PAULO62070503***6304ABCD"
                  },
                  "created_at": "2026-09-10T13:05:00.000Z",
                  "expires_at": "2026-09-12T13:05:00.000Z"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "201": {
            "description": "Created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/order"
                },
                "example": {
                  "id": "ord_example",
                  "status": "pending_payment",
                  "source_currency": "BRL",
                  "source_amount_cents": "10000",
                  "target_currency": "CNY",
                  "target_amount_cents": "12500",
                  "refunded_source_amount_cents": "0",
                  "blocked_source_amount_cents": "0",
                  "payment": {
                    "url": "https://bytemax.exchange/pt-br/payment/0123456789abcdef0123456789abcdef",
                    "pix_copy_paste": "00020101021226820014br.gov.bcb.pix2560pix.example/qr/v2/0123456789abcdef0123456789abcdef5204000053039865406100.005802BR5907BYTEMAX6009SAO PAULO62070503***6304ABCD"
                  },
                  "created_at": "2026-09-10T13:05:00.000Z",
                  "expires_at": "2026-09-12T13:05:00.000Z"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "400": {
            "description": "A parameter, field or header is missing or malformed, or an amount is outside the limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INVALID_INPUT",
                  "message": "The request has missing, unknown or malformed fields. Check names and formats; amounts are strings of digits such as \"10000\"."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "401": {
            "description": "The API key is missing, malformed or no longer valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "UNAUTHORIZED",
                  "message": "A valid API key is required."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "403": {
            "description": "The account or the calling IP address may not use the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "API_IP_NOT_ALLOWED",
                  "message": "This IP address is not on the allowed IP list of the account. Add it on the API page of the dashboard."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "404": {
            "description": "The resource does not exist in this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "NOT_FOUND",
                  "message": "Endpoint not found."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "409": {
            "description": "The request conflicts with the state of the resource or with an earlier use of the Idempotency-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "IDEMPOTENCY_CONFLICT",
                  "message": "This Idempotency-Key was already used with a different request. Use a new key for a new operation."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "PAYLOAD_TOO_LARGE",
                  "message": "Payload too large."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "415": {
            "description": "The request does not declare Content-Type: application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "JSON_REQUIRED",
                  "message": "Use application/json."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "429": {
            "description": "Call limit exceeded. Wait for the time in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests. Wait for the seconds in Retry-After before calling again."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before calling again."
              }
            }
          },
          "500": {
            "description": "Unexpected failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INTERNAL_ERROR",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "503": {
            "description": "A service needed by the operation is temporarily unavailable. Retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "SERVICE_UNAVAILABLE",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/moneyInput"
              },
              "example": {
                "source_currency": "BRL",
                "source_amount_cents": "10000",
                "target_currency": "CNY"
              }
            }
          }
        }
      }
    },
    "/orders/{id}": {
      "get": {
        "operationId": "getOrder",
        "summary": "Get order",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,128}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current resource or completed replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/order"
                },
                "example": {
                  "id": "ord_example",
                  "status": "pending_payment",
                  "source_currency": "BRL",
                  "source_amount_cents": "10000",
                  "target_currency": "CNY",
                  "target_amount_cents": "12500",
                  "refunded_source_amount_cents": "0",
                  "blocked_source_amount_cents": "0",
                  "payment": {
                    "url": "https://bytemax.exchange/pt-br/payment/0123456789abcdef0123456789abcdef",
                    "pix_copy_paste": "00020101021226820014br.gov.bcb.pix2560pix.example/qr/v2/0123456789abcdef0123456789abcdef5204000053039865406100.005802BR5907BYTEMAX6009SAO PAULO62070503***6304ABCD"
                  },
                  "created_at": "2026-09-10T13:05:00.000Z",
                  "expires_at": "2026-09-12T13:05:00.000Z"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "400": {
            "description": "A parameter, field or header is missing or malformed, or an amount is outside the limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INVALID_INPUT",
                  "message": "The request has missing, unknown or malformed fields. Check names and formats; amounts are strings of digits such as \"10000\"."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "401": {
            "description": "The API key is missing, malformed or no longer valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "UNAUTHORIZED",
                  "message": "A valid API key is required."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "403": {
            "description": "The account or the calling IP address may not use the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "API_IP_NOT_ALLOWED",
                  "message": "This IP address is not on the allowed IP list of the account. Add it on the API page of the dashboard."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "404": {
            "description": "The resource does not exist in this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "ORDER_NOT_FOUND",
                  "message": "Order not found."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "429": {
            "description": "Call limit exceeded. Wait for the time in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests. Wait for the seconds in Retry-After before calling again."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before calling again."
              }
            }
          },
          "500": {
            "description": "Unexpected failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INTERNAL_ERROR",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "503": {
            "description": "A service needed by the operation is temporarily unavailable. Retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "SERVICE_UNAVAILABLE",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          }
        }
      }
    },
    "/orders/{id}/refunds": {
      "post": {
        "operationId": "createRefund",
        "summary": "Create refund",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,128}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{1,80}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current resource or completed replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/refund"
                },
                "example": {
                  "id": "9007199254741001",
                  "order_id": "ord_example",
                  "status": "succeeded",
                  "source_currency": "BRL",
                  "source_amount_cents": "2000",
                  "target_currency": "CNY",
                  "target_amount_cents": "2500",
                  "created_at": "2026-09-10T13:05:00.000Z",
                  "updated_at": "2026-09-10T13:05:00.000Z"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "202": {
            "description": "Operation recorded; query its state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/refund"
                },
                "example": {
                  "id": "9007199254741001",
                  "order_id": "ord_example",
                  "status": "processing",
                  "source_currency": "BRL",
                  "source_amount_cents": "2000",
                  "target_currency": "CNY",
                  "target_amount_cents": "2500",
                  "created_at": "2026-09-10T13:05:00.000Z",
                  "updated_at": "2026-09-10T13:05:00.000Z"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "400": {
            "description": "A parameter, field or header is missing or malformed, or an amount is outside the limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INVALID_INPUT",
                  "message": "The request has missing, unknown or malformed fields. Check names and formats; amounts are strings of digits such as \"10000\"."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "401": {
            "description": "The API key is missing, malformed or no longer valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "UNAUTHORIZED",
                  "message": "A valid API key is required."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "403": {
            "description": "The account or the calling IP address may not use the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "API_IP_NOT_ALLOWED",
                  "message": "This IP address is not on the allowed IP list of the account. Add it on the API page of the dashboard."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "404": {
            "description": "The resource does not exist in this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "ORDER_NOT_FOUND",
                  "message": "Order not found."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "409": {
            "description": "The request conflicts with the state of the resource or with an earlier use of the Idempotency-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "ORDER_NOT_REFUNDABLE",
                  "message": "Only completed orders can be refunded."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "410": {
            "description": "The order was paid through a method that is no longer supported.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "PAYMENT_METHOD_RETIRED",
                  "message": "This order was paid through a method that is no longer supported. Contact ByteMax support to refund it."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "PAYLOAD_TOO_LARGE",
                  "message": "Payload too large."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "415": {
            "description": "The request does not declare Content-Type: application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "JSON_REQUIRED",
                  "message": "Use application/json."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "429": {
            "description": "Call limit exceeded. Wait for the time in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests. Wait for the seconds in Retry-After before calling again."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before calling again."
              }
            }
          },
          "500": {
            "description": "Unexpected failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INTERNAL_ERROR",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "503": {
            "description": "A service needed by the operation is temporarily unavailable. Retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "SERVICE_UNAVAILABLE",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/refundInput"
              },
              "example": {
                "target_amount_cents": "2500"
              }
            }
          }
        }
      }
    },
    "/orders/{id}/refunds/{refund_id}": {
      "get": {
        "operationId": "getRefund",
        "summary": "Get refund",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,128}$"
            }
          },
          {
            "name": "refund_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}$",
              "description": "Positive decimal BIGINT string, at most 9223372036854775807. Historical identifiers are not accepted."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current resource or completed replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/refund"
                },
                "example": {
                  "id": "9007199254741001",
                  "order_id": "ord_example",
                  "status": "processing",
                  "source_currency": "BRL",
                  "source_amount_cents": "2000",
                  "target_currency": "CNY",
                  "target_amount_cents": "2500",
                  "created_at": "2026-09-10T13:05:00.000Z",
                  "updated_at": "2026-09-10T13:05:00.000Z"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "400": {
            "description": "A parameter, field or header is missing or malformed, or an amount is outside the limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INVALID_INPUT",
                  "message": "The request has missing, unknown or malformed fields. Check names and formats; amounts are strings of digits such as \"10000\"."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "401": {
            "description": "The API key is missing, malformed or no longer valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "UNAUTHORIZED",
                  "message": "A valid API key is required."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "403": {
            "description": "The account or the calling IP address may not use the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "API_IP_NOT_ALLOWED",
                  "message": "This IP address is not on the allowed IP list of the account. Add it on the API page of the dashboard."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "404": {
            "description": "The resource does not exist in this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "REFUND_NOT_FOUND",
                  "message": "Refund not found."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "429": {
            "description": "Call limit exceeded. Wait for the time in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests. Wait for the seconds in Retry-After before calling again."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before calling again."
              }
            }
          },
          "500": {
            "description": "Unexpected failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INTERNAL_ERROR",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "503": {
            "description": "A service needed by the operation is temporarily unavailable. Retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "SERVICE_UNAVAILABLE",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          }
        }
      }
    },
    "/webhooks": {
      "post": {
        "operationId": "createWebhook",
        "summary": "Create webhook",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/configuredWebhook"
                },
                "example": {
                  "id": "ep_example",
                  "url": "https://merchant.example/webhooks/bytemax",
                  "events": [
                    "order.created",
                    "order.completed",
                    "order.expired",
                    "order.canceled",
                    "order.updated",
                    "refund.created",
                    "refund.succeeded",
                    "refund.failed"
                  ],
                  "enabled": true,
                  "api_version": "v1",
                  "signing_secret": "<WEBHOOK_SIGNING_SECRET>"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "400": {
            "description": "A parameter, field or header is missing or malformed, or an amount is outside the limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INVALID_INPUT",
                  "message": "The request has missing, unknown or malformed fields. Check names and formats; amounts are strings of digits such as \"10000\"."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "401": {
            "description": "The API key is missing, malformed or no longer valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "UNAUTHORIZED",
                  "message": "A valid API key is required."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "403": {
            "description": "The account or the calling IP address may not use the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "API_IP_NOT_ALLOWED",
                  "message": "This IP address is not on the allowed IP list of the account. Add it on the API page of the dashboard."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "404": {
            "description": "The resource does not exist in this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "NOT_FOUND",
                  "message": "Endpoint not found."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "409": {
            "description": "The request conflicts with the state of the resource or with an earlier use of the Idempotency-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "WEBHOOK_URL_EXISTS",
                  "message": "A webhook with this URL already exists."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "PAYLOAD_TOO_LARGE",
                  "message": "Payload too large."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "415": {
            "description": "The request does not declare Content-Type: application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "JSON_REQUIRED",
                  "message": "Use application/json."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "429": {
            "description": "Call limit exceeded. Wait for the time in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests. Wait for the seconds in Retry-After before calling again."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before calling again."
              }
            }
          },
          "500": {
            "description": "Unexpected failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INTERNAL_ERROR",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "503": {
            "description": "A service needed by the operation is temporarily unavailable. Retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "SERVICE_UNAVAILABLE",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/webhookInput"
              },
              "example": {
                "url": "https://merchant.example/webhooks/bytemax",
                "events": [
                  "order.created",
                  "order.completed",
                  "order.expired",
                  "order.canceled",
                  "order.updated",
                  "refund.created",
                  "refund.succeeded",
                  "refund.failed"
                ],
                "enabled": true
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listWebhooks",
        "summary": "List webhooks",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 30
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current resource or completed replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/webhooksPage"
                },
                "example": {
                  "items": [
                    {
                      "id": "ep_example",
                      "url": "https://merchant.example/webhooks/bytemax",
                      "events": [
                        "order.created",
                        "order.completed",
                        "order.expired",
                        "order.canceled",
                        "order.updated",
                        "refund.created",
                        "refund.succeeded",
                        "refund.failed"
                      ],
                      "enabled": true,
                      "api_version": "v1"
                    }
                  ],
                  "next_cursor": null
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "400": {
            "description": "A parameter, field or header is missing or malformed, or an amount is outside the limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INVALID_INPUT",
                  "message": "The request has missing, unknown or malformed fields. Check names and formats; amounts are strings of digits such as \"10000\"."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "401": {
            "description": "The API key is missing, malformed or no longer valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "UNAUTHORIZED",
                  "message": "A valid API key is required."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "403": {
            "description": "The account or the calling IP address may not use the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "API_IP_NOT_ALLOWED",
                  "message": "This IP address is not on the allowed IP list of the account. Add it on the API page of the dashboard."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "404": {
            "description": "The resource does not exist in this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "NOT_FOUND",
                  "message": "Endpoint not found."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "429": {
            "description": "Call limit exceeded. Wait for the time in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests. Wait for the seconds in Retry-After before calling again."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before calling again."
              }
            }
          },
          "500": {
            "description": "Unexpected failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INTERNAL_ERROR",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "503": {
            "description": "A service needed by the operation is temporarily unavailable. Retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "SERVICE_UNAVAILABLE",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          }
        }
      }
    },
    "/webhooks/{id}": {
      "get": {
        "operationId": "getWebhook",
        "summary": "Get webhook",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,128}$"
            }
          },
          {
            "name": "include_signing_secret",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current resource or completed replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/configuredWebhook"
                },
                "example": {
                  "id": "ep_example",
                  "url": "https://merchant.example/webhooks/bytemax",
                  "events": [
                    "order.created",
                    "order.completed",
                    "order.expired",
                    "order.canceled",
                    "order.updated",
                    "refund.created",
                    "refund.succeeded",
                    "refund.failed"
                  ],
                  "enabled": true,
                  "api_version": "v1",
                  "signing_secret": "<WEBHOOK_SIGNING_SECRET>"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "400": {
            "description": "A parameter, field or header is missing or malformed, or an amount is outside the limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INVALID_INPUT",
                  "message": "The request has missing, unknown or malformed fields. Check names and formats; amounts are strings of digits such as \"10000\"."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "401": {
            "description": "The API key is missing, malformed or no longer valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "UNAUTHORIZED",
                  "message": "A valid API key is required."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "403": {
            "description": "The account or the calling IP address may not use the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "API_IP_NOT_ALLOWED",
                  "message": "This IP address is not on the allowed IP list of the account. Add it on the API page of the dashboard."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "404": {
            "description": "The resource does not exist in this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "WEBHOOK_NOT_FOUND",
                  "message": "Webhook not found."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "429": {
            "description": "Call limit exceeded. Wait for the time in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests. Wait for the seconds in Retry-After before calling again."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before calling again."
              }
            }
          },
          "500": {
            "description": "Unexpected failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INTERNAL_ERROR",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "503": {
            "description": "A service needed by the operation is temporarily unavailable. Retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "SERVICE_UNAVAILABLE",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateWebhook",
        "summary": "Update webhook",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,128}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current resource or completed replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/webhook"
                },
                "example": {
                  "id": "ep_example",
                  "url": "https://merchant.example/webhooks/bytemax",
                  "events": [
                    "order.created",
                    "order.completed",
                    "order.expired",
                    "order.canceled",
                    "order.updated",
                    "refund.created",
                    "refund.succeeded",
                    "refund.failed"
                  ],
                  "enabled": true,
                  "api_version": "v1"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "400": {
            "description": "A parameter, field or header is missing or malformed, or an amount is outside the limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INVALID_INPUT",
                  "message": "The request has missing, unknown or malformed fields. Check names and formats; amounts are strings of digits such as \"10000\"."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "401": {
            "description": "The API key is missing, malformed or no longer valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "UNAUTHORIZED",
                  "message": "A valid API key is required."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "403": {
            "description": "The account or the calling IP address may not use the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "API_IP_NOT_ALLOWED",
                  "message": "This IP address is not on the allowed IP list of the account. Add it on the API page of the dashboard."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "404": {
            "description": "The resource does not exist in this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "WEBHOOK_NOT_FOUND",
                  "message": "Webhook not found."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "409": {
            "description": "The request conflicts with the state of the resource or with an earlier use of the Idempotency-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "WEBHOOK_URL_EXISTS",
                  "message": "A webhook with this URL already exists."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "PAYLOAD_TOO_LARGE",
                  "message": "Payload too large."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "415": {
            "description": "The request does not declare Content-Type: application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "JSON_REQUIRED",
                  "message": "Use application/json."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "429": {
            "description": "Call limit exceeded. Wait for the time in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests. Wait for the seconds in Retry-After before calling again."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before calling again."
              }
            }
          },
          "500": {
            "description": "Unexpected failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INTERNAL_ERROR",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "503": {
            "description": "A service needed by the operation is temporarily unavailable. Retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "SERVICE_UNAVAILABLE",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/webhookPatch"
              },
              "example": {
                "api_version": "v1",
                "events": [
                  "order.created",
                  "order.completed",
                  "order.expired",
                  "order.canceled",
                  "order.updated",
                  "refund.created",
                  "refund.succeeded",
                  "refund.failed"
                ],
                "enabled": true
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteWebhook",
        "summary": "Delete webhook",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,128}$"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted.",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "400": {
            "description": "A parameter, field or header is missing or malformed, or an amount is outside the limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INVALID_INPUT",
                  "message": "The request has missing, unknown or malformed fields. Check names and formats; amounts are strings of digits such as \"10000\"."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "401": {
            "description": "The API key is missing, malformed or no longer valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "UNAUTHORIZED",
                  "message": "A valid API key is required."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "403": {
            "description": "The account or the calling IP address may not use the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "API_IP_NOT_ALLOWED",
                  "message": "This IP address is not on the allowed IP list of the account. Add it on the API page of the dashboard."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "404": {
            "description": "The resource does not exist in this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "WEBHOOK_NOT_FOUND",
                  "message": "Webhook not found."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "409": {
            "description": "The request conflicts with the state of the resource or with an earlier use of the Idempotency-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "CONFLICT",
                  "message": "The request was refused. If it persists, contact ByteMax support with the X-Request-Id of the response."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "429": {
            "description": "Call limit exceeded. Wait for the time in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests. Wait for the seconds in Retry-After before calling again."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before calling again."
              }
            }
          },
          "500": {
            "description": "Unexpected failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INTERNAL_ERROR",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "503": {
            "description": "A service needed by the operation is temporarily unavailable. Retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "SERVICE_UNAVAILABLE",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          }
        }
      }
    },
    "/events": {
      "get": {
        "operationId": "listEvents",
        "summary": "List events",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 30
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current resource or completed replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/eventsPage"
                },
                "example": {
                  "items": [
                    {
                      "id": "evt_example",
                      "type": "order.completed",
                      "created_at": "2026-09-10T13:05:00.000Z",
                      "related_object": {
                        "type": "order",
                        "id": "ord_example",
                        "url": "/api/v1/orders/ord_example"
                      },
                      "publication_status": "published"
                    }
                  ],
                  "next_cursor": null
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "400": {
            "description": "A parameter, field or header is missing or malformed, or an amount is outside the limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INVALID_INPUT",
                  "message": "The request has missing, unknown or malformed fields. Check names and formats; amounts are strings of digits such as \"10000\"."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "401": {
            "description": "The API key is missing, malformed or no longer valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "UNAUTHORIZED",
                  "message": "A valid API key is required."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "403": {
            "description": "The account or the calling IP address may not use the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "API_IP_NOT_ALLOWED",
                  "message": "This IP address is not on the allowed IP list of the account. Add it on the API page of the dashboard."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "404": {
            "description": "The resource does not exist in this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "NOT_FOUND",
                  "message": "Endpoint not found."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "429": {
            "description": "Call limit exceeded. Wait for the time in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests. Wait for the seconds in Retry-After before calling again."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before calling again."
              }
            }
          },
          "500": {
            "description": "Unexpected failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INTERNAL_ERROR",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "503": {
            "description": "A service needed by the operation is temporarily unavailable. Retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "SERVICE_UNAVAILABLE",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          }
        }
      }
    },
    "/events/{id}": {
      "get": {
        "operationId": "getEvent",
        "summary": "Get event",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,128}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current resource or completed replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/publishedEvent"
                },
                "example": {
                  "id": "evt_example",
                  "type": "order.completed",
                  "created_at": "2026-09-10T13:05:00.000Z",
                  "related_object": {
                    "type": "order",
                    "id": "ord_example",
                    "url": "/api/v1/orders/ord_example"
                  },
                  "publication_status": "published"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "400": {
            "description": "A parameter, field or header is missing or malformed, or an amount is outside the limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INVALID_INPUT",
                  "message": "The request has missing, unknown or malformed fields. Check names and formats; amounts are strings of digits such as \"10000\"."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "401": {
            "description": "The API key is missing, malformed or no longer valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "UNAUTHORIZED",
                  "message": "A valid API key is required."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "403": {
            "description": "The account or the calling IP address may not use the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "API_IP_NOT_ALLOWED",
                  "message": "This IP address is not on the allowed IP list of the account. Add it on the API page of the dashboard."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "404": {
            "description": "The resource does not exist in this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "EVENT_NOT_FOUND",
                  "message": "Event not found."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "429": {
            "description": "Call limit exceeded. Wait for the time in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests. Wait for the seconds in Retry-After before calling again."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before calling again."
              }
            }
          },
          "500": {
            "description": "Unexpected failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INTERNAL_ERROR",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "503": {
            "description": "A service needed by the operation is temporarily unavailable. Retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "SERVICE_UNAVAILABLE",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          }
        }
      }
    },
    "/webhooks/{id}/deliveries": {
      "get": {
        "operationId": "listDeliveries",
        "summary": "List deliveries",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,128}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 30
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "string",
              "enum": [
                "succeeded",
                "failed"
              ]
            }
          },
          {
            "name": "event_type",
            "in": "query",
            "required": false,
            "schema": {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "type": "string",
              "enum": [
                "order.created",
                "order.completed",
                "order.expired",
                "order.canceled",
                "order.updated",
                "refund.created",
                "refund.succeeded",
                "refund.failed",
                "webhook.test"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current resource or completed replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/deliveriesPage"
                },
                "example": {
                  "items": [
                    {
                      "id": "atm_example",
                      "webhook_id": "ep_example",
                      "message_id": "msg_example",
                      "event_id": "evt_example",
                      "event_type": "order.completed",
                      "status": "succeeded",
                      "attempted_at": "2026-09-10T13:05:02.000Z",
                      "http_status": 200,
                      "duration_ms": 84
                    }
                  ],
                  "next_cursor": null
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "400": {
            "description": "A parameter, field or header is missing or malformed, or an amount is outside the limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INVALID_INPUT",
                  "message": "The request has missing, unknown or malformed fields. Check names and formats; amounts are strings of digits such as \"10000\"."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "401": {
            "description": "The API key is missing, malformed or no longer valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "UNAUTHORIZED",
                  "message": "A valid API key is required."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "403": {
            "description": "The account or the calling IP address may not use the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "API_IP_NOT_ALLOWED",
                  "message": "This IP address is not on the allowed IP list of the account. Add it on the API page of the dashboard."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "404": {
            "description": "The resource does not exist in this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "WEBHOOK_NOT_FOUND",
                  "message": "Webhook not found."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "429": {
            "description": "Call limit exceeded. Wait for the time in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests. Wait for the seconds in Retry-After before calling again."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before calling again."
              }
            }
          },
          "500": {
            "description": "Unexpected failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INTERNAL_ERROR",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "503": {
            "description": "A service needed by the operation is temporarily unavailable. Retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "SERVICE_UNAVAILABLE",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          }
        }
      }
    },
    "/webhooks/{id}/test-events": {
      "post": {
        "operationId": "createTestEvent",
        "summary": "Send test event",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,128}$"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Operation recorded; query its state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/publishedEvent"
                },
                "example": {
                  "id": "evt_test_example",
                  "type": "webhook.test",
                  "created_at": "2026-09-10T13:05:00.000Z",
                  "related_object": {
                    "type": "webhook",
                    "id": "ep_example",
                    "url": "/api/v1/webhooks/ep_example"
                  },
                  "publication_status": "pending"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "400": {
            "description": "A parameter, field or header is missing or malformed, or an amount is outside the limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INVALID_INPUT",
                  "message": "The request has missing, unknown or malformed fields. Check names and formats; amounts are strings of digits such as \"10000\"."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "401": {
            "description": "The API key is missing, malformed or no longer valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "UNAUTHORIZED",
                  "message": "A valid API key is required."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "403": {
            "description": "The account or the calling IP address may not use the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "API_IP_NOT_ALLOWED",
                  "message": "This IP address is not on the allowed IP list of the account. Add it on the API page of the dashboard."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "404": {
            "description": "The resource does not exist in this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "WEBHOOK_NOT_FOUND",
                  "message": "Webhook not found."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "409": {
            "description": "The request conflicts with the state of the resource or with an earlier use of the Idempotency-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "WEBHOOK_NOT_ENABLED_FOR_V1",
                  "message": "This webhook is disabled or still uses the previous format. Enable it and set api_version to v1 first."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "PAYLOAD_TOO_LARGE",
                  "message": "Payload too large."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "415": {
            "description": "The request does not declare Content-Type: application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "JSON_REQUIRED",
                  "message": "Use application/json."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "429": {
            "description": "Call limit exceeded. Wait for the time in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests. Wait for the seconds in Retry-After before calling again."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before calling again."
              }
            }
          },
          "500": {
            "description": "Unexpected failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INTERNAL_ERROR",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "503": {
            "description": "A service needed by the operation is temporarily unavailable. Retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "SERVICE_UNAVAILABLE",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              },
              "example": {}
            }
          }
        }
      }
    },
    "/webhooks/{id}/redeliveries": {
      "post": {
        "operationId": "redeliverEvents",
        "summary": "Resend events",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,128}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current resource or completed replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/redelivery"
                },
                "example": {
                  "items": [
                    {
                      "event_id": "evt_example",
                      "status": "queued"
                    }
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "400": {
            "description": "A parameter, field or header is missing or malformed, or an amount is outside the limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INVALID_INPUT",
                  "message": "The request has missing, unknown or malformed fields. Check names and formats; amounts are strings of digits such as \"10000\"."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "401": {
            "description": "The API key is missing, malformed or no longer valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "UNAUTHORIZED",
                  "message": "A valid API key is required."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "403": {
            "description": "The account or the calling IP address may not use the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "API_IP_NOT_ALLOWED",
                  "message": "This IP address is not on the allowed IP list of the account. Add it on the API page of the dashboard."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "404": {
            "description": "The resource does not exist in this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "WEBHOOK_NOT_FOUND",
                  "message": "Webhook not found."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "409": {
            "description": "The request conflicts with the state of the resource or with an earlier use of the Idempotency-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "WEBHOOK_NOT_ENABLED_FOR_V1",
                  "message": "This webhook is disabled or still uses the previous format. Enable it and set api_version to v1 first."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "PAYLOAD_TOO_LARGE",
                  "message": "Payload too large."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "415": {
            "description": "The request does not declare Content-Type: application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "JSON_REQUIRED",
                  "message": "Use application/json."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "429": {
            "description": "Call limit exceeded. Wait for the time in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Too many requests. Wait for the seconds in Retry-After before calling again."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before calling again."
              }
            }
          },
          "500": {
            "description": "Unexpected failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "INTERNAL_ERROR",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          },
          "503": {
            "description": "A service needed by the operation is temporarily unavailable. Retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                },
                "example": {
                  "code": "SERVICE_UNAVAILABLE",
                  "message": "The request could not be completed."
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request correlation identifier."
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/redeliveryInput"
              },
              "example": {
                "event_ids": [
                  "evt_example"
                ]
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key"
      }
    },
    "schemas": {
      "moneyInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "source_currency": {
                "type": "string",
                "const": "BRL"
              },
              "target_currency": {
                "type": "string",
                "enum": [
                  "CNY",
                  "USD"
                ]
              },
              "source_amount_cents": {
                "type": "string",
                "maxLength": 32,
                "pattern": "^[1-9][0-9]*$"
              }
            },
            "required": [
              "source_currency",
              "target_currency",
              "source_amount_cents"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "source_currency": {
                "type": "string",
                "const": "BRL"
              },
              "target_currency": {
                "type": "string",
                "enum": [
                  "CNY",
                  "USD"
                ]
              },
              "target_amount_cents": {
                "type": "string",
                "maxLength": 32,
                "pattern": "^[1-9][0-9]*$"
              }
            },
            "required": [
              "source_currency",
              "target_currency",
              "target_amount_cents"
            ],
            "additionalProperties": false
          }
        ],
        "examples": [
          {
            "source_currency": "BRL",
            "source_amount_cents": "10000",
            "target_currency": "CNY"
          }
        ]
      },
      "refundInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "target_amount_cents": {
            "type": "string",
            "maxLength": 32,
            "pattern": "^[1-9][0-9]*$"
          }
        },
        "required": [
          "target_amount_cents"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "target_amount_cents": "2500"
          }
        ]
      },
      "order": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,128}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending_payment",
              "completed",
              "expired",
              "canceled"
            ]
          },
          "source_currency": {
            "type": "string",
            "enum": [
              "BRL",
              "CNY",
              "USD"
            ]
          },
          "source_amount_cents": {
            "type": "string",
            "maxLength": 32,
            "pattern": "^(0|[1-9][0-9]*)$"
          },
          "target_currency": {
            "type": "string",
            "enum": [
              "BRL",
              "CNY",
              "USD"
            ]
          },
          "target_amount_cents": {
            "type": "string",
            "maxLength": 32,
            "pattern": "^(0|[1-9][0-9]*)$"
          },
          "refunded_source_amount_cents": {
            "type": "string",
            "maxLength": 32,
            "pattern": "^(0|[1-9][0-9]*)$"
          },
          "blocked_source_amount_cents": {
            "type": "string",
            "maxLength": 32,
            "pattern": "^(0|[1-9][0-9]*)$"
          },
          "payment": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "pix_copy_paste": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "url",
                  "pix_copy_paste"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "48 hours after created_at. An order still pending_payment then can no longer be paid and expires."
          }
        },
        "required": [
          "id",
          "status",
          "source_currency",
          "source_amount_cents",
          "target_currency",
          "target_amount_cents",
          "refunded_source_amount_cents",
          "blocked_source_amount_cents",
          "payment",
          "created_at",
          "expires_at"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "id": "ord_example",
            "status": "pending_payment",
            "source_currency": "BRL",
            "source_amount_cents": "10000",
            "target_currency": "CNY",
            "target_amount_cents": "12500",
            "refunded_source_amount_cents": "0",
            "blocked_source_amount_cents": "0",
            "payment": {
              "url": "https://bytemax.exchange/pt-br/payment/0123456789abcdef0123456789abcdef",
              "pix_copy_paste": "00020101021226820014br.gov.bcb.pix2560pix.example/qr/v2/0123456789abcdef0123456789abcdef5204000053039865406100.005802BR5907BYTEMAX6009SAO PAULO62070503***6304ABCD"
            },
            "created_at": "2026-09-10T13:05:00.000Z",
            "expires_at": "2026-09-12T13:05:00.000Z"
          }
        ]
      },
      "refund": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$",
            "description": "Positive decimal BIGINT string, at most 9223372036854775807."
          },
          "order_id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,128}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "processing",
              "succeeded",
              "failed"
            ]
          },
          "source_currency": {
            "type": "string",
            "enum": [
              "BRL",
              "CNY",
              "USD"
            ]
          },
          "source_amount_cents": {
            "type": "string",
            "maxLength": 32,
            "pattern": "^(0|[1-9][0-9]*)$"
          },
          "target_currency": {
            "type": "string",
            "enum": [
              "BRL",
              "CNY",
              "USD"
            ]
          },
          "target_amount_cents": {
            "type": "string",
            "maxLength": 32,
            "pattern": "^(0|[1-9][0-9]*)$"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": [
          "id",
          "order_id",
          "status",
          "source_currency",
          "source_amount_cents",
          "target_currency",
          "target_amount_cents",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "id": "9007199254741001",
            "order_id": "ord_example",
            "status": "processing",
            "source_currency": "BRL",
            "source_amount_cents": "2000",
            "target_currency": "CNY",
            "target_amount_cents": "2500",
            "created_at": "2026-09-10T13:05:00.000Z",
            "updated_at": "2026-09-10T13:05:00.000Z"
          }
        ]
      },
      "quote": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "source_currency": {
            "type": "string",
            "enum": [
              "BRL",
              "CNY",
              "USD"
            ]
          },
          "source_amount_cents": {
            "type": "string",
            "maxLength": 32,
            "pattern": "^(0|[1-9][0-9]*)$"
          },
          "target_currency": {
            "type": "string",
            "enum": [
              "BRL",
              "CNY",
              "USD"
            ]
          },
          "target_amount_cents": {
            "type": "string",
            "maxLength": 32,
            "pattern": "^(0|[1-9][0-9]*)$"
          }
        },
        "required": [
          "source_currency",
          "source_amount_cents",
          "target_currency",
          "target_amount_cents"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "source_currency": "BRL",
            "source_amount_cents": "10000",
            "target_currency": "CNY",
            "target_amount_cents": "12500"
          }
        ]
      },
      "webhookInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 2048,
            "format": "uri"
          },
          "events": {
            "minItems": 1,
            "maxItems": 8,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "order.created",
                "order.completed",
                "order.expired",
                "order.canceled",
                "order.updated",
                "refund.created",
                "refund.succeeded",
                "refund.failed"
              ]
            },
            "uniqueItems": true
          },
          "enabled": {
            "default": true,
            "type": "boolean"
          }
        },
        "required": [
          "url",
          "events"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "url": "https://merchant.example/webhooks/bytemax",
            "events": [
              "order.created",
              "order.completed",
              "order.expired",
              "order.canceled",
              "order.updated",
              "refund.created",
              "refund.succeeded",
              "refund.failed"
            ],
            "enabled": true
          }
        ]
      },
      "webhookPatch": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 2048,
            "format": "uri"
          },
          "events": {
            "minItems": 1,
            "maxItems": 8,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "order.created",
                "order.completed",
                "order.expired",
                "order.canceled",
                "order.updated",
                "refund.created",
                "refund.succeeded",
                "refund.failed"
              ]
            },
            "uniqueItems": true
          },
          "enabled": {
            "type": "boolean"
          },
          "api_version": {
            "type": "string",
            "const": "v1"
          }
        },
        "additionalProperties": false,
        "minProperties": 1,
        "examples": [
          {
            "api_version": "v1",
            "events": [
              "order.created",
              "order.completed",
              "order.expired",
              "order.canceled",
              "order.updated",
              "refund.created",
              "refund.succeeded",
              "refund.failed"
            ],
            "enabled": true
          }
        ]
      },
      "redeliveryInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "event_ids": {
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,128}$"
            },
            "uniqueItems": true
          }
        },
        "required": [
          "event_ids"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "event_ids": [
              "evt_example"
            ]
          }
        ]
      },
      "error": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "details": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "code",
          "message"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "code": "INVALID_INPUT",
            "message": "Use source_currency BRL and the supplier wallet currency, CNY or USD."
          }
        ]
      },
      "webhook": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,128}$"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "v1",
              "legacy"
            ]
          }
        },
        "required": [
          "id",
          "url",
          "events",
          "enabled",
          "api_version"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "id": "ep_example",
            "url": "https://merchant.example/webhooks/bytemax",
            "events": [
              "order.created",
              "order.completed",
              "order.expired",
              "order.canceled",
              "order.updated",
              "refund.created",
              "refund.succeeded",
              "refund.failed"
            ],
            "enabled": true,
            "api_version": "v1"
          }
        ]
      },
      "configuredWebhook": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,128}$"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "v1",
              "legacy"
            ]
          },
          "signing_secret": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "url",
          "events",
          "enabled",
          "api_version"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "id": "ep_example",
            "url": "https://merchant.example/webhooks/bytemax",
            "events": [
              "order.created",
              "order.completed",
              "order.expired",
              "order.canceled",
              "order.updated",
              "refund.created",
              "refund.succeeded",
              "refund.failed"
            ],
            "enabled": true,
            "api_version": "v1",
            "signing_secret": "<WEBHOOK_SIGNING_SECRET>"
          }
        ]
      },
      "event": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,128}$"
          },
          "type": {
            "type": "string",
            "enum": [
              "order.created",
              "order.completed",
              "order.expired",
              "order.canceled",
              "order.updated",
              "refund.created",
              "refund.succeeded",
              "refund.failed",
              "webhook.test"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "related_object": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "order",
                  "refund",
                  "webhook"
                ]
              },
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{1,128}$"
              },
              "url": {
                "type": "string",
                "pattern": "^\\/api\\/v1\\/[A-Za-z0-9_/-]+$"
              }
            },
            "required": [
              "type",
              "id",
              "url"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "type",
          "created_at",
          "related_object"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "id": "evt_example",
            "type": "order.completed",
            "created_at": "2026-09-10T13:05:00.000Z",
            "related_object": {
              "type": "order",
              "id": "ord_example",
              "url": "/api/v1/orders/ord_example"
            }
          }
        ]
      },
      "publishedEvent": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,128}$"
          },
          "type": {
            "type": "string",
            "enum": [
              "order.created",
              "order.completed",
              "order.expired",
              "order.canceled",
              "order.updated",
              "refund.created",
              "refund.succeeded",
              "refund.failed",
              "webhook.test"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "related_object": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "order",
                  "refund",
                  "webhook"
                ]
              },
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{1,128}$"
              },
              "url": {
                "type": "string",
                "pattern": "^\\/api\\/v1\\/[A-Za-z0-9_/-]+$"
              }
            },
            "required": [
              "type",
              "id",
              "url"
            ],
            "additionalProperties": false
          },
          "publication_status": {
            "type": "string",
            "enum": [
              "pending",
              "published",
              "not_published"
            ]
          }
        },
        "required": [
          "id",
          "type",
          "created_at",
          "related_object",
          "publication_status"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "id": "evt_example",
            "type": "order.completed",
            "created_at": "2026-09-10T13:05:00.000Z",
            "related_object": {
              "type": "order",
              "id": "ord_example",
              "url": "/api/v1/orders/ord_example"
            },
            "publication_status": "published"
          }
        ]
      },
      "delivery": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,128}$"
          },
          "webhook_id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,128}$"
          },
          "message_id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,128}$"
          },
          "event_id": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{1,128}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "event_type": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "order.created",
                  "order.completed",
                  "order.expired",
                  "order.canceled",
                  "order.updated",
                  "refund.created",
                  "refund.succeeded",
                  "refund.failed",
                  "webhook.test"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed"
            ]
          },
          "attempted_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "http_status": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "duration_ms": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "webhook_id",
          "message_id",
          "event_id",
          "event_type",
          "status",
          "attempted_at",
          "http_status",
          "duration_ms"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "id": "atm_example",
            "webhook_id": "ep_example",
            "message_id": "msg_example",
            "event_id": "evt_example",
            "event_type": "order.completed",
            "status": "succeeded",
            "attempted_at": "2026-09-10T13:05:02.000Z",
            "http_status": 200,
            "duration_ms": 84
          }
        ]
      },
      "redelivery": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "event_id": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,128}$"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "retry"
                      ]
                    }
                  },
                  "required": [
                    "event_id",
                    "status"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "event_id": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,128}$"
                    },
                    "status": {
                      "type": "string",
                      "const": "rejected"
                    },
                    "code": {
                      "type": "string",
                      "enum": [
                        "EVENT_NOT_FOUND",
                        "EVENT_NOT_ACCEPTED",
                        "EVENT_NOT_PUBLISHED",
                        "REDELIVERY_REJECTED"
                      ]
                    }
                  },
                  "required": [
                    "event_id",
                    "status",
                    "code"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "items": [
              {
                "event_id": "evt_example",
                "status": "queued"
              }
            ]
          }
        ]
      },
      "webhooksPage": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9_-]{1,128}$"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "events": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "enabled": {
                  "type": "boolean"
                },
                "api_version": {
                  "type": "string",
                  "enum": [
                    "v1",
                    "legacy"
                  ]
                }
              },
              "required": [
                "id",
                "url",
                "events",
                "enabled",
                "api_version"
              ],
              "additionalProperties": false
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "next_cursor"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "items": [
              {
                "id": "ep_example",
                "url": "https://merchant.example/webhooks/bytemax",
                "events": [
                  "order.created",
                  "order.completed",
                  "order.expired",
                  "order.canceled",
                  "order.updated",
                  "refund.created",
                  "refund.succeeded",
                  "refund.failed"
                ],
                "enabled": true,
                "api_version": "v1"
              }
            ],
            "next_cursor": null
          }
        ]
      },
      "eventsPage": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9_-]{1,128}$"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "order.created",
                    "order.completed",
                    "order.expired",
                    "order.canceled",
                    "order.updated",
                    "refund.created",
                    "refund.succeeded",
                    "refund.failed",
                    "webhook.test"
                  ]
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "related_object": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "order",
                        "refund",
                        "webhook"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,128}$"
                    },
                    "url": {
                      "type": "string",
                      "pattern": "^\\/api\\/v1\\/[A-Za-z0-9_/-]+$"
                    }
                  },
                  "required": [
                    "type",
                    "id",
                    "url"
                  ],
                  "additionalProperties": false
                },
                "publication_status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "published",
                    "not_published"
                  ]
                }
              },
              "required": [
                "id",
                "type",
                "created_at",
                "related_object",
                "publication_status"
              ],
              "additionalProperties": false
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "next_cursor"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "items": [
              {
                "id": "evt_example",
                "type": "order.completed",
                "created_at": "2026-09-10T13:05:00.000Z",
                "related_object": {
                  "type": "order",
                  "id": "ord_example",
                  "url": "/api/v1/orders/ord_example"
                },
                "publication_status": "published"
              }
            ],
            "next_cursor": null
          }
        ]
      },
      "deliveriesPage": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9_-]{1,128}$"
                },
                "webhook_id": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9_-]{1,128}$"
                },
                "message_id": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9_-]{1,128}$"
                },
                "event_id": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,128}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "event_type": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "order.created",
                        "order.completed",
                        "order.expired",
                        "order.canceled",
                        "order.updated",
                        "refund.created",
                        "refund.succeeded",
                        "refund.failed",
                        "webhook.test"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "succeeded",
                    "failed"
                  ]
                },
                "attempted_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "http_status": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "duration_ms": {
                  "anyOf": [
                    {
                      "type": "number",
                      "minimum": 0
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "webhook_id",
                "message_id",
                "event_id",
                "event_type",
                "status",
                "attempted_at",
                "http_status",
                "duration_ms"
              ],
              "additionalProperties": false
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "next_cursor"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "items": [
              {
                "id": "atm_example",
                "webhook_id": "ep_example",
                "message_id": "msg_example",
                "event_id": "evt_example",
                "event_type": "order.completed",
                "status": "succeeded",
                "attempted_at": "2026-09-10T13:05:02.000Z",
                "http_status": 200,
                "duration_ms": 84
              }
            ],
            "next_cursor": null
          }
        ]
      }
    }
  }
}
