# Create enrollment

> `POST https://api.kustom.co/ipp/v1/enrollments`

Creates a new enrollment code that a device can use to register.

## Request body

`application/json`

- `metadata` (object) — Custom metadata key-value pairs for the enrollment.
  - `key` (string) — Any additional property. The key is free-form; the value has this shape.
- `ttl` (string, required) — Duration the enrollment code is valid for. TWO_HOURS produces a short 8-character code; longer durations produce a UUID-format code. Enum: `TWO_HOURS`, `TWENTY_FOUR_HOURS`, `FORTY_EIGHT_HOURS`, `SEVENTY_TWO_HOURS`, `THIRTY_DAYS`.
- `location_id` (string) — Location ID to associate the enrolled device with.

### Example request

```json
{
  "metadata": {
    "store_id": "123",
    "terminal_type": "checkout"
  },
  "ttl": "TWO_HOURS",
  "location_id": "550e8400-e29b-41d4-a716-446655440000"
}
```

## Responses

### 201

Enrollment created.

`application/json`

- `enrollment_id` (string) — Unique enrollment identifier.
- `enrollment_code` (string) — The enrollment code to enter on the device.
- `expires_at` (string) — Timestamp when the enrollment code expires.
- `status` (string) — Current status of the enrollment. Enum: `PENDING`, `CONSUMED`, `EXPIRED`, `CANCELLED`.
- `metadata` (object) — Custom metadata key-value pairs for the enrollment.
  - `key` (string) — Any additional property. The key is free-form; the value has this shape.

```json
{
  "enrollment_id": "550e8400-e29b-41d4-a716-446655440000",
  "enrollment_code": "ABC123XYZ",
  "expires_at": "2024-01-15T11:30:00Z",
  "status": "PENDING",
  "metadata": {
    "store_id": "123",
    "terminal_type": "checkout"
  }
}
```

### 400

Invalid request body.

`application/json`

### 401

Missing or invalid credentials.

`application/json`
