---
title: "Rotate Read Token"
method: POST
path: "/v1/projects/{project_id}/read-tokens/{token_id}/rotate/"
tags: ["Projects"]
---

# Rotate Read Token

`POST /v1/projects/{project_id}/read-tokens/{token_id}/rotate/`

## Request

- Base URL: `https://logfire-api.pydantic.dev/api`
- URL: `https://logfire-api.pydantic.dev/api/v1/projects/{project_id}/read-tokens/{token_id}/rotate/`
- Auth: OAuth 2
  - Authorization code: `api/oauth/authorize`
  - Token URL: `/api/oauth/token` scopes: `project:read_token`
- TypeScript: <https://skmtc.dev/pydantic/apis/pydantic-logfire-api/docs/v1/projects/:project_id/read-tokens/:token_id/rotate/post.ts> (a function with typed inputs; its response is checked against the schema)

Rotate a read token: expire the existing token and create a new one.

The old token is immediately expired (expires_at set to now) and a new token is created
in a single atomic operation. Returns the newly created token.

## Path parameters

- `token_id` string, uuid, required
- `project_id` string, uuid, required

## Response `201`

Successful Response

- ReadTokenPublicAPIRead
  - `id` string, uuid, required
  - `project_id` string, uuid, required
  - `created_at` string, date-time, required
  - `description` string, nullable, required
  - `expires_at` string, date-time, nullable, required
  - `token` string, required

## Other responses

- `404`: Project read token not found
- `422`: Validation Error
- `429`: Rate limit exceeded

---

[API](https://skmtc.dev/pydantic/apis/pydantic-logfire-api.md) - [All operations](https://skmtc.dev/pydantic/apis/pydantic-logfire-api/llms.txt) - [OpenAPI document](https://skmtc.dev/pydantic/apis/pydantic-logfire-api/revisions/7996e45256f4?raw)
