Update API key
curl --request PUT \
--url https://api.example.com/organizations/{organizationId}/api-keys/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Production API Key",
"description": "Used for production server",
"scopes": [
"read:user",
"write:webhooks"
],
"allowedIps": [
"192.168.1.1",
"10.0.0.0/24"
],
"expiresAt": "2025-12-31T23:59:59Z",
"rateLimitPerMinute": 30,
"rateLimitPerHour": 1000
}
'import requests
url = "https://api.example.com/organizations/{organizationId}/api-keys/{id}"
payload = {
"name": "Production API Key",
"description": "Used for production server",
"scopes": ["read:user", "write:webhooks"],
"allowedIps": ["192.168.1.1", "10.0.0.0/24"],
"expiresAt": "2025-12-31T23:59:59Z",
"rateLimitPerMinute": 30,
"rateLimitPerHour": 1000
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Production API Key',
description: 'Used for production server',
scopes: ['read:user', 'write:webhooks'],
allowedIps: ['192.168.1.1', '10.0.0.0/24'],
expiresAt: '2025-12-31T23:59:59Z',
rateLimitPerMinute: 30,
rateLimitPerHour: 1000
})
};
fetch('https://api.example.com/organizations/{organizationId}/api-keys/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/organizations/{organizationId}/api-keys/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Production API Key',
'description' => 'Used for production server',
'scopes' => [
'read:user',
'write:webhooks'
],
'allowedIps' => [
'192.168.1.1',
'10.0.0.0/24'
],
'expiresAt' => '2025-12-31T23:59:59Z',
'rateLimitPerMinute' => 30,
'rateLimitPerHour' => 1000
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/organizations/{organizationId}/api-keys/{id}"
payload := strings.NewReader("{\n \"name\": \"Production API Key\",\n \"description\": \"Used for production server\",\n \"scopes\": [\n \"read:user\",\n \"write:webhooks\"\n ],\n \"allowedIps\": [\n \"192.168.1.1\",\n \"10.0.0.0/24\"\n ],\n \"expiresAt\": \"2025-12-31T23:59:59Z\",\n \"rateLimitPerMinute\": 30,\n \"rateLimitPerHour\": 1000\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.example.com/organizations/{organizationId}/api-keys/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Production API Key\",\n \"description\": \"Used for production server\",\n \"scopes\": [\n \"read:user\",\n \"write:webhooks\"\n ],\n \"allowedIps\": [\n \"192.168.1.1\",\n \"10.0.0.0/24\"\n ],\n \"expiresAt\": \"2025-12-31T23:59:59Z\",\n \"rateLimitPerMinute\": 30,\n \"rateLimitPerHour\": 1000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/organizations/{organizationId}/api-keys/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Production API Key\",\n \"description\": \"Used for production server\",\n \"scopes\": [\n \"read:user\",\n \"write:webhooks\"\n ],\n \"allowedIps\": [\n \"192.168.1.1\",\n \"10.0.0.0/24\"\n ],\n \"expiresAt\": \"2025-12-31T23:59:59Z\",\n \"rateLimitPerMinute\": 30,\n \"rateLimitPerHour\": 1000\n}"
response = http.request(request)
puts response.read_bodyAPI Keys
Update API Key
Update API key settings (name, scopes, rate limits, etc.)
PUT
/
organizations
/
{organizationId}
/
api-keys
/
{id}
Update API key
curl --request PUT \
--url https://api.example.com/organizations/{organizationId}/api-keys/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Production API Key",
"description": "Used for production server",
"scopes": [
"read:user",
"write:webhooks"
],
"allowedIps": [
"192.168.1.1",
"10.0.0.0/24"
],
"expiresAt": "2025-12-31T23:59:59Z",
"rateLimitPerMinute": 30,
"rateLimitPerHour": 1000
}
'import requests
url = "https://api.example.com/organizations/{organizationId}/api-keys/{id}"
payload = {
"name": "Production API Key",
"description": "Used for production server",
"scopes": ["read:user", "write:webhooks"],
"allowedIps": ["192.168.1.1", "10.0.0.0/24"],
"expiresAt": "2025-12-31T23:59:59Z",
"rateLimitPerMinute": 30,
"rateLimitPerHour": 1000
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Production API Key',
description: 'Used for production server',
scopes: ['read:user', 'write:webhooks'],
allowedIps: ['192.168.1.1', '10.0.0.0/24'],
expiresAt: '2025-12-31T23:59:59Z',
rateLimitPerMinute: 30,
rateLimitPerHour: 1000
})
};
fetch('https://api.example.com/organizations/{organizationId}/api-keys/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/organizations/{organizationId}/api-keys/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Production API Key',
'description' => 'Used for production server',
'scopes' => [
'read:user',
'write:webhooks'
],
'allowedIps' => [
'192.168.1.1',
'10.0.0.0/24'
],
'expiresAt' => '2025-12-31T23:59:59Z',
'rateLimitPerMinute' => 30,
'rateLimitPerHour' => 1000
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/organizations/{organizationId}/api-keys/{id}"
payload := strings.NewReader("{\n \"name\": \"Production API Key\",\n \"description\": \"Used for production server\",\n \"scopes\": [\n \"read:user\",\n \"write:webhooks\"\n ],\n \"allowedIps\": [\n \"192.168.1.1\",\n \"10.0.0.0/24\"\n ],\n \"expiresAt\": \"2025-12-31T23:59:59Z\",\n \"rateLimitPerMinute\": 30,\n \"rateLimitPerHour\": 1000\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.example.com/organizations/{organizationId}/api-keys/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Production API Key\",\n \"description\": \"Used for production server\",\n \"scopes\": [\n \"read:user\",\n \"write:webhooks\"\n ],\n \"allowedIps\": [\n \"192.168.1.1\",\n \"10.0.0.0/24\"\n ],\n \"expiresAt\": \"2025-12-31T23:59:59Z\",\n \"rateLimitPerMinute\": 30,\n \"rateLimitPerHour\": 1000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/organizations/{organizationId}/api-keys/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Production API Key\",\n \"description\": \"Used for production server\",\n \"scopes\": [\n \"read:user\",\n \"write:webhooks\"\n ],\n \"allowedIps\": [\n \"192.168.1.1\",\n \"10.0.0.0/24\"\n ],\n \"expiresAt\": \"2025-12-31T23:59:59Z\",\n \"rateLimitPerMinute\": 30,\n \"rateLimitPerHour\": 1000\n}"
response = http.request(request)
puts response.read_bodyUpdates an API key’s settings.
To remove the key’s own limits and use your plan’s limit:
Permissions
User must be owner or admin. Members receive403 Forbidden.
What Can Be Updated
- Name and description
- Scopes (permissions)
- Rate limits (per minute/hour). Send
nullto remove the key’s own limit and use your plan’s limit again - Allowed IP addresses
- Expiration date
environment of a key (sandbox or production) cannot be changed; sending it returns 400 Bad Request. Create a new key in the other environment instead.
Note: The API key value itself cannot be changed. To rotate a key, delete and create a new one.
Example
curl -X PUT https://api.timbrix.mx/organizations/{organizationId}/api-keys/{id} \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated API Key Name",
"scopes": ["read:user", "write:webhooks"]
}'
import { Timbrix } from "@timbrix/sdk"
const client = new Timbrix({ bearerToken: "<token>" })
const apiKey = await client.apiKeys.update("{organizationId}", "{id}", {
name: "Updated API Key Name",
scopes: ["read:user", "write:webhooks"],
})
console.log(apiKey)
curl -X PUT https://api.timbrix.mx/organizations/{organizationId}/api-keys/{id} \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{ "rateLimitPerMinute": null, "rateLimitPerHour": null }'
Security Considerations
- Changing scopes immediately affects API access
- Rate limits are optional and can only lower your plan’s limit for this key. A key without them (or with them set to
null) uses your plan’s limit. See Rate limiting. - Rate limit changes take effect on next request
- IP restrictions are enforced in real-time
Authorizations
Body
application/json
API key scopes (permissions). Defaults to ['read:user'] if not provided
Available options:
read:user, write:user, read:organization, write:organization, read:members, write:members, read:webhooks, write:webhooks, read:api-keys, write:api-keys, read:invoices, write:invoices, read:customers, write:customers, read:products, write:products, read:request-logs, read:audit-logs Example:
["read:user", "write:webhooks"]
Response
API key updated successfully