---
type: api
title: Create conversation attachment
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v9/operation/operation-post-agent-builder-conversations-conversation-id-attachments
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v9/operation/operation-post-agent-builder-conversations-conversation-id-attachments
products:
  - Kibana
---

# Create conversation attachment

Availability: Experimental since 9.2

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

## Paths

- `POST` `/api/agent_builder/conversations/{conversation_id}/attachments`
- `POST` `/s/{space_id}/api/agent_builder/conversations/{conversation_id}/attachments`

#### Path parameters

- `conversation_id` (string) — required
  The unique identifier of the conversation.

## Description

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

Create a new attachment for a conversation with version tracking.

## Required authorization

- Privileges: `agentBuilder:read`

## Authentication

- Api key: `Authorization: <value>`
  These APIs use key-based authentication. You must create an API key and use the encoded value in the request header. For example: `Authorization: ApiKey base64AccessApiKey`
- Basic: `Authorization: Basic <credentials>`

## Header parameters

- `kbn-xsrf` (string) — required
  A required header to protect against CSRF attacks

## Request body

`application/json`

- `data` (object) — required
  The attachment data/content. Required unless origin is provided.
- `description` (string) — optional
  Human-readable description of the attachment.
- `hidden` (boolean) — optional
  Whether the attachment should be hidden from the user.
- `id` (string) — optional
  Optional custom ID for the attachment.
- `origin` (string) — optional
  Origin string (for example, saved object ID) for by-reference attachments. When provided without data, the content is resolved once at creation time.
- `type` (string) — required
  The type of the attachment (e.g., text, esql, visualization).

## Response

Indicates a successful response

`application/json`

## Code examples

#### Console

```console
POST kbn:/api/agent_builder/conversations/CONVERSATION_ID/attachments
{
  "data": "Internal system data",
  "description": "System context",
  "hidden": true,
  "type": "text"
}
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/agent_builder/conversations/${CONVERSATION_ID}/attachments" \
  -H "kbn-xsrf: true" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "data": "Internal system data",
    "description": "System context",
    "hidden": true,
    "type": "text"
  }'
```

## Response examples

#### Create attachment response

Example response returning the created attachment

```json
{
  "attachment": {
    "active": true,
    "current_version": 1,
    "description": "Meeting notes",
    "id": "att-abc123",
    "type": "text",
    "versions": [
      {
        "content_hash": "sha256-xyz",
        "created_at": "2025-01-06T10:00:00.000Z",
        "data": "This is the content of my text attachment",
        "estimated_tokens": 12,
        "version": 1
      }
    ]
  }
}
```

