POST
/
v1
/
keys.updateRemaining
curl --request POST \
  --url https://api.unkey.dev/v1/keys.updateRemaining \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "keyId": "key_123",
  "op": "increment",
  "value": 1
}'
{
  "remaining": 100
}

Changelog

DateChanges
Dec 06 2023Introduced endpoint

Authorizations

Authorization
string
headerrequired

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
keyId
string
required

The id of the key you want to modify

op
enum<string>
required

The operation you want to perform on the remaining count

Available options:
increment,
decrement,
set
value
integer | null
required

The value you want to set, add or subtract the remaining count by

Response

200 - application/json
remaining
integer | null
required

The number of remaining requests for this key after updating it. null means unlimited.