---
type: api
title: Create an agent binary download source
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-agent-download-sources
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v9/operation/operation-post-fleet-agent-download-sources
products:
  - Kibana
---

# Create an agent binary download source

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

## Paths

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

- [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.

Create a new agent binary download source.<br/><br/>[Required authorization] Route required privileges: fleet-settings-all.

## Request Body

`application/json`

- `auth` (object) — optional — nullable
  - `api_key` (string) — optional
  - `headers` ([] object · max: 100) — optional
    - `key` (string) — required
    - `value` (string) — required
  - `password` (string) — optional
  - `username` (string) — optional
- `host` (string) — required
- `id` (string) — optional
- `is_default` (boolean · default: false) — optional
- `name` (string) — required
- `proxy_id` (string) — optional — nullable
  The ID of the proxy to use for this download source. See the proxies API for more information.
- `secrets` (object) — optional
  - `auth` (object) — optional
    - `api_key` (union anyOf) — optional
      - **{ id }**
        - `id` (string) — required
      - **string**
    - `password` (union anyOf) — optional
      - **{ id }**
        - `id` (string) — required
      - **string**
  - `ssl` (object) — optional
    - `key` (union anyOf) — optional
      - **{ id }**
        - `id` (string) — required
      - **string**
- `ssl` (object) — optional
  - `certificate` (string) — optional
  - `certificate_authorities` ([] string · max: 10) — optional
  - `key` (string) — optional

## Responses

#### `200`

Successful response

`application/json`

- `item` (object)
  - `auth` (object) — nullable
    - `api_key` (string)
    - `headers` ([] object · max: 100)
      - `key` (string)
      - `value` (string)
    - `password` (string)
    - `username` (string)
  - `host` (string)
  - `id` (string)
  - `is_default` (boolean · default: false)
  - `name` (string)
  - `proxy_id` (string) — nullable
    The ID of the proxy to use for this download source. See the proxies API for more information.
  - `secrets` (object)
    - `auth` (object)
      - `api_key` (union anyOf)
        - **{ id }**
          - `id` (string)
        - **string**
      - `password` (union anyOf)
        - **{ id }**
          - `id` (string)
        - **string**
    - `ssl` (object)
      - `key` (union anyOf)
        - **{ id }**
          - `id` (string)
        - **string**
  - `ssl` (object)
    - `certificate` (string)
    - `certificate_authorities` ([] string · max: 10)
    - `key` (string)
#### `400`

Bad Request

`application/json`

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

#### Console

```console
POST /api/fleet/agent_download_sources
{
  "host": "https://my-custom-host.example.com/downloads/",
  "is_default": false,
  "name": "My custom download source"
}
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/fleet/agent_download_sources" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{
  "host": "https://my-custom-host.example.com/downloads/",
  "is_default": false,
  "name": "My custom download source"
}'
```

## Response Examples

#### Post download source

The created agent binary download source

```json
{
  "item": {
    "host": "https://my-custom-host.example.com/downloads/",
    "id": "download-source-id-2",
    "is_default": false,
    "name": "My custom download source"
  }
}
```

#### Generic error response

Example of a generic error response

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

