---
type: api
title: Lookup single agent configuration
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana-serverless/operation/operation-searchsingleconfiguration
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana-serverless/operation/operation-searchsingleconfiguration
products:
  - Kibana
---

# Lookup single agent configuration

deprecated

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

## Paths

- `POST` `/api/apm/settings/agent-configuration/search`
- `POST` `/s/{space_id}/api/apm/settings/agent-configuration/search`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana-serverless/authentication#apikeyauth)

## Description

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

DEPRECATED: This endpoint is intended for internal use by APM agents to fetch their configuration and mark it as applied. Do not use for new integrations. It searches for a single agent configuration matching the given service, and optionally updates the `applied_by_agent` field when the provided `etag` matches the current configuration.

## Request Body

`application/json`

- `error` (string) — optional
  If provided, the agent configuration will be marked as error and `applied_by_agent` will be set to `false`.
This is useful for cases where the agent configuration was not applied successfully.
- `etag` (string) — optional
  If etags match then `applied_by_agent` field will be set to `true`
- `mark_as_applied_by_agent` (boolean) — optional
  `markAsAppliedByAgent=true` means "force setting it to true regardless of etag".
This is needed for Jaeger agent that doesn't have etags
- `service` ({}) — required
  Service
  - `environment` (string) — optional
    The environment of the service.
  - `name` (string) — optional
    The name of the service.

## Responses

#### `200`

Successful response

`application/json`

- `_id` (string)
  Identifier
- `_index` (string)
  Index
- `_score` (number)
  Score
- `_source` ({})
  Agent configuration
  - `@timestamp` (number)
    Timestamp
  - `agent_name` (string)
    Agent name
  - `applied_by_agent` (boolean)
    Applied by agent
  - `etag` (string)
    `etag` is sent by the APM agent to indicate the `etag` of the last successfully applied configuration. If the `etag` matches an existing configuration its `applied_by_agent` property will be set to `true`. Every time a configuration is edited `applied_by_agent` is reset to `false`.
  - `service` ({})
    Service
    - `environment` (string)
      The environment of the service.
    - `name` (string)
      The name of the service.
  - `settings` (object)
    Agent configuration settings
#### `400`

Bad Request response

`application/json`

- `error` (string)
  Error type
- `message` (string)
  Error message
- `statusCode` (number)
  Error status code
#### `401`

Unauthorized response

`application/json`

- `error` (string)
  Error type
- `message` (string)
  Error message
- `statusCode` (number)
  Error status code
#### `404`

Not found response

`application/json`

- `error` (string)
  Error type
- `message` (string)
  Error message
- `statusCode` (number)
  Error status code
## Code Examples

#### Console

```console
POST /api/apm/settings/agent-configuration/search
{
  "etag": "1e58c178efeebae15c25c539da740d21dee422fc",
  "service": {
    "environment": "production",
    "name": "frontend"
  }
}
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/apm/settings/agent-configuration/search" \
  -H "elastic-api-version: string" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{
  "etag": "1e58c178efeebae15c25c539da740d21dee422fc",
  "service": {
    "environment": "production",
    "name": "frontend"
  }
}'
```

## Response Examples

#### Search single configuration response1

An example of a successful response from `POST /api/apm/settings/agent-configuration/search`.

```json
{
  "_id": "CIaqXXABmQCdPphWj8EJ",
  "_index": ".apm-agent-configuration",
  "_score": 2,
  "_source": {
    "@timestamp": 1582031336265,
    "agent_name": "nodejs",
    "applied_by_agent": false,
    "etag": "5080ed25785b7b19f32713681e79f46996801a5b",
    "service": {
      "name": "frontend"
    },
    "settings": {
      "transaction_sample_rate": "1"
    }
  }
}
```

#### Bad request

An example of a 400 Bad Request response, returned when the request payload or query parameters fail validation.

```json
{
  "error": "Bad Request",
  "message": "[request body]: expected value of type [string] but got [undefined]",
  "statusCode": 400
}
```

#### Unauthorized

An example of a 401 Unauthorized response, returned when the request is missing valid authentication credentials.

```json
{
  "error": "Unauthorized",
  "message": "[security_exception]: missing authentication credentials for REST request",
  "statusCode": 401
}
```

#### Not found

An example of a 404 Not Found response, returned when the requested resource does not exist or the feature is not available on the current deployment.

```json
{
  "error": "Not Found",
  "message": "Not Found",
  "statusCode": 404
}
```

