---
title: "Download an agent policy"
method: GET
path: "/api/fleet/agent_policies/{agentPolicyId}/download"
tags: ["Elastic Agent policies"]
---

# Download an agent policy

`GET /api/fleet/agent_policies/{agentPolicyId}/download`

**Spaces method and path for this operation:**

<div><span class="operation-verb get">get</span>&nbsp;<span class="operation-path">/s/{space_id}/api/fleet/agent_policies/{agentPolicyId}/download</span></div>

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

Download an agent policy by ID.<br/><br/>[Required authorization] Route required privileges: fleet-agent-policies-read OR fleet-setup.

## Path parameters

- `agentPolicyId` string, required

## Query parameters

- `download` boolean
- `standalone` boolean
- `kubernetes` boolean
- `revision` number

## Response `200`

Successful response — returns the agent policy as a YAML file download

- string

## Other responses

- `400` — Bad Request
- `404` — Not Found

---

[API](https://skmtc.net/elastic/apis/kibana-apis.md) · [All operations](https://skmtc.net/elastic/apis/kibana-apis/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/elastic/kibana-apis/versions/531c9e2a7d23/schema)
