﻿---
title: Notes action steps
description: Manage notes on alerts, attacks, and documents from a workflow with the security.createNote, security.getNotes, security.updateNote, and security.deleteNote action steps in Elastic Security.
url: https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/explore-analyze/workflows/steps/notes
products:
  - Elastic Cloud Enterprise
  - Elastic Cloud Hosted
  - Elastic Cloud Serverless
  - Elastic Cloud on Kubernetes
  - Elastic Documentation
  - Elastic Stack
  - Kibana
applies_to:
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Planned
---

# Notes action steps
Notes action steps let workflows create, read, update, and delete [notes](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/solutions/security/investigate/notes) on alerts, [attacks](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/solutions/security/ai/attack-discovery/manage-discoveries-from-attacks-page), and other Elasticsearch documents in Elastic Security. Use these named steps instead of a generic [`kibana.request`](/elastic/docs-content/pull/9663/explore-analyze/workflows/steps/kibana#kibana-request) call to the notes API.
Use notes steps for patterns like:
- Write an AI classification verdict to the alert it analyzed.
- Add the same triage note to every alert a workflow closes.
- Check whether an alert already has a note before writing one.


## Shared conventions

All four notes steps share the same conventions.
**Privileges.** The user whose privileges authorize the run needs the **Notes** feature privilege under **Security** in Kibana: **Read** for `security.getNotes`, and **All** for the other three steps. To find out which user that is, refer to [Whose privileges authorize a run](/elastic/docs-content/pull/9663/explore-analyze/workflows/authorization#workflows-authorization-user).
**All parameters live under `with`.**
**Notes attach to a document by its Elasticsearch `_id`.** `document_id` is the `_id` of an alert, an attack, or any other document, so one step covers every object type. These steps don't create or manage [Timeline](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/solutions/security/investigate/timeline) notes.
**Markdown and length.** The `text` of a note supports Markdown and can be up to 60,000 characters. A document can carry up to 100 notes, so a workflow that creates notes in a loop might reach that limit.
**Chain steps with `note_id`.** Step outputs use `snake_case` field names. Use `steps.<name>.output.note_id` from `security.createNote`, or `foreach.item.note_id` over `security.getNotes` output, in a later update or delete step.
**Parameter names differ between steps.** `security.createNote` and `security.getNotes` take `document_id`. `security.updateNote` takes `note_id`, `document_id`, and `text`. `security.deleteNote` takes `ids`, which accepts one note ID or an array.
**Schema convention.** In each schema table on this page, the `Location` column indicates where each parameter sits in the YAML:
- `top level`: Alongside `type` and `name`, at the top of the step or trigger definition.
- ``with``: Inside the step's `with:` block.
- ``on``: Inside the trigger's `on:` block.


## Step catalog

Jump to any step:
[`security.createNote`](#security-createnote) ·
[`security.getNotes`](#security-getnotes) ·
[`security.updateNote`](#security-updatenote) ·
[`security.deleteNote`](#security-deletenote)
---


### `security.createNote`

Create a note on an alert, attack, or document. The returned `note_id` identifies the note in later update or delete steps.

| Parameter     | Location | Type   | Required | Description                                                                      |
|---------------|----------|--------|----------|----------------------------------------------------------------------------------|
| `text`        | `with`   | string | Yes      | The note text. Supports Markdown. 1 to 60,000 characters.                        |
| `document_id` | `with`   | string | Yes      | The Elasticsearch `_id` of the alert, attack, or document to attach the note to. |

The step returns `{ success: boolean, note_id: string, message: string }`. `note_id` and `message` are present when the step succeeds.
```yaml
- name: create_note
  type: security.createNote
  with:
    text: "{{ steps.generate_summary.output.summary }}"
    document_id: "{{ event.alerts[0]._id }}"
```


### `security.getNotes`

Retrieve every note attached to an alert, attack, or document.

| Parameter     | Location | Type   | Required | Description                                                |
|---------------|----------|--------|----------|------------------------------------------------------------|
| `document_id` | `with`   | string | Yes      | The Elasticsearch `_id` of the alert, attack, or document. |

The step returns `{ success: boolean, total_count: number, notes: array }`. Each entry in `notes` has `note_id`, `text`, `document_id`, `timeline_id`, `created_by`, `created`, `updated_by`, `updated`, and `version`. The `created` and `updated` values are Unix epoch timestamps in milliseconds. Any field might be `null`.
```yaml
- name: get_notes
  type: security.getNotes
  with:
    document_id: "{{ event.alerts[0]._id }}"

- name: print_notes
  type: foreach
  foreach: "${{ steps.get_notes.output.notes }}"
  steps:
    - name: print_note
      type: console
      with:
        message: "Note {{ foreach.item.note_id }}: {{ foreach.item.text }}"
```


### `security.updateNote`

Replace the text of an existing note. The note keeps its document and its Timeline association if it has one. The step fails if the note isn't on the given document.

| Parameter     | Location | Type   | Required | Description                                                                               |
|---------------|----------|--------|----------|-------------------------------------------------------------------------------------------|
| `note_id`     | `with`   | string | Yes      | The ID of the note to update.                                                             |
| `document_id` | `with`   | string | Yes      | The Elasticsearch `_id` of the alert, attack, or document that holds the note.            |
| `text`        | `with`   | string | Yes      | The new note text. Replaces the existing text. Supports Markdown. 1 to 60,000 characters. |

The step returns `{ success: boolean, note_id: string, message: string }`. `note_id` and `message` are present when the step succeeds.
```yaml
- name: update_note
  type: security.updateNote
  with:
    note_id: "{{ steps.create_note.output.note_id }}"
    document_id: "{{ event.alerts[0]._id }}"
    text: "Updated with enrichment findings: {{ steps.enrich.output.summary }}"
```


### `security.deleteNote`

Delete one or more notes by note ID. Unlike the other notes steps, this step doesn't take a `document_id`.

| Parameter | Location | Type                 | Required | Description                           |
|-----------|----------|----------------------|----------|---------------------------------------|
| `ids`     | `with`   | `string \| string[]` | Yes      | One note ID, or an array of note IDs. |

The step returns `{ success: boolean, message: string }`. The message includes the number of deleted notes.
```yaml
- name: list_notes
  type: security.getNotes
  with:
    document_id: "{{ event.alerts[0]._id }}"

- name: delete_notes
  type: security.deleteNote
  with:
    ids: "${{ steps.list_notes.output.notes | map: 'note_id' }}"
```


## Related

- [Security action steps](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/explore-analyze/workflows/steps/security): Overview of the `security.*` step namespace.
- [Alert triage action steps](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/explore-analyze/workflows/steps/alert-triage): Close or tag the alerts you annotate.
- [Investigate notes](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/solutions/security/investigate/notes): Notes in the Elastic Security UI.
- [Alert analysis workflow](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/explore-analyze/workflows/use-cases/security/automate-security-operations/alert-analysis-workflow): An Elastic-managed workflow that writes its verdicts to notes.