---
type: api
title: Initiate Fleet setup
description: Initialize Fleet and create the necessary Elasticsearch resources for Fleet to operate. Safe to call multiple times (idempotent). Returns the initialization status and any non-fatal errors encountered during setup.<br/><br/>[Required authorization] Route required privileges: fleet-agents-read OR fleet-agent-policies-read OR fleet-settings-read OR fleet-setup.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v0/operation/operation-post-fleet-setup
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v0/operation/operation-post-fleet-setup
products:
  - Kibana
---

# Initiate Fleet setup

- Server: `https://{kibana_url}`

## Paths

- `POST` `/api/fleet/setup`

## Description

Initialize Fleet and create the necessary Elasticsearch resources for Fleet to operate. Safe to call multiple times (idempotent). Returns the initialization status and any non-fatal errors encountered during setup.

## Required authorization

- Privileges: `fleet-agents-read` or `fleet-agent-policies-read` or `fleet-settings-read` or `fleet-setup`

## Authentication

- Api key: `Authorization: <value>`
  These APIs use key-based authentication. You must create an API key and use the encoded value in the request header. For example: `Authorization: ApiKey base64AccessApiKey`
- Basic: `Authorization: Basic <credentials>`

## Header parameters

- `kbn-xsrf` (string) — required
  A required header to protect against CSRF attacks

## Responses

#### `200`

Fleet setup completed

`application/json`

- `isInitialized` (boolean)
- `nonFatalErrors` (object[] · max items: 10000)
  - `message` (string)
  - `name` (string)
#### `400`

Bad Request

`application/json`

- `attributes` (object)
- `error` (string)
- `errorType` (string)
- `message` (string)
- `statusCode` (number)
#### `500`

Internal Server Error

`application/json`

- `message` (string)
## Code examples

#### Console

```console
POST kbn:/api/fleet/setup
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/fleet/setup" \
  -H "kbn-xsrf: true" \
  -H "Authorization: ApiKey ${API_KEY}"
```

## Response examples

#### Fleet setup success

Fleet initialized successfully with no non-fatal errors

```json
{
  "isInitialized": true,
  "nonFatalErrors": []
}
```

#### Fleet setup with non fatal errors

Fleet initialized but encountered non-fatal errors during setup

```json
{
  "isInitialized": true,
  "nonFatalErrors": [
    {
      "message": "Package fleet_server not found in registry",
      "name": "PackageNotFoundError"
    }
  ]
}
```

#### Generic error response

Example of a generic error response

```json
{
  "error": "Bad Request",
  "message": "An error message describing what went wrong",
  "statusCode": 400
}
```

#### Internal error response

Example of an internal server error response

```json
{
  "error": "Internal Server Error",
  "message": "An error message describing what went wrong",
  "statusCode": 500
}
```

