---
title: "Update a developer token's metadata"
method: PATCH
path: "/v1/tokens/{tokenId}"
tags: ["Tokens"]
---

# Update a developer token's metadata

`PATCH /v1/tokens/{tokenId}`

## Request

- Base URL: `http://localhost:9998`
- URL: `http://localhost:9998/v1/tokens/{tokenId}`
- Auth: HTTP bearer

Update label, origin allowlist, and/or `endpointConfigId` binding.
All three fields use absent-vs-null semantics: omit a key to leave
it untouched; set to `null` to clear it. The `endpointConfigId`
binding determines which `EndpointConfig` the Anthropic proxy
routes to when this token authenticates a request — see
`docs/features/anthropic-api-proxy.md` § "Provider Selection".

Validates `endpointConfigId` against `EndpointConfigStore`; an
unknown id surfaces as 404.

## Request body

- DevTokenUpdate: Partial update payload for `PATCH /v1/tokens/{tokenId}`. Each property uses absent-vs-null semantics — omit a key to leave it untouched, set to `null` to clear it.
  - `label` string
  - `origins` string[], nullable
  - `endpointConfigId` string, nullable

## Response `200`

Updated token (masked prefix; raw token never returned)

- DevToken
  - `id` string, required
  - `label` string, required
  - `tokenPrefix` string, required: Masked prefix for display (e.g. `tp_a1b2c3d4...`). The raw token is returned exactly once at creation time and never echoed back; subsequent reads expose only this prefix.
  - `origins` string[], nullable
  - `endpointConfigId` string, nullable: Per-token Anthropic-proxy binding. When set, requests authenticated with this token route to this `EndpointConfig` regardless of the global setting. Takes precedence over the global setting; overridden only by `model: "toolpiper:tp-<id>"` prefix on the request body.
  - `createdAt` string, date-time, required

## Other responses

- `400`: Invalid request
- `404`: Resource not found

---

[API](https://skmtc.dev/modelpiper/apis/toolpiper-api.md) · [All operations](https://skmtc.dev/modelpiper/apis/toolpiper-api/llms.txt) · [OpenAPI document](https://skmtc.dev/modelpiper/apis/toolpiper-api/revisions/6722bf56385c?raw)
