---
title: "Rotate a deployment token, invalidating its old secret and issuing a new one"
method: POST
path: "/projects/{project_id}/deployment-tokens/{token_id}/rotate"
tags: ["Deployment Tokens"]
---

# Rotate a deployment token, invalidating its old secret and issuing a new one

`POST /projects/{project_id}/deployment-tokens/{token_id}/rotate`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/projects/{project_id}/deployment-tokens/{token_id}/rotate`
- Auth: HTTP bearer

## Path parameters

- `project_id` integer, required
- `token_id` integer, required

## Response `200`

Deployment token rotated successfully; the response contains the new plaintext token, shown only once

- CreateDeploymentTokenResponse
  - `created_at` string, date-time, required
  - `deployment_id` integer, nullable
  - `environment_id` integer, nullable
  - `expires_at` string, date-time, nullable
  - `id` integer, required
  - `name` string, required
  - `permissions` string[], nullable
  - `project_id` integer, required
  - `token` string, required: The full token value - only returned on creation
  - `token_prefix` string, required

## Other responses

- `401`: Unauthorized
- `403`: Insufficient permissions
- `404`: Deployment token not found
- `500`: Internal server error

## Changes

- **2026-07-27** `1b060c0a4ba3`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/projects/:project_id/deployment-tokens/:token_id/rotate/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
