---
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/v9/operation/operation-post-fleet-agents-setup
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v9/operation/operation-post-fleet-agents-setup
products:
  - Kibana
---

# Initiate Fleet setup

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

## Paths

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

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

## Description

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

Initialize Fleet. This endpoint is used by Elastic Agents to trigger Fleet setup. Safe to call multiple times; subsequent calls are idempotent.<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)
## Code Examples

#### Console

```console
POST /api/fleet/agents/setup
```

#### curl

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

## Response Examples

#### Agents setup success

Fleet setup initialized successfully with no non-fatal errors

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

#### Generic error response

Example of a generic error response

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

