Enable TURN Credential
Enable a TURN credential that has been previously disabled.
POST
https://<appname>.metered.live/api/v1/turn/credential/enable
<appname> - replace it with the name of your app.
Request
POST /api/v1/turn/credential/enable
Query Parameters
| Parameter | Description | Data Type |
|---|---|---|
| secretKey | The secret key for authentication | String |
Body Parameters
| Parameter | Description | Data Type |
|---|---|---|
| username | The username of the user | String |
Responses
Success Response
A JSON object containing the following fields:
| Field | Description | Data Type |
|---|---|---|
| message | A message indicating that the credential has been enabled | String |
HTTP Status: 200 OK
Body:
{
"message": "Credential enabled successfully"
}
Error Responses
Invalid secret key:
HTTP Status:
401 UnauthorizedBody:
{
"message": "Invalid secret key"
}No secret key specified:
HTTP Status:
400 Bad RequestBody:
{
"message": "Please specify secret key"
}Username field missing in the request body:
HTTP Status:
400 Bad RequestBody:
{
"message": "`username` field missing in the request body"
}Credential not found:
HTTP Status:
401 UnauthorizedBody:
{
"message": "Credential not found"
}Cannot enable this credential:
HTTP Status:
400 Bad RequestBody:
{
"message": "Cannot enable this credential"
}Credential is already enabled:
HTTP Status:
400 Bad RequestBody:
{
"message": "Credential is already enabled"
}Internal server error:
HTTP Status:
500 Internal Server ErrorBody:
{
"message": "Internal server error occurred. If the problem persists, please contact support."
}
Code Examples
JavaScript (Fetch API)
fetch("/api/v1/turn/credential/enable?secretKey=<YOUR_SECRET_KEY>", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
username: "<USERNAME>"
})
})