{
  "openapi": "3.0.0",
  "info": {
    "title": "LatAm FX check API (x402)",
    "version": "1.0.0",
    "description": "Pay-per-call LatAm dollar and FX rates (ARS blue/MEP/CCL, BRL PTAX, COP TRM, CLP dolar observado). 0.005 USDC per call on Base, x402 v2. Bundle route /latam/snapshot at 0.03 USDC returns all six rates.",
    "contact": {
      "name": "LatAm FX check API",
      "url": "https://automaton-lite-production.up.railway.app"
    }
  },
  "servers": [
    {
      "url": "https://automaton-lite-production.up.railway.app"
    }
  ],
  "paths": {
    "/ar/fx": {
      "get": {
        "summary": "Argentina FX snapshot with gaps",
        "responses": {
          "200": {
            "description": "JSON",
            "content": {
              "application/json": {}
            }
          },
          "402": {
            "description": "Payment required (x402)"
          }
        },
        "description": "Argentina dollar rates in one call: USD/ARS blue, MEP, CCL, oficial, crypto USDT P2P ask/bid, with % gaps vs official. Example output: {\"official_venta\":1000,\"blue_venta\":1450,\"mep_venta\":1400,\"ccl_venta\":1480,\"gap_pct\":{\"blue_vs_official\":45,...}}. Search terms: dólar blue, dólar MEP, dólar CCL, USD/ARS, cotización dólar hoy Argentina."
      }
    },
    "/check/fx-gap": {
      "get": {
        "summary": "Argentina gap yes/no check",
        "parameters": [
          {
            "name": "country",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ar"
              ],
              "default": "ar"
            }
          },
          {
            "name": "gt",
            "in": "query",
            "schema": {
              "type": "number",
              "default": 10
            }
          },
          {
            "name": "metric",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "usdt_ask",
                "blue",
                "mep",
                "ccl"
              ],
              "default": "usdt_ask"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON with condition_met",
            "content": {
              "application/json": {}
            }
          },
          "402": {
            "description": "Payment required (x402)"
          }
        },
        "description": "Yes/no check: is the USD/ARS parallel-dollar gap (dólar blue, MEP, CCL or USDT P2P vs oficial) above a threshold? Params: country (ar), gt (percent, default 10), metric (usdt_ask|blue|mep|ccl). Example output: {\"condition_met\":true,\"gap_pct\":12.4,\"threshold_pct\":10,\"metric\":\"usdt_ask\"}."
      }
    },
    "/co/trm": {
      "get": {
        "summary": "Colombia TRM (USD/COP)",
        "responses": {
          "200": {
            "description": "JSON"
          },
          "402": {
            "description": "Payment required (x402)"
          }
        },
        "description": "Colombia TRM: official USD/COP dollar rate (COP TRM, tasa representativa del mercado), daily, from datos.gov.co. Example output: {\"value\":4150.25,\"valid_from\":\"2026-11-18\"}."
      }
    },
    "/cl/fx": {
      "get": {
        "summary": "Chile dolar observado (USD/CLP)",
        "responses": {
          "200": {
            "description": "JSON"
          },
          "402": {
            "description": "Payment required (x402)"
          }
        },
        "description": "Chile dólar observado: USD/CLP official observed dollar (Banco Central de Chile via mindicador.cl), daily. Falls back to a labelled market mid-rate if the official source is down. Example output: {\"value\":950.4,\"date\":\"2026-11-17\"}."
      }
    },
    "/br/ptax": {
      "get": {
        "summary": "Brazil BCB PTAX (USD/BRL)",
        "responses": {
          "200": {
            "description": "JSON"
          },
          "402": {
            "description": "Payment required (x402)"
          }
        },
        "description": "Brazil BRL PTAX: BCB PTAX official USD/BRL selling rate (dólar PTAX venda, cotação oficial do Banco Central do Brasil), latest, from olinda.bcb.gov.br. Example output: {\"value\":5.37,\"timestamp\":\"2026-11-18 13:06:00.000\"}."
      }
    },
    "/check/mep-ccl": {
      "get": {
        "summary": "CCL over MEP premium yes/no check (Argentina)",
        "parameters": [
          {
            "name": "gt",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "default": 5
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON: condition_met, premium_pct, threshold_pct, quotes",
            "content": {
              "application/json": {}
            }
          },
          "402": {
            "description": "Payment required (x402)"
          }
        },
        "description": "Yes/no check: is the USD/ARS CCL-over-MEP premium (dólar CCL vs dólar MEP, cross-border gap) above a threshold? Params: gt (percent, default 5). Example output: {\"condition_met\":true,\"premium_pct\":6.2,\"threshold_pct\":5,\"mep_venta\":1400,\"ccl_venta\":1487}. Source: dolarapi.com, delay minutes to hours."
      }
    },
    "/latam/snapshot": {
      "get": {
        "summary": "All six LatAm FX rates in one call (0.03 USDC)",
        "description": "Bundles /ar/fx, /co/trm, /cl/fx, /br/ptax, /check/fx-gap and /check/mep-ccl. Paid via x402 v2, USDC on Base, 30000 units (0.03 USDC).",
        "responses": {
          "200": {
            "description": "Bundle of six sections",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ar": {
                      "type": "object"
                    },
                    "co": {
                      "type": "object"
                    },
                    "cl": {
                      "type": "object"
                    },
                    "br": {
                      "type": "object"
                    },
                    "checks": {
                      "type": "object"
                    },
                    "generated_at": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment required (x402)"
          },
          "503": {
            "description": "Upstream unavailable, not charged"
          }
        }
      }
    }
  }
}