---
title: "Update Resource Token"
method: PATCH
path: "/api/v1/resource-tokens/{token_id}"
tags: ["resource-tokens"]
---

# Update Resource Token

`PATCH /api/v1/resource-tokens/{token_id}`

## Request

- Base URL: `https://memory.kagura-ai.com` (the document declares no server; this is the origin it was published from)
- URL: `https://memory.kagura-ai.com/api/v1/resource-tokens/{token_id}`
- Auth: none declared

Update resource token description and/or quota.

Issue #242: Allow updating token metadata without regenerating.
Issue #276: Uses WorkspaceOwner dependency for DRY principle.

The token is the WORKSPACE's to update (#1863): any owner may relabel any
token of the workspace, whoever minted it. It is resolved with the same
predicate the list and the quota ceiling use (#1919,
``auth.resource_tokens.workspace_tokens`` — the ``resources`` row its
``resource_pk`` points at, or its own
``workspace_id`` for a legacy row without one), so a token the ceiling
counts is always addressable; it used to be matched on the shadow
``workspace_id`` column alone and was a 404 when that was never
backfilled. A quota raise is checked against the workspace's ceiling,
``max_resource_tokens * 10000`` events/hour over the workspace's active
non-connector tokens; a lowering is never refused.

Args:
    token_id: Public id of the token (``rtok_...``)
    request: Update request
    owner: Workspace owner (user_id, workspace_id) from dependency
    db: Database session

Returns:
    Updated token metadata

Raises:
    400: The quota raise does not fit the workspace's ceiling
    403: Not workspace owner
    404: Token not found (or not this workspace's — the same answer)

## Path parameters

- `token_id` string, required: Public id of the resource token (`rtok_` + 22 base62 characters).

## Headers

- `authorization` string, nullable

## Request body

- ResourceTokenUpdate: Request model for updating a resource token.
  - `description` string, nullable: Updated description
  - `quota_events_per_hour` integer, nullable: Updated quota (1-10000)

## Response `200`

Successful Response

- ResourceTokenResponse: Response model for resource token metadata (no plaintext).
  - `id` unknown, required
  - `resource_id` unknown, required
  - `description` unknown
  - `quota_events_per_hour` unknown, required
  - `created_by` unknown
  - `created_at` unknown, required
  - `last_used_at` unknown
  - `is_active` unknown, required
  - `status` unknown, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud.md) · [All operations](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/llms.txt) · [OpenAPI document](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/revisions/09f17f5ada29?raw)
