---
title: "Generate a Logstash API key"
method: POST
path: "/api/fleet/logstash_api_keys"
tags: ["Fleet outputs"]
---

# Generate a Logstash API key

`POST /api/fleet/logstash_api_keys`

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

<div><span class="operation-verb post">post</span>&nbsp;<span class="operation-path">/s/{space_id}/api/fleet/logstash_api_keys</span></div>

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

Generate an API key for Logstash to use with a Fleet output.<br/><br/>[Required authorization] Route required privileges: fleet-settings-all.

## Headers

- `kbn-xsrf` string, required

## Response `200`

Successful response

- object
  - `api_key` string, required

## Other responses

- `400` — Bad Request

---

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