{
  "openapi": "3.1.0",
  "info": {
    "title": "BR Intel",
    "version": "0.1.0",
    "description": "Enriquecimento sob demanda com BrasilAPI, séries oficiais do BCB (Selic, IPCA, PTAX) e cotações públicas da B3 via brapi.",
    "contact": {
      "name": "BR Intel",
      "email": "8qk1thp1@mail.grokbot.com",
      "url": "https://br-intel.8qk1thp1.workers.dev"
    }
  },
  "servers": [
    {
      "url": "https://br-intel.8qk1thp1.workers.dev"
    }
  ],
  "security": [],
  "components": {
    "securitySchemes": {
      "x402": {
        "type": "apiKey",
        "in": "header",
        "name": "PAYMENT-SIGNATURE",
        "description": "Base64-encoded x402 v2 payment payload. Legacy clients may send X-PAYMENT. Facilitator: https://facilitator.payai.network."
      }
    }
  },
  "paths": {
    "/v1/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Liveness and last-fetch status",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "produto": {
                      "type": "string"
                    },
                    "versao": {
                      "type": "string"
                    },
                    "gerado_em": {
                      "type": "string"
                    },
                    "aviso": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/teaser": {
      "get": {
        "operationId": "getTeaser",
        "summary": "Free live preview (abbreviated)",
        "security": [],
        "responses": {
          "200": {
            "description": "Abbreviated live preview. Full detail is paid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "produto": {
                      "type": "string"
                    },
                    "tipo": {
                      "type": "string",
                      "example": "teaser"
                    },
                    "gerado_em": {
                      "type": "string"
                    },
                    "aviso": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/v1/macro": {
      "get": {
        "operationId": "getMacro",
        "summary": "Snapshot macro oficial (Selic, IPCA, PTAX) e recorte B3.",
        "description": "Paid US$ 0.04 USDC on Base (atomic 40000).",
        "x-payment-info": {
          "protocols": [
            "x402"
          ],
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.04"
          },
          "amount": "40000",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "network": "eip155:8453",
          "payTo": "0xe8dfd0cd39e0eb030ca1c819f36e10b6502a1c9b",
          "facilitator": "https://facilitator.payai.network",
          "scheme": "exact"
        },
        "security": [
          {
            "x402": []
          }
        ],
        "parameters": [
          {
            "name": "include",
            "in": "query",
            "required": false,
            "description": "Comma-separated blocks to include: selic,ipca,ptax,tickers. Default: all.",
            "schema": {
              "type": "string",
              "example": "selic,ipca,ptax"
            },
            "example": "selic,ipca,ptax"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "description": "Response language.",
            "schema": {
              "type": "string",
              "enum": [
                "pt-BR",
                "en"
              ],
              "default": "pt-BR",
              "example": "pt-BR"
            },
            "example": "pt-BR"
          }
        ],
        "responses": {
          "200": {
            "description": "Snapshot macro oficial (Selic, IPCA, PTAX) e recorte B3. after settlement.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "aviso"
                  ],
                  "properties": {
                    "produto": {
                      "type": "string"
                    },
                    "tipo": {
                      "type": "string"
                    },
                    "gerado_em": {
                      "type": "string"
                    },
                    "aviso": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Payment required (x402). See the PAYMENT-REQUIRED header (base64 JSON) or this body.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "x402Version",
                    "accepts"
                  ],
                  "properties": {
                    "x402Version": {
                      "type": "integer",
                      "const": 2
                    },
                    "error": {
                      "type": "string"
                    },
                    "resource": {
                      "type": "object"
                    },
                    "accepts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "scheme": {
                            "type": "string",
                            "const": "exact"
                          },
                          "network": {
                            "type": "string",
                            "const": "eip155:8453"
                          },
                          "amount": {
                            "type": "string"
                          },
                          "asset": {
                            "type": "string",
                            "const": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
                          },
                          "payTo": {
                            "type": "string",
                            "const": "0xe8dfd0cd39e0eb030ca1c819f36e10b6502a1c9b"
                          }
                        }
                      }
                    },
                    "extensions": {
                      "type": "object",
                      "properties": {
                        "bazaar": {
                          "type": "object"
                        }
                      }
                    },
                    "legacy": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Payment configuration invalid, facilitator unavailable, or upstream error. Paid content is not returned."
          }
        }
      }
    },
    "/v1/cnpj/{cnpj}": {
      "get": {
        "operationId": "getCnpj",
        "summary": "Enriquecimento cadastral de um CNPJ via BrasilAPI (exemplo: Banco do Brasil).",
        "description": "Paid US$ 0.06 USDC on Base (atomic 60000).",
        "x-payment-info": {
          "protocols": [
            "x402"
          ],
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.06"
          },
          "amount": "60000",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "network": "eip155:8453",
          "payTo": "0xe8dfd0cd39e0eb030ca1c819f36e10b6502a1c9b",
          "facilitator": "https://facilitator.payai.network",
          "scheme": "exact"
        },
        "security": [
          {
            "x402": []
          }
        ],
        "parameters": [
          {
            "name": "cnpj",
            "in": "path",
            "required": true,
            "description": "CNPJ com ou sem pontuação (14 dígitos).",
            "schema": {
              "type": "string",
              "example": "00000000000191"
            },
            "example": "00000000000191"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "description": "Response language.",
            "schema": {
              "type": "string",
              "enum": [
                "pt-BR",
                "en"
              ],
              "default": "pt-BR",
              "example": "pt-BR"
            },
            "example": "pt-BR"
          }
        ],
        "responses": {
          "200": {
            "description": "Enriquecimento cadastral de um CNPJ via BrasilAPI (exemplo: Banco do Brasil). after settlement.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "aviso"
                  ],
                  "properties": {
                    "produto": {
                      "type": "string"
                    },
                    "tipo": {
                      "type": "string"
                    },
                    "gerado_em": {
                      "type": "string"
                    },
                    "aviso": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "Payment required (x402). See the PAYMENT-REQUIRED header (base64 JSON) or this body.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "x402Version",
                    "accepts"
                  ],
                  "properties": {
                    "x402Version": {
                      "type": "integer",
                      "const": 2
                    },
                    "error": {
                      "type": "string"
                    },
                    "resource": {
                      "type": "object"
                    },
                    "accepts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "scheme": {
                            "type": "string",
                            "const": "exact"
                          },
                          "network": {
                            "type": "string",
                            "const": "eip155:8453"
                          },
                          "amount": {
                            "type": "string"
                          },
                          "asset": {
                            "type": "string",
                            "const": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
                          },
                          "payTo": {
                            "type": "string",
                            "const": "0xe8dfd0cd39e0eb030ca1c819f36e10b6502a1c9b"
                          }
                        }
                      }
                    },
                    "extensions": {
                      "type": "object",
                      "properties": {
                        "bazaar": {
                          "type": "object"
                        }
                      }
                    },
                    "legacy": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Payment configuration invalid, facilitator unavailable, or upstream error. Paid content is not returned."
          }
        }
      }
    }
  }
}
