{
  "openapi": "3.1.0",
  "info": {
    "title": "Farol LatAm",
    "version": "0.1.0",
    "description": "Cross-asset Brazil/LatAm session intelligence (B3, ADRs, FX, Focus, Polymarket). Informational context, not investment advice. Times in America/Sao_Paulo.",
    "contact": {
      "name": "Farol LatAm",
      "email": "8qk1thp1@mail.grokbot.com",
      "url": "https://farol-latam.8qk1thp1.workers.dev"
    }
  },
  "servers": [
    {
      "url": "https://farol-latam.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 instead. Facilitator: https://facilitator.payai.network."
      }
    }
  },
  "paths": {
    "/v1/saude": {
      "get": {
        "operationId": "getSaude",
        "summary": "Health / freshness of today's pack",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "produto": {
                      "type": "string"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "gerado_em": {
                      "type": "string"
                    },
                    "data_pregao": {
                      "type": "string"
                    },
                    "valido_ate": {
                      "type": "string"
                    },
                    "aviso": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/teaser": {
      "get": {
        "operationId": "getTeaser",
        "summary": "Free delayed preview",
        "security": [],
        "responses": {
          "200": {
            "description": "Delayed preview without full invalidation or the deviation list.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "produto": {
                      "type": "string"
                    },
                    "tipo": {
                      "type": "string",
                      "example": "teaser"
                    },
                    "vies_win": {
                      "type": "string"
                    },
                    "aviso": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessao": {
      "get": {
        "operationId": "getSessao",
        "summary": "Full session pack",
        "description": "Paid US$ 0.15 USDC on Base (atomic 150000).",
        "x-payment-info": {
          "protocols": [
            "x402"
          ],
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.15"
          },
          "amount": "150000",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "network": "eip155:8453",
          "payTo": "0xe8dfd0cd39e0eb030ca1c819f36e10b6502a1c9b",
          "facilitator": "https://facilitator.payai.network",
          "scheme": "exact"
        },
        "security": [
          {
            "x402": []
          }
        ],
        "parameters": [
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "description": "Response language.",
            "schema": {
              "type": "string",
              "enum": [
                "pt-BR",
                "en"
              ],
              "default": "pt-BR"
            },
            "example": "pt-BR"
          }
        ],
        "responses": {
          "200": {
            "description": "Full session pack after settlement.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "aviso"
                  ],
                  "properties": {
                    "produto": {
                      "type": "string",
                      "example": "Farol LatAm"
                    },
                    "gerado_em": {
                      "type": "string"
                    },
                    "aviso": {
                      "type": "string",
                      "example": "Conteúdo informativo, não é recomendação de compra ou venda."
                    },
                    "data_pregao": {
                      "type": "string"
                    },
                    "vies_win": {
                      "type": "string"
                    },
                    "motivo": {
                      "type": "string"
                    },
                    "invalida_se": {
                      "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",
                      "properties": {
                        "url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "description": {
                          "type": "string"
                        },
                        "mimeType": {
                          "type": "string"
                        },
                        "serviceName": {
                          "type": "string"
                        },
                        "tags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "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"
                          },
                          "maxTimeoutSeconds": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "extensions": {
                      "type": "object",
                      "properties": {
                        "bazaar": {
                          "type": "object",
                          "properties": {
                            "info": {
                              "type": "object"
                            },
                            "schema": {
                              "type": "object"
                            },
                            "routeTemplate": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    },
                    "legacy": {
                      "type": "object",
                      "description": "x402 v1 payment requirements for older clients."
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Payment configuration invalid or facilitator unavailable. Paid content is not returned."
          }
        }
      }
    },
    "/v1/desvios": {
      "get": {
        "operationId": "getDesvios",
        "summary": "Open cross-asset deviations",
        "description": "Paid US$ 0.08 USDC on Base (atomic 80000).",
        "x-payment-info": {
          "protocols": [
            "x402"
          ],
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.08"
          },
          "amount": "80000",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "network": "eip155:8453",
          "payTo": "0xe8dfd0cd39e0eb030ca1c819f36e10b6502a1c9b",
          "facilitator": "https://facilitator.payai.network",
          "scheme": "exact"
        },
        "security": [
          {
            "x402": []
          }
        ],
        "parameters": [
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "description": "Response language.",
            "schema": {
              "type": "string",
              "enum": [
                "pt-BR",
                "en"
              ],
              "default": "pt-BR"
            },
            "example": "pt-BR"
          }
        ],
        "responses": {
          "200": {
            "description": "Open deviations after settlement.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "aviso"
                  ],
                  "properties": {
                    "produto": {
                      "type": "string",
                      "example": "Farol LatAm"
                    },
                    "gerado_em": {
                      "type": "string"
                    },
                    "aviso": {
                      "type": "string",
                      "example": "Conteúdo informativo, não é recomendação de compra ou venda."
                    },
                    "n_desvios": {
                      "type": "integer"
                    },
                    "desvios": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  },
                  "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",
                      "properties": {
                        "url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "description": {
                          "type": "string"
                        },
                        "mimeType": {
                          "type": "string"
                        },
                        "serviceName": {
                          "type": "string"
                        },
                        "tags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "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"
                          },
                          "maxTimeoutSeconds": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "extensions": {
                      "type": "object",
                      "properties": {
                        "bazaar": {
                          "type": "object",
                          "properties": {
                            "info": {
                              "type": "object"
                            },
                            "schema": {
                              "type": "object"
                            },
                            "routeTemplate": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    },
                    "legacy": {
                      "type": "object",
                      "description": "x402 v1 payment requirements for older clients."
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Payment configuration invalid or facilitator unavailable. Paid content is not returned."
          }
        }
      }
    },
    "/v1/ticker/{codigo}": {
      "get": {
        "operationId": "getTicker",
        "summary": "Single-ticker enrichment",
        "description": "Paid US$ 0.03 USDC on Base (atomic 30000).",
        "x-payment-info": {
          "protocols": [
            "x402"
          ],
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.03"
          },
          "amount": "30000",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "network": "eip155:8453",
          "payTo": "0xe8dfd0cd39e0eb030ca1c819f36e10b6502a1c9b",
          "facilitator": "https://facilitator.payai.network",
          "scheme": "exact"
        },
        "security": [
          {
            "x402": []
          }
        ],
        "parameters": [
          {
            "name": "codigo",
            "in": "path",
            "required": true,
            "description": "B3 ticker, ADR, IBOV, EWZ, USDBRL or BTC.",
            "schema": {
              "type": "string",
              "example": "VALE3"
            },
            "example": "VALE3"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "description": "Response language.",
            "schema": {
              "type": "string",
              "enum": [
                "pt-BR",
                "en"
              ],
              "default": "pt-BR"
            },
            "example": "pt-BR"
          }
        ],
        "responses": {
          "200": {
            "description": "Ticker enrichment after settlement.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "aviso"
                  ],
                  "properties": {
                    "produto": {
                      "type": "string",
                      "example": "Farol LatAm"
                    },
                    "gerado_em": {
                      "type": "string"
                    },
                    "aviso": {
                      "type": "string",
                      "example": "Conteúdo informativo, não é recomendação de compra ou venda."
                    },
                    "codigo": {
                      "type": "string",
                      "example": "VALE3"
                    },
                    "mercado": {
                      "type": "string"
                    },
                    "vies": {
                      "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",
                      "properties": {
                        "url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "description": {
                          "type": "string"
                        },
                        "mimeType": {
                          "type": "string"
                        },
                        "serviceName": {
                          "type": "string"
                        },
                        "tags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "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"
                          },
                          "maxTimeoutSeconds": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "extensions": {
                      "type": "object",
                      "properties": {
                        "bazaar": {
                          "type": "object",
                          "properties": {
                            "info": {
                              "type": "object"
                            },
                            "schema": {
                              "type": "object"
                            },
                            "routeTemplate": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    },
                    "legacy": {
                      "type": "object",
                      "description": "x402 v1 payment requirements for older clients."
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Unknown ticker (only after a valid payment has settled)."
          },
          "503": {
            "description": "Payment configuration invalid or facilitator unavailable. Paid content is not returned."
          }
        }
      }
    }
  }
}
