{
  "openapi": "3.1.0",
  "info": {
    "title": "Barter Funds API",
    "description": "Agent-accessible API for Barter Funds — live exchange rates, PayPal conversion, and digital currency tools for Ghana and Africa.",
    "version": "1.0.0",
    "contact": {
      "name": "Barter Funds Support",
      "email": "support@barterfunds.com",
      "url": "https://barterfunds.com/help"
    }
  },
  "servers": [
    { "url": "https://app.barterfunds.com" }
  ],
  "x-service-info": {
    "name": "Barter Funds",
    "description": "Digital currency exchange and agent-native payment APIs for Ghana and Africa.",
    "categories": ["finance", "currency-exchange", "cryptocurrency", "payments"]
  },
  "paths": {
    "/functions/x402ExchangeRates": {
      "get": {
        "operationId": "getExchangeRates",
        "summary": "Live GHS exchange rates",
        "description": "Returns live buy/sell exchange rates for all supported currencies, payable per request.",
        "x-payment-info": {
          "intent": "charge",
          "method": "stripe",
          "amount": 0.001,
          "currency": "USD",
          "description": "Per-request access to live GHS exchange rates"
        },
        "responses": {
          "200": {
            "description": "Exchange rates returned successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rates": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": { "type": "string" },
                          "code": { "type": "string" },
                          "buy_at": { "type": "number" },
                          "sell_at": { "type": "number" },
                          "send_at": { "type": "number" },
                          "receive_at": { "type": "number" },
                          "local_currency_code": { "type": "string" }
                        }
                      }
                    },
                    "updated_at": { "type": "string", "format": "date-time" }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment required (x402). Returns payment requirements for the requested resource."
          }
        }
      }
    }
  }
}
