REST API
RESTful endpoint provides the widest range of data, based on HTTP protocol which works in Request-Reply scheme.
Implemented Standards:
Note: We adhere to the OpenAPI standards for documenting our API.
OpenAPI Specification
To access our API's OpenAPI specification, you can use the following link: OpenAPI v3
If you need to import the OpenAPI file into software like Postman, simply copy and paste the link below:
https://raw.githubusercontent.com/coinapi/coinapi-sdk/master/data-api/coinapi-marketdata-rest.yaml
Endpoints
Enviroment | Encryption | Value | Region |
---|---|---|---|
Production | Yes | https://rest.coinapi.io/ | GeoDNS (auto-routing) |
Production | No | http://rest.coinapi.io/ | GeoDNS (auto-routing) |
Production | Yes | https://api-ncsa.coinapi.io/ | North & South America |
Production | No | http://api-ncsa.coinapi.io/ | North & South America |
Production | Yes | https://api-emea.coinapi.io/ | Europe, Middle East & Africa |
Production | No | http://api-emea.coinapi.io/ | Europe, Middle East & Africa |
Production | Yes | https://api-apac.coinapi.io/ | Asia Pacific |
Production | No | http://api-apac.coinapi.io/ | Asia Pacific |
The default endpoints (rest.coinapi.io
) use GeoDNS to automatically route your requests to the nearest datacenter. If you prefer to use a specific region, you can use the region-specific endpoints listed above.
General
If you want to learn how to authenticate to this API, you can find detailed instructions and guidance in authentication section of this documentation.
HTTP Requests
Each HTTP request must contain the header Accept: application/json
as all our responses are in JSON format.
We encourage you to use the HTTP request header Accept-Encoding: br, gzip
for all requests.
This will indicate to us that we can deliver compressed data to you which on your side should be decompressed transparently.
By allowing data compression you are lowering bandwidth requirements by approximately 80%. This is important for requesting large amounts of data or using WebSocket Streaming API, as we can deliver data to you faster and more effectively.
HTTP Success
Successful HTTP responses have the status code 200
and the body in a format according to documentation of the requested resource.
You should always check that your HTTP response status code is equal to 200, otherwise the requested was not successful.
HTTP Errors
Error message is returned in JSON structured like this:
{
"error": "Invalid API key"
}
All HTTP requests with response status codes different to 200
must be considered as failed
and you should expect additional JSON inside the body of the response with the error message encapsulated inside it as shown in the example.
We use the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- There is something wrong with your request |
401 | Unauthorized -- Your API key is wrong |
403 | Forbidden -- Your API key doesnt't have enough privileges to access this resource |
429 | Too many requests -- You have exceeded your API key rate limits |
550 | No data -- You requested specific single item that we don't have at this moment. |
Good practice is to store all error messages somewhere along with request data for further manual review.
Output data format
By default we are using JSON output data format for all of our endpoints, you can control format of data by using output_format
variable in query string parameters.
URL Parameters
Parameter | Type | Description |
---|---|---|
output_format | string | Output data format (optional, default value is json , possible values are json , xml or csv ) |
csv_include_header | bool | Ignore header line in CSV output? (optional, default value is true , true to include CSV header line, false otherwise) |
csv_include_quotes | bool | Encapsulate strings with quotes in CSV output? (optional, default value is false , true to encapsulate all strings with " , false to leave them unquoted) |
csv_exclude_col | string | Comma delimited list of column names to ignore in CSV output (optional, by default all columns are included) |
csv_set_delimiter | string | Character that will be used as column delimiter in CSV output (optional, default value is ; ) |
csv_set_dec_mark | string | Character that will be used as decimal separator in CSV output (optional, default value is . ) |
csv_set_timeformat | string | Format for datetime type in CSV output or unix for unix timestamp (optional, default value is yyyy-MM-ddTHH:mm:ss.fffffffZ ) |
csv_set_newline | string | New line type (optional, default value is unix , possible values win , mac , unix ) |
Excel / G-Sheets
There are several ways to use data from our REST API inside the Excel, Google Sheets, or similar calculation sheet application. This section will do as best as possible to keep all information up to date on how you could load the data into these applications. Feel free to contact support if we are missing an option.
CSV download, import:
- Open the data in the CSV format from the browser eg.
https://rest.coinapi.io/v1/exchangerate/USD?apikey=YOUR_API_KEY&invert=true&output_format=csv
- Save the data to the file with the .csv extension.
- Use the file saved and import it into the software.
- When configuring import, refer to the parameters like delimiter from the Output data format
The platform-independent way described above is based on CSV but could also be used in other formats like JSON and XML as long as the software support it, but the import procedure needs to be adjusted accordingly.
Microsoft Excel
- Use PowerQuery to load the URL directly into the CSV import without saving the file locally.
- Use the =WEBSERVICE function to load the API response directly into the sheet, but this will not parse the data; additional processing is required.
Google Sheets
- Use =IMPORT function to load the REST API endpoint and automatically parse the CSV format data into the cells. eg.
=IMPORTDATA("https://rest.coinapi.io/v1/exchangerate/USD?apikey=YOUR_API_KEY&invert=true&output_format=csv
OpenOffice Calc
- Select the menu Insert -> Sheet From File, 2. In the Insert dialog, put the URL eg.
https://rest.coinapi.io/v1/exchangerate/USD?apikey=YOUR_API_KEY&invert=true&output_format=csv
in the File Name box at the bottom. Set the drop-down list next to that to Web Page Query and click Open. The Text Import dialog opens where you can change the defaults if needed.
Authentication
- API Key: ApiKey
CoinApi API key needed to access the endpoints
Security Scheme Type: | apiKey |
---|---|
Header parameter name: | X-CoinAPI-Key |
License
MIT License