Skip to main content

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

ParameterDescriptionData Type
projectIdThe unique ID of the project (must be a valid ObjectId)String

Query Parameters (Authentication)

ParameterDescriptionData Type
secretKeyThe secret key for your application, found in Dashboard → Developers → Secret Key. Only one of secretKey or projectApiKey is required.String
projectApiKeyThe API key for the specific project. Only one of secretKey or projectApiKey is required.String

Body Parameters

ParameterDescriptionTypeRequired
labelThe label used to identify credentials for deletion. Must be a non-empty string fewer than 100 characters.StringYes
Example Request Body
{
"label": "my-labeled-credential"
}

Responses

Success Response

Returns a JSON object indicating how many credentials were deleted:

FieldDescriptionData Type
deletedThe total number of credentials that were successfully removed.Number

HTTP Status: 200 OK

Example Success Response
{
"deleted": 2
}

Error Responses

HTTP StatusMessageDescription
400Label must be a string of less than 100 charactersThe label parameter is missing or invalid.
400Label cannot be emptyAn empty string was provided for label.
400Invalid request. Not subscribed to any turn server planThe 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));
``;