---
title: "Create a new deployment token for a project"
method: POST
path: "/projects/{project_id}/deployment-tokens"
tags: ["Deployment Tokens"]
---

# Create a new deployment token for a project

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

## 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`
- Auth: HTTP bearer

## Path parameters

- `project_id` integer, required

## Request body

- CreateDeploymentTokenRequest
  - `deployment_id` integer, nullable: Optional deployment ID - if set, token is scoped to a specific deployment
  - `environment_id` integer, nullable: Optional environment ID - if not set, token applies to all environments
  - `expires_at` string, date-time, nullable
  - `name` string, required
  - `permissions` string[], nullable: List of permissions (e.g., ["visitors:enrich", "emails:send"]) If not provided, defaults to full access

## Response `201`

Deployment token created successfully

- 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

- `400`: Invalid request
- `401`: Unauthorized
- `403`: Insufficient permissions
- `409`: Token with this name already exists
- `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/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)
