Enterprise Dashboard API v2 (Current)¶
As an admin user of your organization, you can create API keys, these API keys will allow you to gather consumption data for your organization.
Be aware that API keys from a global organization (payer account) can access data of all tenants, which are part of the global organization.
You can create API Keys in your organization settings (Configuration API Keys) or via API. The tokens are valid for up to 90 days per default. Please make sure that the token security level is set as “Admin” during creation.
You can access https://api-enterprise-dashboard.otc-service.com/ to get started with different API endpoints as well. Please keep in mind that you still need at least a user account with admin permissions to interact with the API. All endpoints, except the Health and Version Endpoints, require Authentication.
Important: Now "v2" api streams data and don't use pagination, so response is "ndjson" in bytes format and not json. It is done for efficient bulk data response.

Consumption¶
This API streams your consumption data in batches of 1,000 records. The response is returned as a string, with each line representing a valid JSON object. You'll need to decode each line and parse it into JSON format on your end.
Please ensure you create an API Key either through the Enterprise Dashboard UI or via the Grafana API directly.
Note: If the same request is made with identical parameters within 1 hour, cached data will be returned instead of fresh data.
Success¶
Code | Reason |
---|---|
200 - OK | Request was successful. |
Error¶
Code | Reason |
---|---|
400 - Bad Request | Some content in the request was invalid. |
422 - Unprocessable Entity | The request was well-formed but contains semantic errors, such as missing dependent mandatory parameters. |
Request¶
Name | In | Type | Description |
---|---|---|---|
consumption_type (Optional) | query | string | To filter record based on billing package like elastic prices(EL) or recurring(RC). |
contract (Optional) | query | integer | To filter based on contract. |
date (Optional) | query | string | To filter based on the date the service was consumed. format = YYYY-MM-DD |
hour (Optional) | query | integer | To filter based on Hour of the day (0-23). |
month (Optional) | query | integer | To filter based on Month number (1-12). |
product (Optional) | query | integer | To filter based on Product Id. |
product_description (Optional) | query | string | To filter based on Product Description. |
project_name (Optional) | query | string | To filter based on project name like "eu-de". |
resource_id (Optional) | query | string | To filter based on the resource id. This field is a unique identifier for all services. |
show_tag (Optional) | query | boolean | This field decides if the tags on the resources will be shown in the result. To filter based on tags by tag_key or tag_value filters. |
tag_key (Optional) | query | string | To filter based on the tag key attached to a resource. Please note that tags are a pair of tag key and tag value. Only effective with tagged=true. |
tag_value (Optional) | query | string | To filter based on the tag value. Please note that tags are a pair of tag key and tag value. Only effective with tagged=true. |
week (Optional) | query | integer | To filter based on Week number (1-53). |
year (Optional) | query | integer | To filter based on Year (2020-2100). |
Curl Example¶
Example request using curl with query parameters and headers:
curl -X GET "https://api-enterprise-dashboard.otc-service.com/v2/hourly/consumption/?date=2025-02-02&consumption_type=EL&week=5" \
-H "Content-Type: application/x-ndjson" \
-H "Authorization: Bearer <YOUR_TOKEN_HERE>"
Response Parameters¶
Response Example (converted to JSON from byte string)¶
{
"amount": 2.5867339103034e-06,
"amount_excluding_discount": 2.5867339103034e-06,
"bill_cycle_day": 1,
"consumption_date": "2024-08-02T00:00:00",
"consumption_type": "EL",
"contract": 1000012345,
"etl_updated": "2024-08-02T03:24:00",
"external_priceplan": "pp_OTC_RDS_BK_SP_EU-DE",
"product": "OTC_RDS_BK_SP",
"product_description": "RDS Backup Space",
"project_id": "845f7226c0d8450793ab07ab1ca80d70",
"quantity": 3.0148413873e-05,
"quantity_type": "GB/Month",
"region": "EU-DE",
"resource_id": "aa0b059b6f124c9c865a2ba8686c8d11in04.obs",
"status": "AGGREGATION_PROCESSED",
"usage_id": "66ac1cfa23b0566fec369b19"
}
Python Example¶
Example showing how to stream and parse the response in Python:
import requests
import json
import logging
# Configure logging
logger = logging.getLogger()
logging.basicConfig(level=logging.INFO)
# API endpoint for hourly consumption
API_URL = "https://api-enterprise-dashboard.otc-service.com/v2/hourly/consumption/"
TOKEN = "<YOUR_TOKEN_HERE>" # Service account or API token
# Set request headers
headers = {
"Content-Type": "application/x-ndjson",
"Authorization": f"Bearer {TOKEN}",
}
# Make GET request with query parameters
try:
response = requests.get(
API_URL,
headers=headers,
params={
"date": "2025-02-02",
"consumption_type": "EL",
"week": 5,
},
timeout=60,
)
if response.status_code != 200:
logger.error("Failed to fetch data: %s", response.text)
else:
# Stream and decode the JSON lines
for data_row in response.iter_lines(decode_unicode=True):
if data_row:
data = json.loads(data_row)
logger.info("Received data: %s", data)
except requests.exceptions.RequestException as e:
logger.exception("Request failed: %s", str(e))
This API streams your consumption data in batches of 1,000 records. The response is returned as a string, with each line representing a valid JSON object. You'll need to decode each line and parse it into JSON format on your end.
Please ensure you create an API Key either through the Enterprise Dashboard UI or via the Grafana API directly.
Note: If the same request is made with identical parameters within 1 hour, cached data will be returned instead of fresh data.
Success¶
Code | Reason |
---|---|
200 - OK | Request was successful. |
Error¶
Code | Reason |
---|---|
400 - Bad Request | Some content in the request was invalid. |
422 - Unprocessable Entity | The request was well-formed but contains semantic errors, such as missing dependent mandatory parameters. |
Request¶
Name | In | Type | Description |
---|---|---|---|
consumption_type (Optional) | query | string | To filter record based on billing package like elastic prices(EL) or recurring(RC). |
contract (Optional) | query | integer | To filter based on contract. |
date (Optional) | query | string | To filter based on the date the service was consumed. format = YYYY-MM-DD |
month (Optional) | query | integer | To filter based on Month number (1-12). |
product (Optional) | query | integer | To filter based on Product Id. |
product_description (Optional) | query | string | To filter based on Product Description. |
project_name (Optional) | query | string | To filter based on project name like "eu-de". |
resource_id (Optional) | query | string | To filter based on the resource id. This field is a unique identifier for all services. |
show_tag (Optional) | query | boolean | This field decides if the tags on the resources will be shown in the result. To filter based on tags by tag_key or tag_value filters. |
tag_key (Optional) | query | string | To filter based on the tag key attached to a resource. Please note that tags are a pair of tag key and tag value. Only effective with tagged=true. |
tag_value (Optional) | query | string | To filter based on the tag value. Please note that tags are a pair of tag key and tag value. Only effective with tagged=true. |
week (Optional) | query | integer | To filter based on Week number (1-53). |
year (Optional) | query | integer | To filter based on Year (2020-2100). |
Curl Example¶
Example request using curl with query parameters and headers:
curl -X GET "https://api-enterprise-dashboard.otc-service.com/v2/daily/consumption/?date=2025-02-02&consumption_type=EL&week=5" \
-H "Content-Type: application/x-ndjson" \
-H "Authorization: Bearer <YOUR_TOKEN_HERE>"
Response Parameters¶
Response Example (converted to JSON from byte string)¶
{
"aggregation_id": "6695b30b94bcea55c2d7703b",
"amount": 0.036312,
"consumption_date": "2024-07-16T00:00:00",
"consumption_type": "EL",
"contract": 1000012345,
"etl_updated": "2024-07-18T03:05:00",
"product": "OTC_KMS_UD_C",
"product_description": "KMS Customer Masterkey",
"project_id": "845f7226c0d8450793ab07ab1ca80d70",
"quantity": 24.0,
"quantity_type": "h",
"region": "EU-DE",
"resource_id": "3eaf12bc-9f70-4e33-849b-fe9cd0de3d36",
"status": "NEW"
}
Python Example¶
Example showing how to stream and parse the response in Python:
import requests
import json
import logging
# Configure logging
logger = logging.getLogger()
logging.basicConfig(level=logging.INFO)
# API endpoint for daily consumption
API_URL = "https://api-enterprise-dashboard.otc-service.com/v2/daily/consumption/"
TOKEN = "<YOUR_TOKEN_HERE>" # Service account or API token
# Set request headers
headers = {
"Content-Type": "application/x-ndjson",
"Authorization": f"Bearer {TOKEN}",
}
# Make GET request with query parameters
try:
response = requests.get(
API_URL,
headers=headers,
params={
"date": "2025-02-02",
"consumption_type": "EL",
"week": 5,
},
timeout=60,
)
if response.status_code != 200:
logger.error("Failed to fetch data: %s", response.text)
else:
# Stream and decode the JSON lines
for data_row in response.iter_lines(decode_unicode=True):
if data_row:
data = json.loads(data_row)
logger.info("Received data: %s", data)
except requests.exceptions.RequestException as e:
logger.exception("Request failed: %s", str(e))
Health¶
This endpoint is used to get the API's health. There is no authentication required and results are not cached. It's used for monitoring the health of our service.
Success¶
Code | Reason |
---|---|
200 - OK | Request was successful. |
Error¶
Code | Reason |
---|---|
400 - Bad Request | Some content in the request was invalid. |
Request¶
N/A
Curl Example¶
curl 'https://api-enterprise-dashboard.otc-service.com/v2/health'
Response Parameters¶
N/A
Response Example¶
{
"status": "ok"
}
Versions¶
This endpoint is used to get the list of api versions. There is no authentication required.
Success¶
Code | Reason |
---|---|
200 - OK | Request was successful. |
Error¶
Code | Reason |
---|---|
400 - Bad Request | Some content in the request was invalid. |
Request¶
N/A
Curl Example¶
curl 'https://api-enterprise-dashboard.otc-service.com/'
Response Parameters¶
N/A
Response Example¶
{
"versions": [
{
"id": "v2",
"links": [
{
"href": "https://api-enterprise-dashboard-beta.otc-service.com/v2",
"rel": "self"
}
],
"min_version": "",
"status": "CURRENT",
"updated": "2024-05-27T00:00:00Z",
"version": ""
}
]
}