---
type: api
title: Update an agent binary download source
description: Update an agent binary download source by ID.<br/><br/>[Required authorization] Route required privileges: fleet-settings-all.
url: https://www.elastic.co/elastic/docs-builder/docs/4843/api/doc/kibana/v9/operation/operation-put-fleet-agent-download-sources-sourceid
resource: https://www.elastic.co/elastic/docs-builder/docs/4843/api/doc/kibana/v9/operation/operation-put-fleet-agent-download-sources-sourceid
products:
  - Kibana
---

# Update an agent binary download source

Authentication: required

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

## Paths

- `PUT` `/api/fleet/agent_download_sources/{sourceId}`
- `PUT` `/s/{space_id}/api/fleet/agent_download_sources/{sourceId}`

#### Path parameters

- `space_id` (string) — optional
  An identifier for the space. If `space_id` is not provided in the URL, the default space is used. Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.
- `sourceId` (string) — required
  The ID of the download source

## Description

Update an agent binary download source by ID.

## Required privileges

- Privileges: `fleet-settings-all`

## Header parameters

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

## Request body

`application/json`

- `auth` (object) — optional — nullable
  - `api_key` (string) — optional
  - `headers` (object[] · max items: 100) — optional
    - `key` (string) — required
    - `value` (string) — required
  - `password` (string) — optional
  - `username` (string) — optional
- `host` (string · format: uri) — 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.
- `reserve_diskspace` (boolean) — optional
  If `true`, Elastic Agent reserves disk space equal to the size of the new agent package before an upgrade, so the upgrade fails early if there is not enough space. If not set, defaults to `true` on the agent side.
- `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 items: 10) — optional
  - `key` (string) — optional

## Responses

#### `200`

Successful response

`application/json`

- `item` (object)
  - `auth` (object) — nullable
    - `api_key` (string)
    - `headers` (object[] · max items: 100)
      - `key` (string)
      - `value` (string)
    - `password` (string)
    - `username` (string)
  - `host` (string · format: uri)
  - `id` (string)
  - `is_default` (boolean · default: false)
  - `is_preconfigured` (boolean)
  - `name` (string)
  - `proxy_id` (string) — nullable
    The ID of the proxy to use for this download source. See the proxies API for more information.
  - `reserve_diskspace` (boolean)
    If `true`, Elastic Agent reserves disk space equal to the size of the new agent package before an upgrade, so the upgrade fails early if there is not enough space. If not set, defaults to `true` on the agent side.
  - `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 items: 10)
    - `key` (string)
#### `400`

Bad Request

`application/json`

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

Not Found

`application/json`

## Code examples

#### Console

```console
PUT kbn:/api/fleet/agent_download_sources/SOURCE_ID
{
  "host": "https://updated-host.example.com/downloads/",
  "is_default": false,
  "name": "Updated download source"
}
```

#### curl

```curl
curl -X PUT "${KIBANA_URL}/api/fleet/agent_download_sources/${SOURCE_ID}" \
  -H "kbn-xsrf: true" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "host": "https://updated-host.example.com/downloads/",
    "is_default": false,
    "name": "Updated download source"
  }'
```

## Response examples

#### Put download source

`application/json`

The updated agent binary download source

```json
{
  "item": {
    "host": "https://updated-host.example.com/downloads/",
    "id": "download-source-id-1",
    "is_default": false,
    "name": "Updated download source"
  }
}
```

#### Generic error response

`application/json`

Example of a generic error response

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

#### Not found

`application/json`

No download source was found with the given ID

```json
{
  "error": "Not Found",
  "message": "Download source download-source-id-1 not found",
  "statusCode": 404
}
```

