Subscriptions
This section describes calls related to your API subscription.
Metrics GET
curl https://www.coinapi.io/api/subscriptions/usage/metrics \
--request GET
--header "X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY"
The above command returns JSON structured like this:
[
{
"metric_id": 721433026231049264,
"metric_name": "EMSX_EXCHANGE_RUNTIME_SECONDS",
"dimensions": [
{
"name": "APIKey",
"value": "73034021-THIS-IS-SAMPLE-KEY"
},
{
"name": "DataCenter",
"value": "HQ-2"
},
{
"name": "NodeName",
"value": "HDC1-ENC-02-BAY-08"
}
]
},
{
"metric_id": 722912023989230513,
"metric_name": "EMSX_EXCHANGE_RUNTIME_SECONDS",
"dimensions": [
{
"name": "APIKey",
"value": "73034021-THIS-IS-SAMPLE-KEY"
},
{
"name": "DataCenter",
"value": "HQ-2"
},
{
"name": "NodeName",
"value": "HDC1-ENC-02-BAY-06"
}
]
},
{
"metric_id": 725775001944128463,
"metric_name": "COINAPI_DATA_MSGS_SENT_DETAILED",
"dimensions": [
{
"name": "APIKey",
"value": "73034021-THIS-IS-SAMPLE-KEY"
},
{
"name": "DataCenter",
"value": "HQ-2"
},
{
"name": "NodeName",
"value": "HDC1-ENC-02-BAY-06"
},
{
"name": "OperationName",
"value": "EXCHANGERATE_BASE_CURRENT"
},
{
"name": "ProtocolName",
"value": "REST"
},
{
"name": "ServiceName",
"value": "MarketData"
}
]
}
]
Gets all possible metrics available to the user.
HTTP Request
GET /api/subscriptions/usage/metrics
Output variables
Variable | Description |
---|---|
metric_id | Metric id |
metric_name | Metric name |
dimensions | Array dimensions metrics |
name | Dimension name |
value | Dimension value |
Metrics summary GET
curl https://www.coinapi.io/api/subscriptions/usage/metrics/summary \
--request GET
--header "X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY"
The above command returns JSON structured like this:
[
{
"metric_name": "COINAPI_APICALLS_COUNT",
"dimensions": [
"APIKey",
"DataCenter",
"NodeName",
"OperationName",
"ProtocolName",
"ServiceName"
]
},
{
"metric_name": "COINAPI_APICALLS_RESPONSE_MILLISECONDS",
"dimensions": [
"APIKey",
"DataCenter",
"NodeName",
"ProtocolName",
"ServiceName"
]
}
]
Gets all possible metrics available to the user, with all available dimensions grouped together.
HTTP Request
GET /api/subscriptions/usage/metrics/summary
Output variables
Variable | Description |
---|---|
metric_name | Metric name |
dimensions | Array dimensions metrics name |
Metrics history GET
curl https://www.coinapi.io/api/subscriptions/usage/metrics/history \
--request GET
--header "X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY"
The above command returns JSON structured like this:
[
{
"time": "2022-03-11T01:26:00.0000000Z",
"value": 170
},
{
"time": "2022-03-11T01:27:00.0000000Z",
"value": 270
},
{
"time": "2022-03-11T01:28:00.0000000Z",
"value": 354
},
{
"time": "2022-03-11T01:29:00.0000000Z",
"value": 226
},
{
"time": "2022-03-11T01:30:00.0000000Z",
"value": 323
},
{
"time": "2022-03-11T01:31:00.0000000Z",
"value": 322
}
]
Get the historical daily number of requests used per metric_id. Use this endpoint for visualization, analytics, and reporting.
HTTP Request
GET /api/subscriptions/usage/metrics/history?metric_id={metric_id}
GET /api/subscriptions/usage/metrics/history?metric_id={metric_id}&time_start={time_start}
GET /api/subscriptions/usage/metrics/history?metric_id={metric_id}&time_end={time_end}
GET /api/subscriptions/usage/metrics/history?metric_id={metric_id}&time_start={time_start}&time_end={time_end}
URL Parameters
Parameter | Type | Description |
---|---|---|
metric_id | long | Metric id |
time_start | datestring | Starting date (optional) |
time_end | datestring | Ending date (optional) |
limit | int | Amount of items to return (optional, mininum is 1, maximum is 100000, default value is 100, if the parameter is used then every 100 output items are counted as one request) |
Output variables
Variable | Description |
---|---|
time | Date |
value | Requests used |
Metrics history group GET
curl https://www.coinapi.io/api/subscriptions/usage/metrics/group \
--request GET
--header "X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY"
The above command returns JSON structured like this:
{
"series_label": [
"HDC1-ENC-02-BAY-06",
"HDC1-ENC-02-BAY-07",
"HDC1-ENC-02-BAY-08"
],
"rows": [
[
"2022-03-11T00:00:00.0000000Z",
146,
140,
148
],
[
"2022-03-12T00:00:00.0000000Z",
219,
222,
229
],
[
"2022-03-13T00:00:00.0000000Z",
222,
246,
224
],
[
"2022-03-14T00:00:00.0000000Z",
242,
241,
233
],
[
"2022-03-15T00:00:00.0000000Z",
240,
236,
246
]
]
}
Get historical data for each day based on the metric, grouped by name.
HTTP Request
GET /api/subscriptions/usage/metrics/history?metric_name={metric_name}&groupby={groupby}
GET /api/subscriptions/usage/metrics/history?metric_name={metric_name}&groupby={groupby}&time_start={time_start}
GET /api/subscriptions/usage/metrics/history?metric_name={metric_name}&groupby={groupby}&time_end={time_end}
GET /api/subscriptions/usage/metrics/history?metric_name={metric_name}&groupby={groupby}&time_start={time_start}&time_end={time_end}
URL Parameters
Parameter | Type | Description |
---|---|---|
metric_name | string | Metric name |
groupby | string | Dimension name by which we will group |
time_start | datestring | Starting date (optional) |
time_end | datestring | Ending date (optional) |
limit | int | Amount of items to return (optional, mininum is 1, maximum is 100000, default value is 100, if the parameter is used then every 100 output items are counted as one request) |
Output variables
Variable | Description |
---|---|
series_label | An array of available values |
rows | Result table where the date of the event is given as the zero index of the table, the next elements are the values for each labels |
REST usage GET
curl https://www.coinapi.io/api/subscriptions/usage/rest/history \
--request GET
--header "X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY"
The above command returns JSON structured like this:
[
{
"date": "2018-11-01",
"requests": 691
},
{
"date": "2018-10-31",
"requests": 11779
},
{
"date": "2018-10-30",
"requests": 4275
},
{
"date": "2018-10-29",
"requests": 3495
},
{
"date": "2018-10-27",
"requests": 11
},
{
"date": "2018-10-26",
"requests": 56
}
]
Get the historical daily number of requests used. Use this endpoint for visualization, analytics, and reporting. You should not use it to decide if you are approaching the limit in real-time as the data in this report is aggregated daily, and the request credits in real-time are calculated from the last 24-hour using a sliding time window. You can find more information about real-time limits on the Market Data API / General / Limits page.
HTTP Request
GET /api/subscriptions/usage/rest/history
GET /api/subscriptions/usage/rest/history?date_start={date_start}
GET /api/subscriptions/usage/rest/history?date_end={date_end}
GET /api/subscriptions/usage/rest/history?date_start={date_start}&date_end={date_end}
URL Parameters
Parameter | Type | Description |
---|---|---|
date_start | datestring | Starting date (optional) |
date_end | datestring | Ending date (optional) |
limit | int | Amount of items to return (optional, mininum is 1, maximum is 100000, default value is 100, if the parameter is used then every 100 output items are counted as one request) |
Output variables
Variable | Description |
---|---|
date | Date of the period |
requests | Requests used in the period |
REST usage (detailed) GET
curl https://www.coinapi.io/api/subscriptions/usage/rest/detailed/history \
--request GET
--header "X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY"
The above command returns JSON structured like this:
[
{
"time": "2021-07-21T13:30:00.0000000Z",
"type": "EXCHANGERATE_BASE_QUOTE_CURRENT",
"requests": 1,
"apicalls": 1
},
{
"time": "2021-07-21T13:00:00.0000000Z",
"type": "EXCHANGERATE_BASE_QUOTE_CURRENT",
"requests": 1,
"apicalls": 1
},
{
"time": "2021-07-21T11:15:00.0000000Z",
"type": "EXCHANGERATE_BASE_QUOTE_CURRENT",
"requests": 12,
"apicalls": 12
},
{
"time": "2021-07-21T11:15:00.0000000Z",
"type": "EXCHANGERATE_BASE_QUOTE_CURRENT",
"requests": 13,
"apicalls": 13
},
{
"time": "2021-07-21T11:15:00.0000000Z",
"type": "SYMBOLS_LIST",
"requests": 1,
"apicalls": 1
},
{
"time": "2021-07-21T11:15:00.0000000Z",
"type": "EXCHANGERATE_BASE_QUOTE_CURRENT",
"requests": 10,
"apicalls": 10
}
]
Get detailed history of requests executed against API.
HTTP Request
GET /api/subscriptions/usage/rest/detailed/history
GET /api/subscriptions/usage/rest/detailed/history?date_start={date_start}
GET /api/subscriptions/usage/rest/detailed/history?date_end={date_end}
GET /api/subscriptions/usage/rest/detailed/history?date_start={date_start}&date_end={date_end}
URL Parameters
Parameter | Type | Description |
---|---|---|
date_start | datestring | Starting date (optional) |
date_end | datestring | Ending date (optional) |
limit | int | Amount of items to return (optional, mininum is 1, maximum is 100000, default value is 100, if the parameter is used then every 100 output items are counted as one request) |
Output variables
Variable | Description |
---|---|
date | Left range of the period where the request was executed |
type | Request type |
requests | API Requests counted |
apicalls | API Calls counted |
Stream usage GET
curl https://www.coinapi.io/api/subscriptions/usage/stream/history \
--request GET
--header "X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY"
The above command returns JSON structured like this:
[
[
{
"date": "2018-11-01",
"total_connections_days": 2.3030973986550922,
"total_gigabytes_delivered": 40.2514768460354349,
"total_messages_delivered": 45286100
},
{
"date": "2018-10-31",
"total_connections_days": 1.9242,
"total_gigabytes_delivered": 46.42245,
"total_messages_delivered": 224425
}
]
Get the historical streaming usage log.
HTTP Request
GET /api/subscriptions/usage/stream/history
GET /api/subscriptions/usage/stream/history?date_start={date_start}
GET /api/subscriptions/usage/stream/history?date_end={date_end}
GET /api/subscriptions/usage/stream/history?date_start={date_start}&date_end={date_end}
URL Parameters
Parameter | Type | Description |
---|---|---|
date_start | datestring | Starting date (optional) |
date_end | datestring | Ending date (optional) |
limit | int | Amount of items to return (optional, mininum is 1, maximum is 100000, default value is 100, if the parameter is used then every 100 output items are counted as one request) |
Output variables
Variable | Description |
---|---|
date | Date of the period |
total_connections_days | Amount of connections days used in specific day |
total_gigabytes_delivered | Amount of gigabytes of data delivered in specific day |
total_messages_delivered | Number of messages delivered in specific day |
Stream usage (detailed) GET
curl https://www.coinapi.io/api/subscriptions/usage/stream/detailed/history \
--request GET
--header "X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY"
The above command returns JSON structured like this:
[
{
"time_start": "2018-11-01T11:27:22.2855249Z",
"time_end": "2018-11-01T11:31:02.4891607Z",
"protocol_name": "WebSocket",
"ip_client": "127.0.0.1",
"bytes_send": 1845207,
"bytes_recv": 297,
"msgs_send": 1245,
"msgs_recv": 1,
"msgs_lost": 0
},
{
"time_start": "2018-11-01T11:27:21.5511460Z",
"time_end": "2018-11-01T11:31:01.7393780Z",
"protocol_name": "WebSocket",
"ip_client": "127.0.0.1",
"bytes_send": 1842283,
"bytes_recv": 297,
"msgs_send": 1243,
"msgs_recv": 1,
"msgs_lost": 0
},
{
"time_start": "2018-11-01T11:15:46.6302944Z",
"time_end": "2018-11-01T11:26:41.5077182Z",
"protocol_name": "WebSocket",
"ip_client": "127.0.0.1",
"bytes_send": 5488624,
"bytes_recv": 297,
"msgs_send": 3822,
"msgs_recv": 1,
"msgs_lost": 0
}
]
Get the historical streaming detailed usage log.
HTTP Request
GET /api/subscriptions/usage/stream/detailed/history
GET /api/subscriptions/usage/stream/detailed/history?time_start={time_start}
GET /api/subscriptions/usage/stream/detailed/history?time_end={time_end}
GET /api/subscriptions/usage/stream/detailed/history?time_start={time_start}&time_end={time_end}
URL Parameters
Parameter | Type | Description |
---|---|---|
time_start | timestring | Log starting time in ISO 8601 (optional) |
time_end | timestring | Log ending time in ISO 8601 (optional) |
limit | int | Amount of items to return (optional, mininum is 1, maximum is 100000, default value is 100, if the parameter is used then every 100 output items are counted as one request) |
Output variables
Variable | Description |
---|---|
time_start | Time on which data streaming was started |
time_end | Time on which data streaming was ended |
protocol_name | Protocol type used for data distribution (WebSocket/FIX) |
ip_client | Client IP address from which connection was established |
bytes_send | Bytes send on the connection by the CoinAPI |
bytes_recv | Bytes received on the connection by the CoinAPI |
msgs_send | Messages send on the connection by CoinAPI |
msgs_recv | Messages received on the conncetion by CoinAPI |
msgs_lost | Messages lost cased by the TCP client backpressure |
Cancel GET
curl https://www.coinapi.io/api/subscriptions/cancel \
--request GET
--header "X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY"
Flag subscription for the cancelation at the end of the current billing period.
HTTP Request
GET /api/subscriptions/cancel?confirm=yes
Reactivate GET
curl https://www.coinapi.io/api/subscriptions/reactivate \
--request GET
--header "X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY"
Remove the subscription cancelation flag.
HTTP Request
GET /api/subscriptions/reactivate