Update Turn Server Project
Use this endpoint to update an existing TURN Server Project’s name, quota, notification settings, etc.
PUT
https://<appname>.metered.live/api/v2/turn/project/:projectId?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 you want to update.
Request
PUT /api/v2/turn/project/:projectId?secretKey=<YOUR_SECRET_KEY>
Path Parameter
Parameter | Description | Data Type |
---|---|---|
projectId | The unique ID of the project. | String |
Query Parameter
Parameter | Description | Data Type |
---|---|---|
secretKey | The secret key of your application (required) | String |
Body Parameters
Parameter | Type | Required | Description |
---|---|---|---|
projectName | String | No | New name for your project. Must be fewer than 100 characters. |
quotaInBytes | Number | No | New data usage quota in bytes. Must be 0 or an integer ≥ 1 MiB (1048576). If 0 , no usage limit is enforced (usage is still tracked). |
webhookUrl | String | No | An HTTPS endpoint (must start with https:// ). If set, the system will send a POST request to this URL when the project quota is reached. |
notificationEmails | Array | No | An array of valid email addresses (max 10). These will receive notifications when usage meets or exceeds the quota (if a quota is set). |
quotaExceededAction | String | No | The action taken when the project quota is reached. Supported values: disable , notify , none . |
Example Request Body
{
"projectName": "MyUpdatedProject",
"quotaInBytes": 2097152,
"webhookUrl": "https://example.com/webhook/turn-updates",
"notificationEmails": ["ops@example.com", "alerts@example.com"],
"quotaExceededAction": "notify"
}
Responses
Success Response
Field | Type | Description |
---|---|---|
_id | String | Unique identifier for the updated project. |
projectName | String | The updated project name. |
quotaInBytes | Number | The updated usage quota in bytes (or 0 if no quota). |
webhookUrl | String | The configured webhook URL. |
notificationEmails | Array | The list of email addresses that will receive notifications. |
quotaExceededAction | String | The action the system will take when the quota is reached (disable , notify , or none ). |
created | String | Timestamp (ISO 8601) indicating when the project was originally created (unchanged). |
HTTP Status: 200 OK
Example Success Response
{
"_id": "63fdb9f998c1abec0bd3e16c",
"projectName": "MyUpdatedProject",
"quotaInBytes": 2097152,
"webhookUrl": "https://example.com/webhook/turn-updates",
"notificationEmails": ["ops@example.com", "alerts@example.com"],
"quotaExceededAction": "notify",
"created": "2025-01-24T10:15:00.000Z"
}
Error Responses
HTTP Status | Message | Description |
---|---|---|
400 | invalid secretKey app not found | The provided secretKey is invalid; no matching application found. |
400 | Invalid request. Not subscribed to any turn server plan | The application is not subscribed to a TURN server plan. |
400 | projectId is required | The projectId path parameter was missing. |
400 | Invalid projectId | The projectId is not a valid MongoDB ObjectId. |
400 | Project not found | No project matching the specified projectId was found. |
400 | Project name must be a string of less than 100 characters | The projectName is invalid or exceeds the maximum length. |
400 | Invalid quota / Invalid quota - must be 0 or an integer greater than 1MiB... | The quotaInBytes is invalid. |
400 | Webhook URL must be a string or Webhook URL must start with https:// | The webhookUrl is invalid or not HTTPS. |
400 | Notification emails must be an array | notificationEmails was not provided as an array. |
400 | Invalid email address | One or more of the email addresses in notificationEmails is invalid. |
400 | Notification emails must not exceed 10 | Too many emails were provided. |
400 | Invalid quotaExceededAction, it should be one of: disable, notify, none | The specified quotaExceededAction is not recognized. |
Code Examples
cURL
curl -X PUT "https://<appname>.metered.live/api/v2/turn/project/63fdb9f998c1abec0bd3e16c?secretKey=<YOUR_SECRET_KEY>" \
-H "Content-Type: application/json" \
-d '{
"projectName": "MyUpdatedProject",
"quotaInBytes": 2097152,
"webhookUrl": "https://example.com/webhook/turn-updates",
"notificationEmails": ["ops@example.com","alerts@example.com"],
"quotaExceededAction": "notify"
}'
JavaScript (Fetch)
fetch(
`https://<appname>.metered.live/api/v2/turn/project/63fdb9f998c1abec0bd3e16c?secretKey=<YOUR_SECRET_KEY>`,
{
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
projectName: "MyUpdatedProject",
quotaInBytes: 2097152,
webhookUrl: "https://example.com/webhook/turn-updates",
notificationEmails: ["ops@example.com", "alerts@example.com"],
quotaExceededAction: "notify",
}),
}
)
.then((response) => response.json())
.then((data) => console.log("Project Updated:", data))
.catch((error) => console.error("Error:", error));