{
  "openapi": "3.1.0",
  "info": {
    "title": "OnnixPay API",
    "version": "1.0.0",
    "description": "API pública OnnixPay — criação e consulta de cobranças PIX e boleto por chave de API. Todos os campos usam snake_case e valores monetários em centavos."
  },
  "servers": [
    {
      "url": "https://apiv2.onnixpay.com",
      "description": "Produção (LIVE)"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "tags": [
    {
      "name": "Charges",
      "description": "Cobranças por PIX e boleto."
    },
    {
      "name": "Payouts",
      "description": "Pagamentos de saída (PIX OUT / TED OUT)."
    },
    {
      "name": "Pix",
      "description": "Chaves PIX do merchant e consulta DICT de qualquer chave."
    },
    {
      "name": "Account",
      "description": "Saldo e dados do merchant dono da chave."
    }
  ],
  "paths": {
    "/v1/balance": {
      "get": {
        "operationId": "getBalance",
        "summary": "Consultar saldo",
        "description": "Retorna o saldo da conta em três baldes (available/restricted/pending) + total, em centavos.",
        "tags": [
          "Account"
        ],
        "security": [
          {
            "ApiKeyAuth": [
              "balance:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "O saldo.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Balance"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/merchant": {
      "get": {
        "operationId": "getMerchant",
        "summary": "Consultar merchant",
        "description": "Retorna os dados da identidade comercial dona da chave (nome, documento, contato, situação).",
        "tags": [
          "Account"
        ],
        "security": [
          {
            "ApiKeyAuth": [
              "merchant:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "O merchant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Merchant"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/payouts": {
      "post": {
        "operationId": "createPayout",
        "summary": "Criar pagamento",
        "description": "Envia um PIX OUT ou TED OUT a partir do saldo do Merchant. Exige o header Idempotency-Key.",
        "tags": [
          "Payouts"
        ],
        "security": [
          {
            "ApiKeyAuth": [
              "payout:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Chave única da operação (mín. 8 caracteres).",
            "schema": {
              "type": "string",
              "minLength": 8
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePayout"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Pagamento criado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payout"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "operationId": "listPayouts",
        "summary": "Listar pagamentos",
        "description": "Lista os pagamentos de saída do Merchant (PIX OUT e TED OUT), do mais recente para o mais antigo, com filtros e paginação por cursor.",
        "tags": [
          "Payouts"
        ],
        "security": [
          {
            "ApiKeyAuth": [
              "payout:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Itens por página (1–100).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "starting_after",
            "in": "query",
            "required": false,
            "description": "Cursor: o id do último item da página anterior. Retorna os próximos itens mais antigos.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Filtra por situação.",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "processing",
                "completed",
                "failed",
                "reversed"
              ]
            }
          },
          {
            "name": "method",
            "in": "query",
            "required": false,
            "description": "Filtra por método.",
            "schema": {
              "type": "string",
              "enum": [
                "pix",
                "ted"
              ]
            }
          },
          {
            "name": "created_after",
            "in": "query",
            "required": false,
            "description": "Apenas itens criados depois deste instante (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "created_before",
            "in": "query",
            "required": false,
            "description": "Apenas itens criados antes deste instante (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Lista de pagamentos.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayoutList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/payouts/{id}": {
      "get": {
        "operationId": "getPayout",
        "summary": "Consultar pagamento",
        "tags": [
          "Payouts"
        ],
        "security": [
          {
            "ApiKeyAuth": [
              "payout:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Identificador (UUID) do pagamento.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "O pagamento.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payout"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/charges": {
      "post": {
        "operationId": "createCharge",
        "summary": "Criar cobrança",
        "description": "Cria uma cobrança por PIX (QR dinâmico, br_code na resposta) ou boleto (registro assíncrono: a linha digitável chega no webhook charge.created). Exige o header Idempotency-Key. No boleto, valem os limites próprios da conta (por boleto, diário e mensal: BOLETO_LIMIT_EXCEEDED 400, DAILY_BOLETO_LIMIT_EXCEEDED 409, MONTHLY_BOLETO_LIMIT_EXCEEDED 409) e, se a conta cobra tarifa de emissão, falta de saldo para a tarifa devolve 422 BOLETO_ISSUANCE_FEE_INSUFFICIENT_BALANCE sem emitir.",
        "tags": [
          "Charges"
        ],
        "security": [
          {
            "ApiKeyAuth": [
              "charge:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Chave única da operação (mín. 8 caracteres).",
            "schema": {
              "type": "string",
              "minLength": 8
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCharge"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Cobrança criada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Charge"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "operationId": "listCharges",
        "summary": "Listar cobranças",
        "description": "Lista as cobranças do Merchant, da mais recente para a mais antiga, com filtros e paginação por cursor.",
        "tags": [
          "Charges"
        ],
        "security": [
          {
            "ApiKeyAuth": [
              "charge:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Itens por página (1–100).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "starting_after",
            "in": "query",
            "required": false,
            "description": "Cursor: o id do último item da página anterior. Retorna os próximos itens mais antigos.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Filtra por situação.",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "paid",
                "expired",
                "canceled",
                "failed",
                "in_dispute",
                "refunded"
              ]
            }
          },
          {
            "name": "method",
            "in": "query",
            "required": false,
            "description": "Filtra por método.",
            "schema": {
              "type": "string",
              "enum": [
                "pix",
                "boleto",
                "card"
              ]
            }
          },
          {
            "name": "created_after",
            "in": "query",
            "required": false,
            "description": "Apenas itens criados depois deste instante (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "created_before",
            "in": "query",
            "required": false,
            "description": "Apenas itens criados antes deste instante (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Lista de cobranças.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChargeList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/charges/{id}": {
      "get": {
        "operationId": "getCharge",
        "summary": "Consultar cobrança",
        "tags": [
          "Charges"
        ],
        "security": [
          {
            "ApiKeyAuth": [
              "charge:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Identificador (UUID) da cobrança.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A cobrança.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Charge"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/charges/{id}/cancel": {
      "post": {
        "operationId": "cancelCharge",
        "summary": "Cancelar cobrança",
        "description": "Encerra uma cobrança pendente: baixa o boleto no banco ou remove o QR dinâmico. Idempotente: recancelar devolve o mesmo recurso.",
        "tags": [
          "Charges"
        ],
        "security": [
          {
            "ApiKeyAuth": [
              "charge:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Identificador (UUID) da cobrança.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "maxLength": 140
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Cobrança cancelada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Charge"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/pix/keys": {
      "get": {
        "operationId": "listPixKeys",
        "summary": "Listar chaves PIX",
        "description": "Retorna as chaves PIX da própria conta. Somente leitura: cadastro e remoção ficam no painel.",
        "tags": [
          "Pix"
        ],
        "security": [
          {
            "ApiKeyAuth": [
              "pix:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "As chaves da conta.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PixKeyList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/pix/dict/lookup": {
      "post": {
        "operationId": "lookupDictKey",
        "summary": "Consultar chave PIX",
        "description": "Resolve qualquer chave PIX no DICT (inclusive de terceiros) e devolve titular e instituição. Limite de 60 requisições por minuto.",
        "tags": [
          "Pix"
        ],
        "security": [
          {
            "ApiKeyAuth": [
              "pix:read"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LookupPixKey"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A chave resolvida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PixKeyLookup"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Chave de API no formato onx_live_…"
      }
    },
    "responses": {
      "Error": {
        "description": "Erro.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "CreateCharge": {
        "type": "object",
        "required": [
          "amount"
        ],
        "properties": {
          "amount": {
            "type": "integer",
            "minimum": 1,
            "description": "Valor em centavos.",
            "example": 2599
          },
          "method": {
            "type": "string",
            "enum": [
              "pix",
              "boleto",
              "card"
            ],
            "default": "pix",
            "description": "pix (QR dinâmico) ou boleto (registro bancário com Bolepix). card ainda não é suportado (422)."
          },
          "reference": {
            "type": "string",
            "maxLength": 140,
            "description": "Identificador livre do integrador."
          },
          "description": {
            "type": "string",
            "maxLength": 140
          },
          "expires_in": {
            "type": "integer",
            "minimum": 60,
            "maximum": 604800,
            "default": 3600,
            "description": "Só PIX. Validade do QR em segundos."
          },
          "pix_key": {
            "type": "string",
            "description": "Só PIX. Chave PIX do Merchant. Default: chave ativa mais antiga."
          },
          "webhook_url": {
            "type": "string",
            "format": "uri",
            "description": "URL que recebe os eventos desta cobrança."
          },
          "webhook_secret": {
            "type": "string",
            "minLength": 8,
            "description": "Segredo HMAC para assinar o webhook desta cobrança."
          },
          "payer": {
            "allOf": [
              {
                "$ref": "#/components/schemas/PayerInput"
              }
            ],
            "description": "Pagador solicitado. Opcional no PIX; obrigatório no boleto (document + address completo). Ecoado como payer_request; após a liquidação, payer traz o pagador real identificado pelo banco."
          },
          "boleto": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CreateChargeBoleto"
              }
            ],
            "description": "Obrigatório quando method=boleto."
          }
        }
      },
      "Payer": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "document": {
            "type": "string",
            "description": "CPF ou CNPJ."
          }
        },
        "description": "Nome e documento de uma parte da cobrança."
      },
      "ChargePix": {
        "type": "object",
        "properties": {
          "br_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "PIX copia-e-cola (EMV)."
          },
          "txid": {
            "type": [
              "string",
              "null"
            ]
          },
          "end_to_end_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Preenchido após o pagamento."
          }
        }
      },
      "Charge": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "object": {
            "type": "string",
            "const": "charge"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "paid",
              "expired",
              "canceled",
              "failed",
              "in_dispute",
              "refunded"
            ]
          },
          "amount": {
            "type": "integer",
            "description": "Em centavos."
          },
          "currency": {
            "type": "string",
            "const": "BRL"
          },
          "method": {
            "type": "string",
            "enum": [
              "pix",
              "boleto",
              "card"
            ]
          },
          "reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "payer": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Payer"
              }
            ],
            "description": "Pagador real: nome e documento identificados pelo banco na liquidação (o mesmo do extrato). Enquanto a cobrança não é paga, repete payer_request."
          },
          "payer_request": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Payer"
              }
            ],
            "description": "Pagador solicitado no payload da criação da cobrança."
          },
          "pix": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ChargePix"
              },
              {
                "type": "null"
              }
            ]
          },
          "boleto": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ChargeBoleto"
              },
              {
                "type": "null"
              }
            ]
          },
          "webhook_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Expiração do QR (PIX). null no boleto."
          },
          "paid_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PayoutRecipient": {
        "type": "object",
        "required": [
          "name",
          "document",
          "bank_ispb",
          "branch",
          "account"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Nome do titular."
          },
          "document": {
            "type": "string",
            "description": "CPF (11) ou CNPJ (14), só dígitos."
          },
          "bank_ispb": {
            "type": "string",
            "description": "ISPB do banco (8 dígitos)."
          },
          "branch": {
            "type": "string",
            "description": "Agência, sem dígito."
          },
          "account": {
            "type": "string",
            "description": "Conta, sem dígito verificador."
          },
          "account_digit": {
            "type": "string",
            "description": "Dígito verificador."
          },
          "account_type": {
            "type": "string",
            "enum": [
              "checking",
              "savings"
            ],
            "default": "checking"
          }
        }
      },
      "CreatePayout": {
        "type": "object",
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "pix",
              "ted"
            ],
            "default": "pix",
            "description": "Trilho do pagamento."
          },
          "amount": {
            "type": "integer",
            "minimum": 1,
            "description": "Valor em centavos. Obrigatório exceto em PIX pix_code.",
            "example": 5000
          },
          "pix_key": {
            "type": "string",
            "description": "PIX por chave do recebedor."
          },
          "pix_code": {
            "type": "string",
            "description": "PIX copia-e-cola (EMV dinâmico, com valor embutido)."
          },
          "recipient": {
            "$ref": "#/components/schemas/PayoutRecipient"
          },
          "finality": {
            "type": "string",
            "default": "10",
            "description": "Apenas TED. Código de finalidade; 99999 (Outros) exige description."
          },
          "description": {
            "type": "string",
            "maxLength": 140
          },
          "reference": {
            "type": "string",
            "maxLength": 140,
            "description": "Identificador livre do integrador."
          },
          "webhook_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "description": "URL que recebe os eventos deste pagamento (pix.out.completed/failed, ted.out.completed/failed). Complementa os webhooks do Merchant."
          },
          "webhook_secret": {
            "type": "string",
            "minLength": 8,
            "maxLength": 200,
            "description": "Segredo para assinar a entrega deste webhook (HMAC-SHA256, header x-onnix-signature). Nunca é retornado."
          }
        }
      },
      "Payout": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "object": {
            "type": "string",
            "const": "payout"
          },
          "method": {
            "type": "string",
            "enum": [
              "pix",
              "ted"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "processing",
              "completed",
              "failed",
              "reversed"
            ]
          },
          "amount": {
            "type": "integer",
            "description": "Em centavos."
          },
          "currency": {
            "type": "string",
            "const": "BRL"
          },
          "end_to_end_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "recipient": {
            "type": "object",
            "properties": {
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "document": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "bank_ispb": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "branch": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "account": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "pix_key": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "webhook_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "failure_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "failed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Balance": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "balance"
          },
          "currency": {
            "type": "string",
            "const": "BRL"
          },
          "available": {
            "type": "integer",
            "description": "Saldo gastável, em centavos."
          },
          "restricted": {
            "type": "integer",
            "description": "Retido por política/risco ou PIX em trânsito, em centavos."
          },
          "pending": {
            "type": "integer",
            "description": "Entrou mas ainda não liberou (liquidação futura). Zero no MVP."
          },
          "total": {
            "type": "integer",
            "description": "available + restricted + pending."
          }
        }
      },
      "Merchant": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "object": {
            "type": "string",
            "const": "merchant"
          },
          "type": {
            "type": "string",
            "enum": [
              "individual",
              "company"
            ],
            "description": "individual (PF) ou company (PJ)."
          },
          "name": {
            "type": "string",
            "description": "Nome de exibição (fantasia)."
          },
          "legal_name": {
            "type": "string",
            "description": "Razão social / nome completo."
          },
          "document": {
            "type": [
              "string",
              "null"
            ],
            "description": "CPF (11) ou CNPJ (14), só dígitos."
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "active",
              "suspended",
              "closed"
            ]
          },
          "kyc_status": {
            "type": "string",
            "enum": [
              "pending",
              "in_review",
              "approved",
              "rejected",
              "suspended"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Código estável do erro.",
            "example": "METHOD_NOT_SUPPORTED"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "ChargeList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Charge"
            }
          },
          "has_more": {
            "type": "boolean",
            "description": "true se existem mais itens além desta página."
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ]
      },
      "PayoutList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Payout"
            }
          },
          "has_more": {
            "type": "boolean",
            "description": "true se existem mais itens além desta página."
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ]
      },
      "PixKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "object": {
            "type": "string",
            "const": "pix_key"
          },
          "type": {
            "type": "string",
            "enum": [
              "cpf",
              "cnpj",
              "email",
              "phone",
              "evp"
            ]
          },
          "key": {
            "type": "string",
            "nullable": true,
            "description": "Valor da chave. Null enquanto uma chave aleatória (evp) não é devolvida pelo provedor."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "active",
              "removed"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PixKeyList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PixKey"
            }
          },
          "has_more": {
            "type": "boolean"
          }
        }
      },
      "LookupPixKey": {
        "type": "object",
        "required": [
          "key"
        ],
        "properties": {
          "key": {
            "type": "string",
            "maxLength": 140,
            "description": "CPF, CNPJ, e-mail, telefone (+5511999999999) ou chave aleatória."
          }
        }
      },
      "PixKeyLookup": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "pix_key_lookup"
          },
          "key": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "cpf",
              "cnpj",
              "email",
              "phone",
              "evp"
            ]
          },
          "owner_name": {
            "type": "string"
          },
          "owner_document": {
            "type": "string",
            "description": "CPF/CNPJ do titular, mascarado pelo próprio DICT no caso de pessoa física."
          },
          "bank_name": {
            "type": "string",
            "nullable": true
          },
          "bank_ispb": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "PayerInput": {
        "type": "object",
        "description": "Dados do pagador enviados na criação.",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 180
          },
          "document": {
            "type": "string",
            "description": "CPF (11) ou CNPJ (14 dígitos), só números."
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "phone": {
            "type": "string",
            "maxLength": 20
          },
          "address": {
            "type": "object",
            "description": "Obrigatório no boleto (complement é opcional).",
            "properties": {
              "zipCode": {
                "type": "string",
                "description": "CEP com 8 dígitos.",
                "example": "01310200"
              },
              "street": {
                "type": "string"
              },
              "number": {
                "type": "string"
              },
              "complement": {
                "type": "string"
              },
              "district": {
                "type": "string",
                "description": "Bairro."
              },
              "city": {
                "type": "string"
              },
              "state": {
                "type": "string",
                "description": "UF com 2 letras.",
                "example": "SP"
              }
            }
          }
        }
      },
      "CreateChargeBoleto": {
        "type": "object",
        "required": [
          "due_date"
        ],
        "properties": {
          "due_date": {
            "type": "string",
            "format": "date",
            "description": "Vencimento (YYYY-MM-DD)."
          },
          "fine": {
            "type": "number",
            "minimum": 0.1,
            "maximum": 100,
            "description": "Multa por atraso, em % do valor."
          },
          "interest": {
            "type": "number",
            "minimum": 0.1,
            "maximum": 100,
            "description": "Juros de mora, em % ao mês."
          },
          "discount": {
            "type": "object",
            "required": [
              "amount",
              "modality",
              "limit_date"
            ],
            "properties": {
              "amount": {
                "type": "integer",
                "minimum": 1,
                "description": "Centavos em fixed; percentual em percent (10 = 10%)."
              },
              "modality": {
                "type": "string",
                "enum": [
                  "fixed",
                  "percent"
                ]
              },
              "limit_date": {
                "type": "string",
                "format": "date"
              }
            }
          },
          "instructions": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "string",
              "maxLength": 200
            },
            "description": "Linhas impressas no boleto."
          }
        }
      },
      "ChargeBoleto": {
        "type": "object",
        "description": "Dados do boleto registrado. barcode, digitable_line e pix_emv ficam null até o banco concluir o registro (assíncrono); chegam no webhook charge.created.",
        "properties": {
          "barcode": {
            "type": [
              "string",
              "null"
            ]
          },
          "digitable_line": {
            "type": [
              "string",
              "null"
            ]
          },
          "pix_emv": {
            "type": [
              "string",
              "null"
            ],
            "description": "PIX copia-e-cola do Bolepix."
          },
          "pdf_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "due_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          }
        }
      }
    }
  }
}