{
  "openapi": "3.1.0",
  "info": {
    "title": "FX Reference Rates",
    "version": "1.0.0",
    "description": "Currency exchange rates from the European Central Bank's official euro reference rates: convert an amount from one ISO 4217 currency to up to 30 others, today or on any date in the last 90 days. Cross rates computed via EUR.",
    "x-guidance": "Use GET /rate?from=USD&to=GBP,JPY&amount=100 (or POST /rate with a JSON body {from, to, amount, date}) to get exchange rates and converted amounts from the European Central Bank's euro foreign exchange reference rates. Add date=YYYY-MM-DD for any date in the last 90 days; weekends/holidays use the most recent prior ECB date. Costs $0.003 USDC on Base per request via x402. Supported currencies: EUR, USD, JPY, CZK, DKK, GBP, HUF, PLN, RON, SEK, CHF, ISK, NOK, TRY, AUD, BRL, CAD, CNY, HKD, IDR, ILS, INR, KRW, MXN, MYR, NZD, PHP, SGD, THB, ZAR. Rates are daily reference rates (about 16:00 CET), not live market quotes."
  },
  "servers": [
    {
      "url": "https://fx-reference-rates.mick8511.workers.dev"
    }
  ],
  "paths": {
    "/rate": {
      "get": {
        "operationId": "getRate",
        "summary": "Currency exchange rates and conversion from ECB euro reference rates (today or last 90 days)",
        "tags": [
          "Finance",
          "Currency",
          "FX"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.003000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Source currency, ISO 4217 code, e.g. 'USD'"
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Target currency or comma-separated list of up to 30 codes, e.g. 'GBP,JPY'"
          },
          {
            "name": "amount",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional amount to convert (default 1)"
          },
          {
            "name": "date",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional YYYY-MM-DD within the last 90 days. On a non-publication day the most recent prior ECB reference date is used."
          }
        ],
        "responses": {
          "200": {
            "description": "Exchange rates",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "from": {
                      "type": "string"
                    },
                    "to": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "amount": {
                      "type": "number"
                    },
                    "rates": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      },
                      "description": "1 unit of `from` in each target currency"
                    },
                    "converted": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      },
                      "description": "`amount` converted into each target currency"
                    },
                    "date": {
                      "type": "string",
                      "description": "ECB reference date used"
                    },
                    "requested_date": {
                      "type": "string"
                    },
                    "note": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string"
                    },
                    "source_url": {
                      "type": "string"
                    },
                    "disclaimer": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "from",
                    "to",
                    "rates",
                    "converted",
                    "date"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unsupported parameters (no charge)"
          },
          "402": {
            "description": "Payment Required"
          },
          "502": {
            "description": "ECB data temporarily unavailable (no charge)"
          }
        }
      },
      "post": {
        "operationId": "getRatePost",
        "summary": "Currency exchange rates and conversion from ECB euro reference rates (today or last 90 days)",
        "tags": [
          "Finance",
          "Currency",
          "FX"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.003000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string",
                    "enum": [
                      "EUR",
                      "USD",
                      "JPY",
                      "CZK",
                      "DKK",
                      "GBP",
                      "HUF",
                      "PLN",
                      "RON",
                      "SEK",
                      "CHF",
                      "ISK",
                      "NOK",
                      "TRY",
                      "AUD",
                      "BRL",
                      "CAD",
                      "CNY",
                      "HKD",
                      "IDR",
                      "ILS",
                      "INR",
                      "KRW",
                      "MXN",
                      "MYR",
                      "NZD",
                      "PHP",
                      "SGD",
                      "THB",
                      "ZAR"
                    ],
                    "description": "Source currency, ISO 4217 code, e.g. 'USD'"
                  },
                  "to": {
                    "type": "string",
                    "minLength": 3,
                    "description": "Target currency or comma-separated list of up to 30 codes, e.g. 'GBP,JPY'"
                  },
                  "amount": {
                    "type": "number",
                    "minimum": 0,
                    "default": 1,
                    "description": "Optional amount to convert (default 1)"
                  },
                  "date": {
                    "type": "string",
                    "format": "date",
                    "description": "Optional YYYY-MM-DD within the last 90 days. On a non-publication day the most recent prior ECB reference date is used."
                  }
                },
                "required": [
                  "from",
                  "to"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Exchange rates",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "from": {
                      "type": "string"
                    },
                    "to": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "amount": {
                      "type": "number"
                    },
                    "rates": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      },
                      "description": "1 unit of `from` in each target currency"
                    },
                    "converted": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      },
                      "description": "`amount` converted into each target currency"
                    },
                    "date": {
                      "type": "string",
                      "description": "ECB reference date used"
                    },
                    "requested_date": {
                      "type": "string"
                    },
                    "note": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string"
                    },
                    "source_url": {
                      "type": "string"
                    },
                    "disclaimer": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "from",
                    "to",
                    "rates",
                    "converted",
                    "date"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unsupported parameters (no charge)"
          },
          "402": {
            "description": "Payment Required"
          },
          "502": {
            "description": "ECB data temporarily unavailable (no charge)"
          }
        }
      }
    }
  }
}