const { result, error } =await unkey.keys.updateRemaining({
  keyId: "xyz_AS5HDkXXPot2MMoPHD8jnL",
  value: 300,
  op: "set"
});

if (error) {
  // handle potential network or bad request error
  // a link to our docs will be in the `error.docs` field
  console.error(error.message);
  return;
}
console.log(result)
{
  "result": {
    "remaining": 300
  }
}
const { result, error } =await unkey.keys.updateRemaining({
  keyId: "xyz_AS5HDkXXPot2MMoPHD8jnL",
  value: 300,
  op: "set"
});

if (error) {
  // handle potential network or bad request error
  // a link to our docs will be in the `error.docs` field
  console.error(error.message);
  return;
}
console.log(result)
{
  "result": {
    "remaining": 300
  }
}

Request

keyId
string
required
The ID of the key you want to update.
op
string
required
Name of the operation to perform. The options are increment, decrement and set.
value
integer
required
The number to increment, decrement or set the remaining usage of a key.

Response

result