---
title: "Create Write Token"
method: POST
path: "/v1/projects/{project_id}/write-tokens/"
tags: ["Projects"]
---

# Create Write Token

`POST /v1/projects/{project_id}/write-tokens/`

## Request

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

Creates a write token for a project.

The write token allows you to add data to your project.

## Path parameters

- `project_id` string, uuid, required

## Request body

- CreateWriteTokenInput
  - `expires_at` string, date-time, nullable

## Response `201`

Successful Response

- CreateWriteTokenOutput
  - `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

- `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)
