Billing Logs API
This document highlights the Billing Logs details.
API Description
Objective
The Billing Logs API provides daily usage logs of all API calls made against each App ID for the previous day. These logs can be retrieved and stored for cross verification with the Results API, Case Management, and monthly billing records.
| Input | Output |
|---|---|
| The date for which the usage logs are requested | A URL to download the CSV file containing the previous day's API usage logs |
API URL
https://billing-dashboard.hyperverge.co/v1/logs/module/daily
API Endpoint
logs/module/daily
Overview
The API is RESTful and uses standard HTTP verbs and status codes. The responses are in JSON format and you should upload all images and files as form-data through a POST request.
Authentication
You need a unique pair of application ID ( appId ) and application key (appKey) from HyperVerge to verify your identity for accessing the API.
| Parameter | Mandatory or Optional | Description | Allowed Values |
|---|---|---|---|
| content-type | Mandatory | This parameter defines the media type for the request payload | application/json |
| appId | Mandatory | The application identifier shared by HyperVerge. You can find the details in the dashboard's credentials tab. | This should be a unique value. |
| appKey | Mandatory | The application key shared by HyperVerge. You can find the details in the dashboard's credentials tab. | This should be a unique value. |
Input
The following table provides the complete information on the input parameter for the API:
| Parameter | Description | Mandatory or Optional | Allowed Values | Default Value |
|---|---|---|---|---|
date | The requested date for the logs, which must be a past date and accessible only after 10 AM the following day | Mandatory | Allowed format: YYYY-MM-DD | Not Applicable |
Request
The following code snippet demonstrates a standard curl request for the API:
curl --location --request POST 'https://billing-dashboard.hyperverge.co/v1/logs/module/daily' \
--header 'Content-Type: application/json' \
--header 'appId: <Enter_the_HyperVerge_appId>' \
--header 'appKey: <Enter_the_HyperVerge_appKey>' \
--data '{
"date": "<Enter_the_date_in_YYYY-MM-DD_format>"
}'
Success Response
The following is a success response from the API:
{
"status": "success",
"data": {
"url": "s3Url"
}
}
Success Response Details
The following table highlights the details of the success response from the API:
| Parameter | Type | Description |
|---|---|---|
| status | string | The status of the request |
| data | object | The object containing the response data |
| url | string | The URL pointing to the log file(CSV) stored in S3, which is valid for 15 minutes |
Structure of the CSV File
The CSV file provided by the S3 link has the following structure:
| Field Name | Description |
|---|---|
| requestid | A unique identifier for tracking and reference, which is assigned to each request |
| appid | An App ID which was used to make the request |
| reference_id | An identifier provided in the API request to track and associate it with another API or workflow |
| transaction_id | A unique identifier associated with the specific transaction related to the request |
| statuscode | The HTTP status code returned by the API, indicating the success or failure of the request |
| originalurl | The API endpoint URL where the request was sent |
| event_timestamp | The exact date and time (in UTC) when the request was initiated |
Failure Response
The following code snippet displays a failure response from the API:
- File Not Found
{
"statusCode": 404,
"status": "error",
"message": "File not found"
}
Error Responses
The following are the error responses from the API:
- Input Validation Error: Missing Date
- Missing/Invalid credentials
- Input Validation Error: Invalid Date
{
"status": 400,
"message": {
"message": "Validation Failed",
"error": {
"date": "'date' is required"
}
}
}
{
"status": 401,
"message": {
"status": 401,
"message": "Missing/Invalid credentials"
}
}
{
"statusCode": 422,
"status": "error",
"message": "Invalid date"
}
Failure and Error Response Details
A failure or error response from the module contains a failure status, with a relevant status code and error message.
The following table lists all the error responses:
| Status Code | Error Message | Error Description |
|---|---|---|
| 400 | Validation Failed | The request is missing a mandatory field — date is required |
| 401 | Missing/Invalid credentials | The request is either missing the mandatory appId and appKey combination or has invalid values |
| 404 | File not found | The requested log file could not be found |
| 422 | Invalid date | The provided date contains an invalid value or is a date in the future |
| 500 | Internal Server Error | Please check the request headers or contact the HyperVerge team for resolution. |