Skip to main content

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

ParameterDescriptionData Type
secretKeyThe secret key for authenticationString

Body Parameters

ParameterDescriptionData Type
usernameThe username of the userString

Responses

Success Response

A JSON object containing the following fields:

FieldDescriptionData Type
messageA message indicating that the credential has been enabledString

HTTP Status: 200 OK

Body:

{
"message": "Credential enabled successfully"
}

Error Responses

  • Invalid secret key:

    HTTP Status: 401 Unauthorized

    Body:

    {
    "message": "Invalid secret key"
    }
  • No secret key specified:

    HTTP Status: 400 Bad Request

    Body:

    {
    "message": "Please specify secret key"
    }
  • Username field missing in the request body:

    HTTP Status: 400 Bad Request

    Body:

    {
    "message": "`username` field missing in the request body"
    }
  • Credential not found:

    HTTP Status: 401 Unauthorized

    Body:

    {
    "message": "Credential not found"
    }
  • Cannot enable this credential:

    HTTP Status: 400 Bad Request

    Body:

    {
    "message": "Cannot enable this credential"
    }
  • Credential is already enabled:

    HTTP Status: 400 Bad Request

    Body:

    {
    "message": "Credential is already enabled"
    }
  • Internal server error:

    HTTP Status: 500 Internal Server Error

    Body:

    {
    "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>"
})
})