Updates the settings of an existing API key. The key value itself never changes: to rotate a key, create a new one and delete the old one. Fields you leave out keep their current value.
Request#
| Path parameter | Type | Description |
|---|---|---|
id |
string | The api_key_id, for example key_0d8e4b1f7a2c96e53b0f1d84. |
| Field | Type | Required | Description |
|---|---|---|---|
name |
string | No | New label, 1 to 80 characters. |
is_webhook_key |
boolean | No | true makes this key sign outgoing webhooks and clears the flag on every other key. false clears it on this key only. |
scopes |
string[] | No | Replaces the scope list. Values: agents, calls, numbers, kb, analytics, admin. [] gives full access. |
allowed_ips |
string[] | No | Replaces the IP allowlist. Up to 50 exact IPv4 or IPv6 addresses. [] allows any IP. |
rate_limit_per_minute |
integer or null | No | 1 to 100000. null goes back to the server default. |
See Create API key for what each scope covers.
Example request#
curl -X PATCH https://api.tried.com.au/api-keys/key_0d8e4b1f7a2c96e53b0f1d84 \
-H "Authorization: Bearer $TRIED_API_KEY" \
-H "Content-Type: application/json" \
-d '{"scopes": ["analytics", "calls"], "rate_limit_per_minute": null}'const res = await fetch(
"https://api.tried.com.au/api-keys/key_0d8e4b1f7a2c96e53b0f1d84",
{
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.TRIED_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ scopes: ["analytics", "calls"], rate_limit_per_minute: null }),
},
);
const key = await res.json();import os, requests
res = requests.patch(
"https://api.tried.com.au/api-keys/key_0d8e4b1f7a2c96e53b0f1d84",
headers={"Authorization": f"Bearer {os.environ['TRIED_API_KEY']}"},
json={"scopes": ["analytics", "calls"], "rate_limit_per_minute": None},
)
key = res.json()Response#
200 OK
Returns the updated key, masked. The plaintext is not returned.
{
"api_key_id": "key_0d8e4b1f7a2c96e53b0f1d84",
"name": "Analytics export",
"masked_key": "key_81c0********7e2a",
"is_webhook_key": false,
"created_timestamp": 1760313600000,
"last_used_timestamp": 1760917800000,
"scopes": ["analytics", "calls"],
"allowed_ips": ["203.0.113.10"],
"rate_limit_per_minute": null
}The update is recorded in the audit log as api_key.update.
Errors#
| Status | When |
|---|---|
400 |
A field fails validation (unknown scope, a value in allowed_ips that is not an IP, rate limit out of range). |
401 |
Missing or invalid API key. |
403 |
The key's IP allowlist or scopes reject the request (this route needs the admin scope), or a dashboard member calls it (Requires role: admin or developer). |
404 |
API key not found in this workspace. |
429 |
Rate limit exceeded. See Rate limits. |
See Errors for the body format.