{
  "openapi": "3.1.0",
  "info": {
    "title": "Architect x402 — LATAM Business, Fiscal & FX API",
    "version": "2.5.0",
    "description": "Serverless edge API for validating & decoding LATAM tax/bank identifiers across 7 countries (MX, AR, CL, CO, PE, UY, BR) plus live LATAM FX conversion. Paid per request via x402 v2 ($0.008 USDC on Base)."
  },
  "servers": [
    {
      "url": "https://latam.brunopompeo.com.br"
    }
  ],
  "paths": {
    "/latam": {
      "post": {
        "operationId": "latam_validate_and_fx",
        "summary": "Validate LATAM tax/bank IDs & convert FX ($0.008 USDC via x402 v2)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string",
                    "description": "Single LATAM tax or bank identifier (auto-detected if country/type omitted)"
                  },
                  "country": {
                    "type": "string",
                    "enum": [
                      "MX",
                      "AR",
                      "CL",
                      "CO",
                      "PE",
                      "UY",
                      "BR"
                    ]
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "RFC",
                      "CURP",
                      "CLABE",
                      "CUIT",
                      "CUIL",
                      "CBU",
                      "RUT",
                      "RUT_CL",
                      "RUT_UY",
                      "NIT",
                      "RUC",
                      "CPF",
                      "CNPJ"
                    ]
                  },
                  "items": {
                    "type": "array",
                    "description": "Batch list of LATAM identifiers to validate and decode in one call (up to 100)",
                    "items": {
                      "type": "object",
                      "properties": {
                        "value": {
                          "type": "string"
                        },
                        "country": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "value"
                      ]
                    }
                  },
                  "fx": {
                    "type": "object",
                    "description": "Optional real-time LATAM FX conversion",
                    "properties": {
                      "amount": {
                        "type": "number",
                        "default": 1
                      },
                      "from": {
                        "type": "string",
                        "enum": [
                          "USD",
                          "EUR",
                          "MXN",
                          "ARS",
                          "CLP",
                          "COP",
                          "PEN",
                          "UYU",
                          "BRL"
                        ],
                        "default": "USD"
                      },
                      "to": {
                        "oneOf": [
                          {
                            "type": "string",
                            "enum": [
                              "USD",
                              "EUR",
                              "MXN",
                              "ARS",
                              "CLP",
                              "COP",
                              "PEN",
                              "UYU",
                              "BRL"
                            ]
                          },
                          {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "USD",
                                "EUR",
                                "MXN",
                                "ARS",
                                "CLP",
                                "COP",
                                "PEN",
                                "UYU",
                                "BRL"
                              ]
                            }
                          }
                        ]
                      }
                    }
                  }
                }
              },
              "example": {
                "items": [
                  {
                    "value": "XAXX010101000",
                    "country": "MX",
                    "type": "RFC"
                  },
                  {
                    "value": "002010077777777771",
                    "country": "MX",
                    "type": "CLABE"
                  },
                  {
                    "value": "30-50001091-2",
                    "country": "AR",
                    "type": "CUIT"
                  },
                  {
                    "value": "20131312955",
                    "country": "PE",
                    "type": "RUC"
                  }
                ],
                "fx": {
                  "amount": 1000,
                  "from": "USD",
                  "to": [
                    "MXN",
                    "ARS",
                    "CLP",
                    "COP",
                    "PEN",
                    "UYU",
                    "BRL"
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Structured JSON validation and/or FX conversion results"
          },
          "402": {
            "description": "Payment Required — x402 v2 PAYMENT-REQUIRED header (Base USDC)"
          }
        }
      }
    },
    "/health": {
      "get": {
        "summary": "Free health check",
        "responses": {
          "200": {
            "description": "Service healthy"
          }
        }
      }
    },
    "/sample": {
      "get": {
        "summary": "Free sample payload and response",
        "responses": {
          "200": {
            "description": "Sample JSON"
          }
        }
      }
    },
    "/mcp": {
      "get": {
        "summary": "MCP server discovery manifest",
        "responses": {
          "200": {
            "description": "MCP discovery JSON"
          }
        }
      },
      "post": {
        "summary": "MCP JSON-RPC 2.0 endpoint",
        "responses": {
          "200": {
            "description": "JSON-RPC response"
          }
        }
      }
    }
  }
}