---
title: "Create an enrollment token placing collectors in a fleet"
method: POST
path: "/api/{org_id}/fleet/tokens"
tags: ["Fleet"]
---

# Create an enrollment token placing collectors in a fleet

`POST /api/{org_id}/fleet/tokens`

## Request

- Base URL: `https://api.openobserve.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.openobserve.ai/api/{org_id}/fleet/tokens`
- Auth: API key in header `Authorization`
- TypeScript: <https://skmtc.dev/openobserve/apis/openobserve-api-http/docs/api/:org_id/fleet/tokens/post.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `org_id` string, required

## Request body

- CreateTokenRequest: Unknown fields are refused, so a client never believes an option took effect.
  - `expires_in_days` integer, nullable
  - `fleet` string: The fleet a collector enrolling with this token joins.
  - `max_uses` integer, nullable
  - `name` string, required

## Response `201`

Created

- CreatedToken
  - `created_at` integer, required: Epoch milliseconds.
  - `expires_at` integer, nullable: Epoch milliseconds; null never expires.
  - `fleet` CollectorFleet, required: A fleet named by its public id; `name` is null once the fleet was deleted.
    - `id` string, required
    - `name` string, nullable
  - `id` string, required
  - `max_uses` integer, nullable
  - `name` string, required
  - `prefix` string, required: The first 9 characters, shown while the value stays masked.
  - `revoked` boolean, required
  - `token` string, nullable: Only for callers who may change the fleet; tokens predating stored values have none.
  - `uses` integer, required

## Other responses

- `400`: Invalid
- `403`: Forbidden
- `404`: Fleet not found
- `409`: Name exists

---

[API](https://skmtc.dev/openobserve/apis/openobserve-api-http.md) - [All operations](https://skmtc.dev/openobserve/apis/openobserve-api-http/llms.txt) - [OpenAPI document](https://skmtc.dev/openobserve/apis/openobserve-api-http/revisions/0529b8a10252?raw)
