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

# Create Enrollment Token

`POST /v1/projects/{project_id}/fleet/enrollment-tokens/`

## Request

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

Create a scoped host enrollment key and its profile atomically.

The Supervisor exchanges the key through OpAMP. The profile fixes the policy, environment and host allowance.

## Path parameters

- `project_id` string, uuid, required

## Request body

- EnrollmentTokenCreate
  - `installation_name` string, nullable: Display name for a single host
  - `name` string: Enrollment key label
  - `assignment_id` string, uuid, nullable, required
  - `environment` string, required
  - `expires_in` integer, required: Token lifetime in days
  - `max_installations` integer: How many hosts can enroll with the token (default 1000)

## Response `201`

Successful Response

- EnrollmentTokenRead
  - `profile` ProfileRead, required
    - `installation_name` string, nullable
    - `bridge` OperatorBridgeSettings
      - `name` string
      - `namespaces` string[], required
    - `id` string, uuid, required
    - `project_id` string, uuid, required
    - `name` string, required
    - `kind` 'collector' | 'sdk', required
    - `placement` 'host' | 'kubernetes' | 'application', required
    - `mode` 'managed' | 'monitored', required
    - `environment` string, required
    - `assignment_id` string, uuid, nullable, required
    - `max_installations` integer, required
    - `installation_count` integer, required
    - `created_at` string, date-time, required
  - `credential` CredentialRead, required
    - `id` string, uuid, required
    - `project_id` string, uuid, required
    - `profile_id` string, uuid, required
    - `installation_id` string, uuid, nullable, required
    - `kind` 'bootstrap' | 'runtime', required
    - `name` string, required
    - `token_hint` string, required
    - `expires_at` string, date-time, required
    - `revoked_at` string, date-time, nullable, required
    - `created_at` string, date-time, required
  - `token` string, password, required: A bootstrap credential the Supervisor exchanges through OpAMP

## Other responses

- `404`: Fleet is not enabled, or the policy does not exist
- `422`: The policy is not a Collector policy
- `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)
