Skip to main content

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

ParameterDescriptionData Type
projectIdThe unique ID of the project.String

Query Parameter

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

Body Parameters

ParameterTypeRequiredDescription
projectNameStringNoNew name for your project. Must be fewer than 100 characters.
quotaInBytesNumberNoNew 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).
webhookUrlStringNoAn HTTPS endpoint (must start with https://). If set, the system will send a POST request to this URL when the project quota is reached.
notificationEmailsArrayNoAn array of valid email addresses (max 10). These will receive notifications when usage meets or exceeds the quota (if a quota is set).
quotaExceededActionStringNoThe 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

FieldTypeDescription
_idStringUnique identifier for the updated project.
projectNameStringThe updated project name.
quotaInBytesNumberThe updated usage quota in bytes (or 0 if no quota).
webhookUrlStringThe configured webhook URL.
notificationEmailsArrayThe list of email addresses that will receive notifications.
quotaExceededActionStringThe action the system will take when the quota is reached (disable, notify, or none).
createdStringTimestamp (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 StatusMessageDescription
400invalid secretKey app not foundThe provided secretKey is invalid; no matching application found.
400Invalid request. Not subscribed to any turn server planThe application is not subscribed to a TURN server plan.
400projectId is requiredThe projectId path parameter was missing.
400Invalid projectIdThe projectId is not a valid MongoDB ObjectId.
400Project not foundNo project matching the specified projectId was found.
400Project name must be a string of less than 100 charactersThe projectName is invalid or exceeds the maximum length.
400Invalid quota / Invalid quota - must be 0 or an integer greater than 1MiB...The quotaInBytes is invalid.
400Webhook URL must be a string or Webhook URL must start with https://The webhookUrl is invalid or not HTTPS.
400Notification emails must be an arraynotificationEmails was not provided as an array.
400Invalid email addressOne or more of the email addresses in notificationEmails is invalid.
400Notification emails must not exceed 10Too many emails were provided.
400Invalid quotaExceededAction, it should be one of: disable, notify, noneThe 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));