---
title: "Upgrade hosts"
method: POST
path: "/api/unstable/fleet/deployments/upgrade"
tags: ["Fleet Automation"]
---

# Upgrade hosts

`POST /api/unstable/fleet/deployments/upgrade`

Create and immediately start a new package upgrade
on hosts matching the specified filter query.

This endpoint allows you to upgrade the Datadog Agent to a specific version
on hosts matching the specified filter query.

The deployment is created and started automatically. The system will:
1. Identify all hosts matching the filter query
2. Validate that the specified version is available
3. Begin rolling out the package upgrade to the target hosts

## Request body

- FleetDeploymentPackageUpgradeCreateRequest — Request payload for creating a new package upgrade deployment.
  - `data` FleetDeploymentPackageUpgradeCreate, required — Data for creating a new package upgrade deployment.
    - `attributes` FleetDeploymentPackageUpgradeAttributes, required — Attributes for creating a new package upgrade deployment.
      - `filter_query` string — Query used to filter and select target hosts for the deployment. Uses the Datadog query syntax.
      - `target_packages` FleetDeploymentPackage[], required — List of packages and their target versions to deploy to the selected hosts.
        - `name` string, required — The name of the package to deploy.
        - `version` string, required — The target version of the package to deploy.
    - `type` 'deployment', required — The type of deployment resource.

## Response `201`

CREATED

- FleetDeploymentResponse — Response containing a single deployment.
  - `data` FleetDeployment — A deployment that defines automated configuration changes for a fleet of hosts.
    - `attributes` FleetDeploymentAttributes, required — Attributes of a deployment in the response.
      - `config_operations` FleetDeploymentOperation[] — Ordered list of configuration file operations to perform on the target hosts.
        - `file_op` 'merge-patch' | 'delete', required — Type of file operation to perform on the target configuration file. - `merge-patch`: Merges the provided patch data with the existing configuration file. Creates the file if it doesn't exist. - `delete`: Removes the specified configuration file from the target hosts.
        - `file_path` string, required — Absolute path to the target configuration file on the host.
        - `patch` object — Patch data in JSON format to apply to the configuration file. When using `merge-patch`, this object is merged with the existing configuration, allowing you to add, update, or override specific fields without replacing the entire file. The structure must match the target configuration file format (for example, YAML structure for Datadog Agent config). Not applicable when using the `delete` operation.
      - `estimated_end_time_unix` integer — Estimated completion time of the deployment as a Unix timestamp (seconds since epoch).
      - `filter_query` string — Query used to filter and select target hosts for the deployment. Uses the Datadog query syntax.
      - `high_level_status` string — Current high-level status of the deployment (for example, "pending", "running", "completed", "failed").
      - `hosts` FleetDeploymentHost[] — Paginated list of hosts in this deployment with their individual statuses. Only included when fetching a single deployment by ID. Use the `limit` and `page` query parameters to navigate through pages. Pagination metadata is included in the response `meta.hosts` field.
        - `error` string — Error message if the deployment failed on this host.
        - `hostname` string — The hostname of the agent.
        - `status` string — Current deployment status for this specific host.
        - `versions` FleetDeploymentHostPackage[] — List of packages and their versions currently installed on this host.
          - `current_version` string — The current version of the package on the host.
          - `initial_version` string — The initial version of the package on the host before the deployment started.
          - `package_name` string — The name of the package.
          - `target_version` string — The target version that the deployment is attempting to install.
      - `packages` FleetDeploymentPackage[] — List of packages to deploy to target hosts. Present only for package upgrade deployments.
        - `name` string, required — The name of the package to deploy.
        - `version` string, required — The target version of the package to deploy.
      - `total_hosts` integer — Total number of hosts targeted by this deployment.
    - `id` string, required — Unique identifier for the deployment.
    - `type` 'deployment', required — The type of deployment resource.
  - `meta` FleetDeploymentResponseMeta — Metadata for a single deployment response, including pagination information for hosts.
    - `hosts` FleetDeploymentHostsPage — Pagination details for the list of hosts in a deployment.
      - `current_page` integer — Current page index (zero-based).
      - `page_size` integer — Number of hosts returned per page.
      - `total_hosts` integer — Total number of hosts in this deployment.
      - `total_pages` integer — Total number of pages available.

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `429` — Too many requests

---

[API](https://skmtc.net/datadog/apis/api-v2.md) · [All operations](https://skmtc.net/datadog/apis/api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/datadog/api-v2/revisions/da68bf029e4c/schema)
