---
title: "Rename a key or change its policy. Session only."
method: PATCH
path: "/v1/keys/{id}"
tags: ["account"]
---

# Rename a key or change its policy. Session only.

`PATCH /v1/keys/{id}`

## Request

- Base URL: `https://api.briq.cloud`
- URL: `https://api.briq.cloud/v1/keys/{id}`
- Auth: HTTP bearer

## Path parameters

- `id` string, required

## Request body

- object
  - `name` string
  - `policy` KeyPolicy
    - `maxConcurrentBriqs` integer
    - `dailySpendCapCents` integer
    - `allowedSizes` string[]
    - `allowedRegistries` string[]
    - `maxSleep` string: The longest sleep this credential may give a briq, "never" included ("never": no bound of its own; the environment and the plan still apply)
    - `expiresAt` string, date-time, nullable

## Response `200`

ok

- object
  - `id` string, required
  - `name` string, required
  - `prefix` string, required
  - `policy` object, required
    - `maxConcurrentBriqs` integer
    - `dailySpendCapCents` integer
    - `allowedSizes` string[]
    - `allowedRegistries` string[]
    - `maxSleep` string: The longest sleep this credential may give a briq, "never" included ("never": no bound of its own; the environment and the plan still apply)
    - `expiresAt` string, date-time, nullable
  - `createdAt` string, required
  - `lastUsedAt` string, nullable, required
  - `revokedAt` string, nullable, required

## Other responses

- `400`: validation
- `401`: unauthorized
- `402`: policy_violation or quota_exceeded (the key's policy), or payment_required (no credits: retrying cannot help)
- `403`: forbidden, or plan_limit (the team's plan does not allow it)
- `404`: not found
- `409`: invalid_state: not possible in the briq's current state; the message says why
- `413`: validation: the body, the command or its output is too large
- `429`: rate limited: retry after the `retry-after` header
- `502`: provider_error: the infrastructure refused the change
- `503`: provider_error: the infrastructure did not answer; retry in a moment

---

[API](https://skmtc.dev/briq/apis/briq-api.md) · [All operations](https://skmtc.dev/briq/apis/briq-api/llms.txt) · [OpenAPI document](https://skmtc.dev/briq/apis/briq-api/revisions/609b424459cb?raw)
