Skip to main content

Regenerate Project API Key

Use this endpoint to regenerate the API Key for an existing TURN Server project. Once regenerated, the old API Key will no longer be valid for that project.


POST
https://<appname>.metered.live/api/v2/turn/project/:projectId/regenerate_api_key?secretKey=<YOUR_SECRET_KEY>

<appname> - Replace with the name of your app.

<YOUR_SECRET_KEY> - Your secret key, found in the Dashboard → Developers → Secret Key.

:projectId - The unique ID of the project for which to regenerate the API Key.


Request

POST /api/v2/turn/project/:projectId/regenerate_api_key?secretKey=<YOUR_SECRET_KEY>

Path Parameter

ParameterDescriptionData Type
projectIdThe unique ID of the project for which the API Key is regenerated.String

Query Parameter

ParameterDescriptionData Type
secretKeyThe secret key of your application (required)String

Note: This endpoint does not require a request body.


Responses

Success Response

FieldTypeDescription
apiKeyStringThe newly generated API Key for the specified project.
successBooleanIndicates whether the regeneration was successful (true).

HTTP Status: 200 OK

Example Success Response
{
"apiKey": "pk_aaabbbbccdddd",
"success": true
}

Error Responses

HTTP StatusMessageDescription
400invalid secretKey app not foundThe provided secretKey is invalid or does not match an existing app.
400projectId is requiredThe projectId path parameter was not provided.
400Invalid projectIdThe projectId is not a valid MongoDB ObjectId.
400Project not foundNo project matching the specified projectId was found.
500Internal error occurredAn unexpected error occurred on the server side.

Code Examples

cURL

curl -X POST "https://<appname>.metered.live/api/v2/turn/project/63fdb9f998c1abec0bd3e16c/regenerate_api_key?secretKey=<YOUR_SECRET_KEY>" \
-H "Content-Type: application/json"

JavaScript (Fetch)

fetch(
`https://<appname>.metered.live/api/v2/turn/project/63fdb9f998c1abec0bd3e16c/regenerate_api_key?secretKey=<YOUR_SECRET_KEY>`,
{
method: "POST",
}
)
.then((response) => response.json())
.then((data) => console.log("New API Key:", data.apiKey))
.catch((error) => console.error("Error:", error));