---
type: api
title: Create a service annotation
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v8/operation/operation-createannotation
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v8/operation/operation-createannotation
products:
  - Kibana
---

# Create a service annotation

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

## Paths

- `POST` `/api/apm/services/{serviceName}/annotation`
- `POST` `/s/{space_id}/api/apm/services/{serviceName}/annotation`

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

#### Path Parameters

- `serviceName` (string)
  The name of the service

## Description

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

Create a new annotation for a specific service.

## Request Body

`application/json`

- `@timestamp` (string) — required
  Timestamp
- `message` (string) — optional
  Message
- `service` (object) — required
  Service
  - `environment` (string) — optional
  - `version` (string) — required
- `tags` ([] string) — optional
  Tags

## Responses

#### `200`

Annotation created successfully

`application/json`

- `_id` (string)
  Identifier
- `_index` (string)
  Index
- `_source` (object)
  Response
  - `@timestamp` (string)
  - `annotation` (object)
    - `title` (string)
    - `type` (string)
  - `event` (object)
    - `created` (string)
  - `message` (string)
  - `service` (object)
    - `environment` (string)
    - `name` (string)
    - `version` (string)
  - `tags` ([] string)
#### `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/services/{serviceName}/annotation
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/apm/services/{serviceName}/annotation" \
  -H "elastic-api-version: string" \
  -H "kbn-xsrf: true"
```

