Delete TURN Credential from a Project by Label
Use this endpoint to delete all active (non-expired) TURN credentials within a specific project that share a given label. You can authenticate by providing either the secretKey
(for your entire application) or the projectApiKey
(for a specific project).
DELETE
https://<appname>.metered.live/api/v2/turn/project/:projectId/credential/by_label
<appname>
- Replace with the name of your app.
:projectId
- The unique ID of the project from which credentials will be deleted.
Request
DELETE /api/v2/turn/project/:projectId/credential/by_label
Path Parameter
Parameter | Description | Data Type |
---|---|---|
projectId | The unique ID of the project (must be a valid ObjectId) | String |
Query Parameters (Authentication)
Parameter | Description | Data Type |
---|---|---|
secretKey | The secret key for your application, found in Dashboard → Developers → Secret Key. Only one of secretKey or projectApiKey is required. | String |
projectApiKey | The API key for the specific project. Only one of secretKey or projectApiKey is required. | String |
Body Parameters
Parameter | Description | Type | Required |
---|---|---|---|
label | The label used to identify credentials for deletion. Must be a non-empty string fewer than 100 characters. | String | Yes |
Example Request Body
{
"label": "my-labeled-credential"
}
Responses
Success Response
Returns a JSON object indicating how many credentials were deleted:
Field | Description | Data Type |
---|---|---|
deleted | The total number of credentials that were successfully removed. | Number |
HTTP Status: 200 OK
Example Success Response
{
"deleted": 2
}
Error Responses
HTTP Status | Message | Description |
---|---|---|
400 | Label must be a string of less than 100 characters | The label parameter is missing or invalid. |
400 | Label cannot be empty | An empty string was provided for label . |
400 | Invalid request. Not subscribed to any turn server plan | The application is not subscribed to a TURN server plan. |
Code Examples
cURL
curl -X DELETE "https://<appname>.metered.live/api/v2/turn/project/63fdb9f998c1abec0bd3e16c/credential/by_label?secretKey=<YOUR_SECRET_KEY>" \
-H "Content-Type: application/json" \
-d '{
"label": "my-labeled-credential"
}'
JavaScript (Fetch)
fetch(
`https://<appname>.metered.live/api/v2/turn/project/63fdb9f998c1abec0bd3e16c/credential/by_label?projectApiKey=<PROJECT_API_KEY>`,
{
method: "DELETE",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
label: "my-labeled-credential",
}),
}
)
.then((response) => response.json())
.then((data) => console.log("Credentials Deleted:", data.deleted))
.catch((error) => console.error("Error:", error));
``;