Delete TURN Credential from a Project
Use this endpoint to delete a single TURN credential (by username
) within a specific project. 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
<appname>
- Replace with the name of your app.
:projectId
- The unique ID of the project from which the credential will be deleted.
Request
DELETE /api/v2/turn/project/:projectId/credential
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 |
---|---|---|---|
username | The TURN username of the credential you want to remove. | String | Yes |
Example Request Body
{
"username": "c7e21d0a812c0c3fdb3af925"
}
Responses
Success Response
Returns a JSON object indicating the credential was removed:
Field | Description | Data Type |
---|---|---|
success | true if the credential was successfully removed. | Boolean |
message | Confirmation message. | String |
HTTP Status: 200 OK
Example Success Response
{
"success": true,
"message": "credential removed"
}
Error Responses
HTTP Status | Message | Description |
---|---|---|
400 | username is required, please provide the username of the credential to be removed in the request body | The username field was not provided in the request body. |
400 | credential of the specified username is not found | No credential matching the provided username was found under the specified project. |
Code Examples
cURL
curl -X DELETE "https://<appname>.metered.live/api/v2/turn/project/63fdb9f998c1abec0bd3e16c/credential?secretKey=<YOUR_SECRET_KEY>" \
-H "Content-Type: application/json" \
-d '{
"username": "c7e21d0a812c0c3fdb3af925"
}'
JavaScript (Fetch)
fetch(
`https://<appname>.metered.live/api/v2/turn/project/63fdb9f998c1abec0bd3e16c/credential?projectApiKey=<PROJECT_API_KEY>`,
{
method: "DELETE",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
username: "c7e21d0a812c0c3fdb3af925",
}),
}
)
.then((response) => response.json())
.then((data) => console.log("Delete Response:", data))
.catch((error) => console.error("Error:", error));