Delete TURN Credential by Label
Use this endpoint to delete all active (non-expired) TURN credentials associated with a specific label. You must authenticate using your application's secretKey.
DELETE
https://<appname>.metered.live/api/v2/turn/credential/by_label
<appname>
- Replace with the name of your app.
Request
DELETE /api/v2/turn/credential/by_label
Query Parameters
Parameter | Description | Data Type |
---|---|---|
secretKey | Your application's secret key, found in Dashboard → Developers → Secret Key (required). | String |
label | The label that identifies the credentials you wish to delete. Must be fewer than 100 characters. | String |
Example Request
DELETE /api/v2/turn/credential/by_label?secretKey=<YOUR_SECRET_KEY>&label=my-labeled-credential
Responses
Success Response
Returns a JSON object indicating how many credentials were deleted:
Field | Description | Data Type |
---|---|---|
deleted | The number of credentials that were successfully removed. | Number |
HTTP Status: 200 OK
Example Success Response
{
"deleted": 3
}
Error Responses
HTTP Status | Message | Description |
---|---|---|
400 | secretKey is required | The secretKey query parameter was not provided. |
400 | invalid secretKey | The provided secretKey is invalid. |
400 | Invalid request. Not subscribed to any turn server plan | The application is not subscribed to a TURN server plan. |
400 | Label must be a string of less than 100 characters | The label parameter is invalid or exceeds the maximum length. |
Code Examples
cURL
curl -X DELETE "https://<appname>.metered.live/api/v2/turn/credential/by_label?secretKey=<YOUR_SECRET_KEY>&label=my-label"
JavaScript (Fetch)
fetch(
`https://<appname>.metered.live/api/v2/turn/credential/by_label?secretKey=<YOUR_SECRET_KEY>&label=my-label`,
{
method: "DELETE",
}
)
.then((response) => response.json())
.then((data) => console.log("Credentials Deleted:", data.deleted))
.catch((error) => console.error("Error:", error));