Method
keys.update
Rename a key or change where it works.
Details
- Endpoint
- PUT /v0/keys/:id
- Credits
- Free
- Rate class
- Light. Counts against your light requests per second.
Changes the name, allowed origins or allowed IPs of one of your keys. Fields you leave out stay as they are. Rules apply within 30 seconds.
Parameters
| Name | Type | Description |
|---|---|---|
| idrequired | string | Key id from GET /v0/keys. |
| name | string | |
| allowedOrigins | array of string | |
| allowedIps | array of string |
Request
Send your key in the x-api-key header, or leave it out to use the keyless tier.
curl
curl -X PUT "https://api.tide.ad/v0/keys/kid_abc123" \
-H "x-api-key: YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"allowedIps": [
"203.0.113.0/24"
]
}'TypeScript
const res = await fetch("https://api.tide.ad/v0/keys/kid_abc123", {
method: "PUT",
headers: {
"x-api-key": process.env.TIDE_API_KEY!,
"content-type": "application/json",
},
body: JSON.stringify({
"allowedIps": [
"203.0.113.0/24"
]
}),
});
const data = await res.json();Response
JSON
{
"updated": true
}