JSON REST API Xurrency

What is API Xurrency?

Xurrency offers developers seamless access to up-to-date exchange rate information. Empower your website by effortlessly integrating this valuable data directly from Xurrency or enabling users to effortlessly retrieve exchange rates through queries. Our API is based in JSON, a straightforward and easily interpretable data-interchange format, ensuring a developer-friendly experience for seamless integration.

Usage

Xurrency API requires the use of an API Key in order to access to its data. If you want to adquire a license key, please click here.

Format

http://xurrency.com/api/{base}/{target}/{amount}?key={apikey}

Successful Responses

When a request is successful, the following JSON object is returned:

Attribute Value Explanation
status ok You can check status for success (ok) or failure (fail)
code 0 Have a look at Return codes table
result object result is a JSON object containing the following attributes:
  • updated_at: Last time when the data was updated (UTC Format)
  • value: Exchange rate
  • base: Currency base
  • target: Currency target

Failure Responses

When a request is failed, a JSON object is returned as well, but with different attributes:

Attribute Value Explanation
status fail You can check status for success (ok) or failure (fail)
code 1-6 Have a look at Return codes table
message string Error explanation

Return codes

Code Status Message
0 ok
1 fail Amount should be between 0 and 999999999
2 fail Currencies are not valid
3 fail Limit Reached (10 requests per day). Please adquire a license key
4 fail The api key is not valid
5 fail Your api key has expired. Please renew it
6 fail Currency codes are the same
7 fail Invalid Date

API Examples

Example 1

Call

https://xurrency.com/api/eur/gbp/1.5

Result

{
  "result":{
    "updated_at":"2020-10-13T16:01:24Z",
    "value":"1.3577",
    "target":"gbp",
    "base":"eur"
  },
  "code":0,
  "status":"ok"
}

Example 2

Call

https://xurrency.com/api/eur/xxx/yyy/1.5

Result

{
  "code":2,
  "message":"Currencies are not valid",
  "status":"fail"
}

Example 3

Call

https://xurrency.com/api/eur/gbp/1000000000

Result

{
  "code":1,
  "message":"Amount should be between 0 and 999999999",
  "status":"fail"
}

Example 4

Call

https://xurrency.com/api/eur/gbp/usd/cad/1.5

Result

{
  "result":[
    {
      "updated_at":"2020-10-13T16:01:24Z",
      "value":1.3287,
      "target":"gbp",
      "base":"eur"
    },
    {
      "updated_at":"2020-10-13T16:01:24Z",
      "value":2.17275,
      "target":"usd",
      "base":"eur"
    },
    {
      "updated_at":"2020-10-13T16:01:24Z",
      "value":2.0877,
      "target":"cad",
      "base":"eur"
    }
  ],
  "code":0,
  "status":"ok"
}

Example 5

Call

https://xurrency.com/api/eur/usd/1?key={KEY}&date=20100405

Result

{
  "result":{
    "updated_at":"/api/eur/gbp/usd/cad/1.5",
    "value":"1.3487",
    "target":"usd",
    "base":"eur"
  },
  "code":0,
  "status":"ok"
}

©2007-2024 Xurrency All rights reserved