---
title: "PATCH /api/tokens/{id}"
method: PATCH
path: "/api/tokens/{id}"
tags: ["token"]
---

# PATCH /api/tokens/{id}

`PATCH /api/tokens/{id}`

## Path parameters

- `id` string, uuid, required

## Request body

- UpdateTokenRequest
  - `name` string, nullable — New name
  - `permissions` TokenPermission[], nullable — New permissions
  - `scope` 'all' | 'public' | 'selected'
  - `scopeOrgs` string[], nullable — New UUIDs of the organizations to limit this token to
  - `scopeRepos` string[], nullable — New UUIDs of the repositories to limit this token to

## Response `200`

Token updated

- TokenResponse
  - `creator` string, uuid, nullable — UUID of the user that created this token. Not used for scoping Unset once the creating user has been deleted
  - `expiresAt` string, date-time, nullable — Expiration
  - `id` string, uuid, required — ID
  - `lastUsedAt` string, date-time, nullable — Last used
  - `name` string, required — Name
  - `ownerOrg` string, uuid, nullable — UUID of the organization that owns this token Only set for `token_type` = `organization`
  - `ownerRepo` string, uuid, nullable — UUID of the repository that owns this token. Only set for `token_type` = \[`ci`, `deploy`, `runner?`]
  - `ownerUser` string, uuid, nullable — UUID of the user who owns this token Only set for `token_type` = `personal`
  - `permissions` TokenPermission[], required — Permissions
  - `revokedAt` string, date-time, nullable — Revocation
  - `scope` 'all' | 'public' | 'selected', required
  - `tokenType` 'personal' | 'organization' | 'ci' | 'deploy' | 'runner' | 'instance', required
  - `scopeOrgs` string[], required — UUIDs of the organizations this token is limited to
  - `scopeRepos` string[], required — UUIDs of the repositories this token is limited to

## Other responses

- `400` — Invalid name, scope or permissions
- `401` — Authentication required
- `403` — Insufficient permissions
- `404` — Token not found
- `409` — Token is revoked or a token with this name already exists

## Changes

- **2026-09-20** `dc37a4c478f9` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/mari/apis/gitarena/changes/api/tokens/:id/patch.md)

---

[API](https://skmtc.dev/mari/apis/gitarena.md) · [All operations](https://skmtc.dev/mari/apis/gitarena/llms.txt) · [OpenAPI document](https://skmtc.dev/mari/apis/gitarena/revisions/dc37a4c478f9?raw)
