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
Parameter | Description | Data Type |
---|---|---|
projectId | The unique ID of the project for which the API Key is regenerated. | String |
Query Parameter
Parameter | Description | Data Type |
---|---|---|
secretKey | The secret key of your application (required) | String |
Note: This endpoint does not require a request body.
Responses
Success Response
Field | Type | Description |
---|---|---|
apiKey | String | The newly generated API Key for the specified project. |
success | Boolean | Indicates whether the regeneration was successful (true ). |
HTTP Status: 200 OK
Example Success Response
{
"apiKey": "pk_aaabbbbccdddd",
"success": true
}
Error Responses
HTTP Status | Message | Description |
---|---|---|
400 | invalid secretKey app not found | The provided secretKey is invalid or does not match an existing app. |
400 | projectId is required | The projectId path parameter was not provided. |
400 | Invalid projectId | The projectId is not a valid MongoDB ObjectId. |
400 | Project not found | No project matching the specified projectId was found. |
500 | Internal error occurred | An 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));