Quickstart
The easiest way to get started, is to use the GraphQL Playground. Login or register a free account to get access.
The easiest way to get started, is to use the GraphQL Playground. Login or register a free account to get access.
The SWOP API uses API Keys to authenticate requests. To authenticate a request, you can either pass your API Key as a query parameter or as a request header.
Pass the API Key using the query parameter api-key
Configure the endpoint with the query param:
  
    
    https://swop.cx/graphql?api-key=<your-api-key-here>
  
  
  Pass the API Key using the Authorization request header with type ApiKey in your GraphQL client:
  
    
    Authorization: ApiKey <your-api-key-here>
  
  
  
You can access the GraphQL endpoint using this URL:
  
    
      https://swop.cx/graphql
    
  
    The endpoint accepts POST requests with a JSON encoded body
The following resources can be queried
The latest query returns the most recent exchange rates.
Query:
  
    
      query LatestEuro {
        latest(baseCurrency: "EUR", quoteCurrencies: ["USD", "CHF", "HKD"]) {
          date
          baseCurrency
          quoteCurrency
          quote
        }
      }
    
  
  
  
| name | required | description | 
|---|---|---|
baseCurrency | 
                no | 
                ISO 4217 Currency code. Default is EUR. | 
              
quoteCurrencies | 
                no | 
                List of ISO 4217 currency codes. By default, all quote currencies are returned. | 
Response: List of rates for today
  
    
      {
        "data": {
          "latest": [
            {
              "date": "2020-04-08",
              "baseCurrency": "EUR",
              "quoteCurrency": "CHF",
              "quote": 1.0557
            },
            {
              "date": "2020-04-08",
              "baseCurrency": "EUR",
              "quoteCurrency": "HKD",
              "quote": 8.4277
            },
            {
              "date": "2020-04-08",
              "baseCurrency": "EUR",
              "quoteCurrency": "USD",
              "quote": 1.0871
            }
          ]
        }
      }
    
  
  
  The historical query returns exchange rates for a specific date in the past.
Query:
  
    
      query AprilFourthUSD {
        historical(date: "2020-04-04", baseCurrency: "USD", quoteCurrencies: ["EUR", "GBP"]) {
          date
          baseCurrency
          quoteCurrency
          quote
        }
      }
    
  
  
  
| name | required | description | 
|---|---|---|
date | 
                yes | 
                ISO 8601 date (YYYY-MM-DD, between 1999-01-04 and today). Default is today. | 
              
baseCurrency | 
                no | 
                ISO 4217 Currency code. Default is EUR. | 
              
quoteCurrencies | 
                no | 
                List of ISO 4217 currency codes. By default, all quote currencies are returned. | 
Response: List of rates for given date
  
    
      {
        "data": {
          "historical": [
            {
              "date": "2020-04-08",
              "baseCurrency": "USD",
              "quoteCurrency": "EUR",
              "quote": 0.919879
            },
            {
              "date": "2020-04-08",
              "baseCurrency": "USD",
              "quoteCurrency": "GBP",
              "quote": 0.809015
            }
          ]
        }
      }
    
  
  
  The timeSeries query returns exchange rates time series for a given time range.
Query:
  
    
      query {
        timeSeries(dateFrom: "2000-01-01", dateTo: "2000-01-03", baseCurrency: "EUR", quoteCurrencies: ["USD", "GBP"]) {
          baseCurrency
          quoteCurrency
          rates {
            date
            quote
          }
        }
      }
    
  
  
  
| name | required | description | 
|---|---|---|
dateFrom | 
                yes | 
                ISO 8601 date (YYYY-MM-DD). Must be between 1999-01-04 and today. | 
              
dateTo | 
                yes | 
                ISO 8601 date (YYYY-MM-DD). Must be between 1999-01-04 and today. | 
              
baseCurrency | 
                no | 
                ISO 4217 Currency code. Default is EUR. | 
              
quoteCurrencies | 
                no | 
                List of ISO 4217 currency codes. By default, all quote currencies are returned. | 
    Query Limit: The timeSeries query is limited to 4000 rates per request. This allows to query a time range of:
    
Response: List of currency pairs, each with a list of quotes by date
  
    
      {
        "data": {
          "timeSeries": [
            {
              "baseCurrency": "EUR",
              "quoteCurrency": "GBP",
              "quotes": [
                {
                  "date": "2000-01-01",
                  "quote": 0.6217
                },
                {
                  "date": "2000-01-02",
                  "quote": 0.6246
                },
                {
                  "date": "2000-01-03",
                  "quote": 0.6296
                }
              ]
            },
            {
              "baseCurrency": "EUR",
              "quoteCurrency": "USD",
              "quotes": [
                {
                  "date": "2000-01-01",
                  "quote": 1.0046
                },
                {
                  "date": "2000-01-02",
                  "quote": 1.009
                },
                {
                  "date": "2000-01-03",
                  "quote": 1.0305
                }
              ]
            }
          ]
        }
      }
    
  
  
  The fluctuation query returns the fluctuation of rates between two dates.
