resource-tokens

Update Resource Token

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)

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

Path parameters

token_idstring required

Public id of the resource token (rtok_ + 22 base62 characters).

Example:rtok_0000000000000000000000

Headers

authorizationstring nullable

Request body

descriptionstring nullable

Updated description

quota_events_per_hourinteger nullable

Updated quota (1-10000)

Response

Successful Response

idunknown required
resource_idunknown required
descriptionunknown
quota_events_per_hourunknown required
created_byunknown
created_atunknown required
last_used_atunknown
is_activeunknown required
statusunknown required

Changes

No recorded changes to this operation across all 2 revisions of this API.