SWOP API

Introduction

There are two ways of accessing the SWOP API: REST and GraphQL. Both offer access to the same data. All endpoints are SSL 256-bit encrypted.

Quickstart

GraphQL

The easiest way to get started, is to use the GraphQL Playground. Login or register a free account to get access.

REST

Getting the latest exchange rates using curl

  
    
  curl -i -H "Authorization: ApiKey <your-api-key-here>" "https://swop.cx/rest/rates"

  
Response
  
    
  [
    {
      "base_currency": "EUR",
      "quote_currency": "CHF",
      "quote": 1.054871,
      "date": "2020-04-04"
    },
    {
      "base_currency": "EUR",
      "quote_currency": "GBP",
      "quote": 0.878173,
      "date": "2020-04-04"
    },
    {
      "base_currency": "EUR",
      "quote_currency": "USD",
      "quote": 1.079301,
      "date": "2020-04-04"
    }
  ]

  

Terminology

Exchange Rates

An exchange rate is a quotation of the current or historical value of a currency against another currency, called a currency pair.

The currency pair has a base currency and a quote currency (also called counter currency) and is often written as the two ISO 4217 currency codes separated by a slash, for example EUR/USD.

The exchange rate is given as 1 base currency = X quote currency, where X is the quote. A quote of 1.15 for EUR/USD means that 1 Euro can be exchanged for 1.15 US dollars. Here, EUR is the base currency and USD is the quote currency.

Authentication

The SWOP API uses API Keys to authenticate requests. You need to login or register a free account to get an API Key. To authenticate a request, you can either pass your API Key as a query parameter or as a request header. This works for both GraphQL and REST.

arrow-up icon