Menu

How can users check their reports API usage?


Objective

How can users checked how many reports have been requested via the Reports API?

Applies To

  • Reports API

Procedure

  1. Users can gather this information by doing a load records synchronously for the product "REPORTS-USAGE". This is free and the searchable date range is 7 days.
  2. Users can either use cURL or do a HTTP GET request for this information.
  3. Command to be issue in cURL: curl --location --request GET 'https://api.nexmo.com/v2/reports/records?account_id=<API-KEY>&product=REPORTS-USAGE&date_start=YYYY-MM-DDTHH:MM:SSZ&date_end=YYYY-MM-DDTHH:MM:SSZ' \
    --header 'Authorization: Basic <basic auth hash>=' Or
  4. Command to be issued in HTTP: GET /v2/reports/records?account_id=<API-KEY>&product=REPORTS-USAGE&date_start=2021-10-06T00:00:00Z&date_end=2021-10-07T23:59:00Z HTTP/1.1
    Host: api.nexmo.com
    Authorization: Basic <basic auth hash>=
  5. You will receive callback similar to below, the "items_count": 3 showed that 3 reports were extracted during the search time frame. The details of the 3 reports as below. 
    {
    "_links": {
    "self": {
    "href": "https://api.nexmo.com/v2/reports/records?account_id=<API-KEY>&product=REPORTS-USAGE&date_start=YYYY-MM-DDTHH%3AMM%3ASSZ&date_end=YYYY-MM-DDTHH%3AMM%3ASSZ"
    }
    },
    "request_id": "555042c5-368a-4fd2-b983-f24197692bac",
    "request_status": "SUCCESS",
    "received_at": "2021-10-07T09:08:58+00:00",
    "price": 0.0,
    "currency": "EUR",
    "limit": 1000,
    "items_count": 3,
    "include_subaccounts": false,
    "records": [
    {
    "acc": "<API-KEY>",
    "product_type": "reports",
    "date_received": "2021-10-07T08:04:05+00:00",
    "date_started": null,
    "date_finished": "2021-10-07T08:04:07+00:00",
    "status": "SUCCESS",
    "account_id": "<API-KEY>",
    "master_account_id": "<API-KEY>",
    "is_charged": "true",
    "request_params": "{product: 'SMS', account_id: '<API-KEY>', include_message: 'false', include_subaccounts: 'false', direction: 'outbound'date_start'Thu Oct 07 00:00:00 UTC 2021',date_end'Thu Oct 07 23:59:00 UTC 2021',}",
    "job_type": "SYNC_JOB_FROM_DATES",
    "requested_product": "SMS",
    "items_written": "4",
    "price": "0.0004000",
    "currency": "EUR",
    "total_price": "0.0012000",
    "id": "b2a77e8f-9701-45e4-b88c-595127be4875"
    },
    {
    "acc": "<API-KEY>",
    "product_type": "reports",
    "date_received": "2021-10-07T07:38:52+00:00",
    "date_started": null,
    "date_finished": "2021-10-07T07:38:54+00:00",
    "status": "SUCCESS",
    "account_id": "<API-KEY>",
    "master_account_id": "<API-KEY>",
    "is_charged": "true",
    "request_params": "{product: 'SMS', account_id: '<API-KEY>', include_message: 'true', include_subaccounts: 'false', direction: 'outbound'date_start'Thu Sep 30 00:00:00 UTC 2021',date_end'Thu Sep 30 23:59:00 UTC 2021',}",
    "job_type": "SYNC_JOB_FROM_DATES",
    "requested_product": "SMS",
    "items_written": "7",
    "price": "0.0004000",
    "currency": "EUR",
    "total_price": "0.0028000",
    "id": "e5e42c12-bd9c-48cc-a3da-0ee2dc7b4eb7"
    },
    {
    "acc": "<API-KEY>",
    "product_type": "reports",
    "date_received": "2021-10-07T05:48:19+00:00",
    "date_started": null,
    "date_finished": "2021-10-07T05:48:20+00:00",
    "status": "SUCCESS",
    "account_id": "<API-KEY>",
    "master_account_id": "<API-KEY>",
    "is_charged": "true",
    "request_params": "{product: 'SMS', account_id: '<API-KEY>', include_message: 'true', include_subaccounts: 'false', direction: 'outbound'date_start'Thu Oct 07 00:00:00 UTC 2021',date_end'Fri Oct 08 00:00:00 UTC 2021',, status: 'delivered'}",
    "job_type": "SYNC_JOB_FROM_DATES",
    "requested_product": "SMS",
    "items_written": "0",
    "price": "0.0004000",
    "currency": "EUR",
    "total_price": "0.0000000",
    "id": "35063f91-1cde-4e06-9625-17c5ce758956"
    }
    ],
    "product": "REPORTS-USAGE",
    "account_id": "<API-KEY>",
    "date_start": "2021-10-06T00:00:00+00:00",
    "date_end": "2021-10-07T23:59:00+00:00",
    "endpoint_type": "PUBLIC"
    }

Additional Information

For more information on available commands, see the Reports API developer documentation.

 

Was this article helpful?
0 out of 0 found this helpful
Follow
Have more questions? Submit a request