---
type: api
title: Initiate Fleet setup
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-post-fleet-setup
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-post-fleet-setup
products:
  - Kibana
---

# Initiate Fleet setup

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

## Paths

- `POST` `/api/fleet/setup`
- `POST` `/s/{space_id}/api/fleet/setup`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/kibana/authentication#basicauth)

## Description

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

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.

## Responses

#### `200`

Fleet setup completed

`application/json`

- `isInitialized` (boolean)
- `nonFatalErrors` ([] object · max: 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 /api/fleet/setup
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/fleet/setup" \
  -H "kbn-xsrf: true"
```

## 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
}
```

