Sub Mgmt API
Subscriptions

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

  1. GET /api/subscriptions/usage/metrics

Output variables

VariableDescription
metric_idMetric id
metric_nameMetric name
dimensionsArray dimensions metrics
nameDimension name
valueDimension 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

  1. GET /api/subscriptions/usage/metrics/summary

Output variables

VariableDescription
metric_nameMetric name
dimensionsArray 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

  1. GET /api/subscriptions/usage/metrics/history?metric_id={metric_id}
  2. GET /api/subscriptions/usage/metrics/history?metric_id={metric_id}&time_start={time_start}
  3. GET /api/subscriptions/usage/metrics/history?metric_id={metric_id}&time_end={time_end}
  4. GET /api/subscriptions/usage/metrics/history?metric_id={metric_id}&time_start={time_start}&time_end={time_end}

URL Parameters

ParameterTypeDescription
metric_idlongMetric id
time_startdatestringStarting date (optional)
time_enddatestringEnding date (optional)
limitintAmount 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

VariableDescription
timeDate
valueRequests 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

  1. GET /api/subscriptions/usage/metrics/history?metric_name={metric_name}&groupby={groupby}
  2. GET /api/subscriptions/usage/metrics/history?metric_name={metric_name}&groupby={groupby}&time_start={time_start}
  3. GET /api/subscriptions/usage/metrics/history?metric_name={metric_name}&groupby={groupby}&time_end={time_end}
  4. GET /api/subscriptions/usage/metrics/history?metric_name={metric_name}&groupby={groupby}&time_start={time_start}&time_end={time_end}

URL Parameters

ParameterTypeDescription
metric_namestringMetric name
groupbystringDimension name by which we will group
time_startdatestringStarting date (optional)
time_enddatestringEnding date (optional)
limitintAmount 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

VariableDescription
series_labelAn array of available values
rowsResult 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

  1. GET /api/subscriptions/usage/rest/history
  2. GET /api/subscriptions/usage/rest/history?date_start={date_start}
  3. GET /api/subscriptions/usage/rest/history?date_end={date_end}
  4. GET /api/subscriptions/usage/rest/history?date_start={date_start}&date_end={date_end}

URL Parameters

ParameterTypeDescription
date_startdatestringStarting date (optional)
date_enddatestringEnding date (optional)
limitintAmount 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

VariableDescription
dateDate of the period
requestsRequests 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

  1. GET /api/subscriptions/usage/rest/detailed/history
  2. GET /api/subscriptions/usage/rest/detailed/history?date_start={date_start}
  3. GET /api/subscriptions/usage/rest/detailed/history?date_end={date_end}
  4. GET /api/subscriptions/usage/rest/detailed/history?date_start={date_start}&date_end={date_end}

URL Parameters

ParameterTypeDescription
date_startdatestringStarting date (optional)
date_enddatestringEnding date (optional)
limitintAmount 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

VariableDescription
dateLeft range of the period where the request was executed
typeRequest type
requestsAPI Requests counted
apicallsAPI 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

  1. GET /api/subscriptions/usage/stream/history
  2. GET /api/subscriptions/usage/stream/history?date_start={date_start}
  3. GET /api/subscriptions/usage/stream/history?date_end={date_end}
  4. GET /api/subscriptions/usage/stream/history?date_start={date_start}&date_end={date_end}

URL Parameters

ParameterTypeDescription
date_startdatestringStarting date (optional)
date_enddatestringEnding date (optional)
limitintAmount 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

VariableDescription
dateDate of the period
total_connections_daysAmount of connections days used in specific day
total_gigabytes_deliveredAmount of gigabytes of data delivered in specific day
total_messages_deliveredNumber 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

  1. GET /api/subscriptions/usage/stream/detailed/history
  2. GET /api/subscriptions/usage/stream/detailed/history?time_start={time_start}
  3. GET /api/subscriptions/usage/stream/detailed/history?time_end={time_end}
  4. GET /api/subscriptions/usage/stream/detailed/history?time_start={time_start}&time_end={time_end}

URL Parameters

ParameterTypeDescription
time_starttimestringLog starting time in ISO 8601 (optional)
time_endtimestringLog ending time in ISO 8601 (optional)
limitintAmount 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

VariableDescription
time_startTime on which data streaming was started
time_endTime on which data streaming was ended
protocol_nameProtocol type used for data distribution (WebSocket/FIX)
ip_clientClient IP address from which connection was established
bytes_sendBytes send on the connection by the CoinAPI
bytes_recvBytes received on the connection by the CoinAPI
msgs_sendMessages send on the connection by CoinAPI
msgs_recvMessages received on the conncetion by CoinAPI
msgs_lostMessages 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

  1. 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

  1. GET /api/subscriptions/reactivate

Copyright 2022 COINAPI LTD or its affiliates. All rights reserved.
StatusPage: