---
title: "Create an index"
---

> Documentation Index
> Fetch the complete documentation index at: https://sandrinodm.github.io/logbrook/llms.txt
> Use this file to discover all available pages before exploring further.

# Create an index

Path: Logbrook API › Indexes

`PUT /indexes/{index}`

Creates the index with the configured policy, or returns it if it already exists. Requires an admin token, or an ingestion token scoped to the index. `max_indexes` caps how many can exist.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `index` (`createIndex.path.index`; string, required) — Index name: lowercase letters, digits, underscores and hyphens. The token's index scope applies as well as its source scope.
  - minLength 1; maxLength 63; pattern `^[a-z0-9][a-z0-9_-]*$`

## Code samples

### cURL

```bash
curl --request PUT \
  --url '<base-url>/indexes/payments' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = '<base-url>/indexes/payments';
const options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/indexes/payments"

headers = {"Authorization": "Bearer <token>"}

response = requests.put(url, headers=headers)

print(response.text)
```

## Responses

### 200

Index exists

#### Example

```json
{
  "name": "payments"
}
```

- `name` (`createIndex.response.200.name`; string, required)

### 401

Ingestion or admin token required

### 403

Index outside token scope

### 429

Capacity exhausted


Source: https://sandrinodm.github.io/logbrook/api/indexes/create/index.md
