{
  "openapi": "3.1.0",
  "info": {
    "title": "Become Argentine API",
    "version": "1.0.0",
    "summary": "Sourced facts and cost calculator for Argentina citizenship by investment, plus agent consultation requests.",
    "description": "Public read-only endpoints need no authentication. POST /leads needs an OAuth 2.0 bearer token with scope leads:write. See https://becomeargentine.com/auth.md. General information, not legal advice. Become Argentine is independent and not part of the Argentine government.",
    "contact": { "url": "https://becomeargentine.com/get-matched/" }
  },
  "servers": [{ "url": "https://becomeargentine.com/api/v1" }],
  "externalDocs": { "url": "https://becomeargentine.com/developers/" },
  "components": {
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": { "tokenUrl": "https://becomeargentine.com/oauth/token", "scopes": { "facts:read": "Read facts", "leads:write": "Send a consultation request (after human claim)" } },
          "authorizationCode": { "authorizationUrl": "https://becomeargentine.com/oauth/authorize", "tokenUrl": "https://becomeargentine.com/oauth/token", "scopes": { "leads:write": "Send one consultation request approved by the user" } }
        }
      }
    },
    "schemas": {
      "Cost": { "type": "object", "properties": { "currency": { "type": "string" }, "total_usd": { "type": "integer" }, "lines": { "type": "array", "items": { "type": "object", "properties": { "item": { "type": "string" }, "usd": { "type": "integer" } } } }, "note": { "type": "string" }, "source": { "type": "string", "format": "uri" } } },
      "Lead": { "type": "object", "required": ["name", "email"], "properties": {
        "name": { "type": "string", "maxLength": 120 }, "email": { "type": "string", "format": "email" },
        "citizenship_country": { "type": "string" }, "budget_usd": { "type": "string" }, "family": { "type": "string", "description": "e.g. spouse and two children under 18" },
        "timing": { "type": "string" }, "message": { "type": "string", "maxLength": 2000 } } }
    }
  },
  "paths": {
    "/health": { "get": { "operationId": "health", "summary": "Health check", "responses": { "200": { "description": "OK" } } } },
    "/facts": { "get": { "operationId": "getFacts", "summary": "Sourced program facts, status and legal risks", "responses": { "200": { "description": "Facts JSON" } } } },
    "/cost": { "get": { "operationId": "calculateCost", "summary": "Government cost in USD for a family",
      "parameters": [
        { "name": "option", "in": "query", "schema": { "type": "string", "enum": ["contribution", "bond"], "default": "contribution" } },
        { "name": "spouse", "in": "query", "schema": { "type": "boolean", "default": false } },
        { "name": "children_18_to_25", "in": "query", "schema": { "type": "integer", "minimum": 0, "maximum": 20, "default": 0 } },
        { "name": "children_under_18", "in": "query", "schema": { "type": "integer", "minimum": 0, "maximum": 20, "default": 0 } }
      ],
      "responses": { "200": { "description": "Cost", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Cost" } } } }, "400": { "description": "Invalid input" } } } },
    "/leads": { "post": { "operationId": "createLead", "summary": "Send a consultation request on behalf of a user",
      "security": [{ "oauth2": ["leads:write"] }],
      "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Lead" } } } },
      "responses": { "201": { "description": "Created" }, "401": { "description": "Missing or invalid token. See WWW-Authenticate resource_metadata." }, "403": { "description": "Missing scope leads:write" }, "429": { "description": "Max 5 per client per day" } } } }
  }
}
