Get Current Usage For User
Description
Gets the total number of bytes used by a specified user in the current billing period.
GET
https://<appname>.metered.live/api/v1/turn/current_usage_for_user?secretKey=<secretKey>&username=<username>
<appname>
- replace it with the name of your app.
<secretKey>
- app's secret key.
<username>
- name of the user.
Request
GET /api/v1/turn/current_usage_for_user
Query Parameters
Parameter | Description | Data Type |
---|---|---|
secretKey | The app's secret key for authentication. | String |
username | The name of the user. | String |
Responses
Success Response
A JSON object containing the following field:
Field | Description | Data Type |
---|---|---|
usageInGB | The usage in gigabytes for the current billing cycle period | Number |
HTTP Status: 200 OK
Body:
{
"usageInGB": 5.2
}
Error Responses
Invalid Secret Key:
HTTP Status:
401 Unauthorized
Body:
{
"message": "Invalid Secret Key"
}No Secret Key Specified:
HTTP Status:
400 Bad Request
Body:
{
"message": "please pass the `secretKey` query parameter"
}No Username Specified:
HTTP Status:
400 Bad Request
Body:
{
"message": "please pass the `username` query parameter"
}Invalid Request:
HTTP Status:
400 Bad Request
Body:
{
"message": "Invalid request. Not subscribed to any turn server plan"
}Credential Not Found:
HTTP Status:
401 Unauthorized
Body:
{
"message": "credential not found"
}