Get Turn Usage by User
This endpoint retrieves the total bytes used by each user on a TURN server.
GET
https://<appname>.metered.live/api/v1/turn/current_usage_by_user
<appname>
- replace it with the name of your app.
Request
GET /api/v1/turn/current_usage_by_user
Query Parameters
Parameter | Description | Data Type |
---|---|---|
secretKey | The secret key for authorization | String |
Responses
Success Response
A JSON object containing the following fields:
Field | Description | Data Type |
---|---|---|
username | The username of a user | String |
usageInGB | The total bytes used by the user in gigabytes (GB) | Number |
HTTP Status: 200 OK
Body:
[
{
"username": "user1",
"usageInGB": 2.14
},
{
"username": "user2",
"usageInGB": 1.37
}
]
Error Responses
Invalid API Key:
HTTP Status:
401 Unauthorized
Body:
{
"error": "Invalid API Key"
}No API Key Specified:
HTTP Status:
400 Bad Request
Body:
{
"error": "Please specify API Key"
}Not subscribed to any TURN server plan:
HTTP Status:
400 Bad Request
Body:
{
"message": "Invalid request. Not subscribed to any turn server plan"
}Internal error:
HTTP Status:
500 Internal Server Error
Body:
{
"message": "Internal error occurred, contact support and provide the event id: <event_id>"
}
Code Examples
Curl
curl -X GET "https://<appname>.metered.live/api/v1/turn/current_usage_by_user?apiKey=your_api_key"