---
type: api
title: Save APM server schema
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana-serverless/operation/operation-saveapmserverschema
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana-serverless/operation/operation-saveapmserverschema
products:
  - Kibana
---

# Save APM server schema

deprecated

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

## Paths

- `POST` `/api/apm/fleet/apm_server_schema`
- `POST` `/s/{space_id}/api/apm/fleet/apm_server_schema`

- [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 Fleet integrations to push the APM Server configuration schema. Do not use for new integrations. It stores the provided schema object as a Kibana saved object. If Fleet migration is not available on the current deployment, the API returns a 404.

## Request Body

`application/json`

- `schema` (object) — optional
  Schema object

## Responses

#### `200`

Successful response

`application/json`

Type: `object`

#### `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
#### `403`

Forbidden 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/fleet/apm_server_schema
{
  "schema": {
    "foo": "bar"
  }
}
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/apm/fleet/apm_server_schema" \
  -H "elastic-api-version: string" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{
  "schema": {
    "foo": "bar"
  }
}'
```

## Response Examples

#### Save apm server schema response example1

An example of a successful response from `POST /api/apm/fleet/apm_server_schema`. The response body is intentionally empty.

```json
{}
```

#### 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
}
```

#### Forbidden

An example of a 403 Forbidden response, returned when the authenticated user lacks the required APM and User Experience privileges.

```json
{
  "error": "Forbidden",
  "message": "Insufficient privileges to perform this action. The APM and User Experience feature requires \u0060all\u0060 privileges.",
  "statusCode": 403
}
```

#### 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
}
```

