---
title: "Get environments for service"
method: GET
path: "/api/apm/settings/agent-configuration/environments"
tags: ["APM agent configuration"]
---

# Get environments for service

`GET /api/apm/settings/agent-configuration/environments`

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

<div><span class="operation-verb get">get</span>&nbsp;<span class="operation-path">/s/{space_id}/api/apm/settings/agent-configuration/environments</span></div>

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

Retrieve the available environments for a given service, to be used in agent configuration. You must have `read` privileges for the APM and User Experience feature in Kibana. If `serviceName` is omitted, environments across all services are returned.

## Query parameters

- `serviceName` string

## Headers

- `elastic-api-version` '2023-10-31', required

## Response `200`

Successful response

- APMUIServiceEnvironmentsResponse
  - `environments` APMUIServiceEnvironmentObject[] — Service environment list
    - `alreadyConfigured` boolean — Already configured
    - `name` string — Service environment name

## Other responses

- `400` — Bad Request response
- `401` — Unauthorized response
- `404` — Not found response

---

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