---
title: "Create Host Enrollment"
method: POST
path: "/v1/projects/{project_id}/fleet/host-enrollments/"
tags: ["Projects"]
---

# Create Host Enrollment

`POST /v1/projects/{project_id}/fleet/host-enrollments/`

## Request

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

Enroll one managed Collector host and return its runtime credential and OpAMP URL.

Policies that reference `LOGFIRE_TOKEN` also receive a dedicated ingest credential.
Those policies require `project:write_token` in addition to the Fleet enrollment scope.

## Path parameters

- `project_id` string, uuid, required

## Request body

- HostEnrollmentCreate
  - `assignment_id` string, uuid, required
  - `name` string, required
  - `environment` string, required
  - `registration_key` string, uuid, required

## Response `201`

Successful Response

- HostEnrollmentRead
  - `telemetry_token` string, password: Installation-owned Logfire ingest credential. Present only when issued with this runtime credential.
  - `installation` InstallationRead, required
    - `bridge` OperatorBridgeSettings
      - `name` string
      - `namespaces` string[], required
    - `id` string, uuid, required
    - `project_id` string, uuid, required
    - `profile_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
    - `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
  - `opamp_url` string, required
  - `credential_delivery` 'issued' | 'replaced', required: `replaced` on a retry: every earlier credential of the installation is now revoked

## Other responses

- `404`: Fleet is not enabled, or the policy does not exist
- `409`: The registration key was used with a different request
- `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)