Query:
  
    
      query {
        fluctuation(dateFrom: "2019-01-01", dateTo: "2020-01-01", baseCurrency:"GBP", quoteCurrencies: ["EUR","USD","CHF"]) {
          baseCurrency
          quoteCurrency
          dateFrom
          dateTo
          fluctuation
          fluctuationPercent
          rateFrom {
            quote
          }
          rateTo {
            quote
          }
        }
      }
    
  
  
  
| name | required | description | 
|---|---|---|
dateFrom | 
                yes | 
                ISO 8601 date (YYYY-MM-DD). Must be between 1999-01-04 and today. | 
              
dateTo | 
                yes | 
                ISO 8601 date (YYYY-MM-DD). Must be between 1999-01-04 and today. | 
              
baseCurrency | 
                no | 
                ISO 4217 Currency code. Default is EUR. | 
              
quoteCurrencies | 
                no | 
                List of ISO 4217 currency codes. By default, all quote currencies are returned. | 
Response: List currency pairs with fluctuation between given dates
  
    
      {
        "data": {
          "fluctuation": [
            {
              "baseCurrency": "GBP",
              "quoteCurrency": "CHF",
              "dateFrom": "2019-01-01",
              "dateTo": "2020-01-01",
              "fluctuation": 0.017704,
              "fluctuationPercent": 1.408045,
              "rateFrom": {
                "quote": 1.25734
              },
              "rateTo": {
                "quote": 1.275044
              }
            },
            {
              "baseCurrency": "GBP",
              "quoteCurrency": "EUR",
              "dateFrom": "2019-01-01",
              "dateTo": "2020-01-01",
              "fluctuation": 0.058532,
              "fluctuationPercent": 5.245363,
              "rateFrom": {
                "quote": 1.115871
              },
              "rateTo": {
                "quote": 1.174403
              }
            },
            {
              "baseCurrency": "GBP",
              "quoteCurrency": "USD",
              "dateFrom": "2019-01-01",
              "dateTo": "2020-01-01",
              "fluctuation": 0.04116,
              "fluctuationPercent": 3.223314,
              "rateFrom": {
                "quote": 1.276953
              },
              "rateTo": {
                "quote": 1.318114
              }
            }
          ]
        }
      }
    
  
  
  The convert query converts an amount from baseCurrency to multiple quoteCurrencies currencies.
Query:
  
    
      query ConvertToGBP {
        convert(amount: 12.34, baseCurrency: "USD", quoteCurrencies: ["GBP"], date: "2020-04-08") {
          date
          baseCurrency
          quoteCurrency
          baseAmount
          quoteAmount
        }
      }
    
  
  
  
| name | required | description | 
|---|---|---|
amount | 
                yes | 
                Decimal amount in base currency. | 
              
baseCurrency | 
                yes | 
                ISO 4217 Currency code. Default is EUR. | 
              
quoteCurrencies | 
                no | 
                List of ISO 4217 currency codes. By default, all quote currencies are returned. | 
date | 
                no | 
                ISO 8601 date (YYYY-MM-DD, between 1999-01-04 and today). Default is today. | 
              
Response: Single conversion
  
    
    {
      "data": {
        "convert": [
          {
            "date": "2020-04-08",
            "baseCurrency": "USD",
            "quoteCurrency": "GBP",
            "baseAmount": 12.34,
            "quoteAmount": 9.98
          }
        ]
      }
    }
  
  
  
  The currencies query returns information about the available currencies.
Query:
  
    
      query USDInfo {
        currencies(currencyCodes: ["USD"]) {
          code
          name
          numericCode
          decimalDigits
          active
        }
      }
    
  
  
  
| name | required | description | 
|---|---|---|
currencyCodes | 
                no | 
                List of ISO 4217 currency codes. By default, all currencies are returned. | 
includeHistorical | 
                no | 
                Boolean, include historical currencies for which we don't have current rates. Default false. | 
              
Response: List of currencies
  
    
      {
        "data": {
          "currencies": [
            {
              "code": "SGD",
              "numeric_code": "702",
              "decimal_digits": 2,
              "name": "Singapore dollar",
              "active": true
            },
            {
              "code": "USD",
              "numeric_code": "840",
              "decimal_digits": 2,
              "name": "United States dollar",
              "active": true
            },
            {
              "code": "ZMK",
              "numericCode": "894",
              "decimalDigits": 2,
              "name": "Zambian kwacha",
              "active": false
            }
          ]
        }
      }