---
type: api
title: Apply a bulk action to prompts
description: Apply a bulk action to multiple prompts. The bulk action is applied to all prompts that match the filter or to the list of prompts by their IDs. This action allows for bulk create, update, or delete operations.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v0/operation/operation-performpromptsbulkaction
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v0/operation/operation-performpromptsbulkaction
products:
  - Kibana
---

# Apply a bulk action to prompts

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

## Paths

- `POST` `/api/security_ai_assistant/prompts/_bulk_action`

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

## Description

Apply a bulk action to multiple prompts. The bulk action is applied to all prompts that match the filter or to the list of prompts by their IDs. This action allows for bulk create, update, or delete operations.

## Request Body

`application/json`

- `create` ([] object) — optional
  List of prompts to be created.
  - `categories` ([] string) — optional
    List of categories for the prompt.
  - `color` (string) — optional
    The color associated with the prompt.
  - `consumer` (string) — optional
    The consumer associated with the prompt.
  - `content` (string) — required
    The content of the prompt.
  - `isDefault` (boolean) — optional
    Whether this prompt should be the default.
  - `isNewConversationDefault` (boolean) — optional
    Whether this prompt should be the default for new conversations.
  - `name` (string) — required
    The name of the prompt.
  - `promptType` (enum) — required
    Type of the prompt (either system or quick).
    Values: `system`, `quick`
- `delete` (object) — optional
  Criteria for deleting prompts in bulk.
  - `ids` ([] string · min: 1) — optional
    Array of IDs to apply the action to.
  - `query` (string) — optional
    Query to filter the bulk action.
- `update` ([] object) — optional
  List of prompts to be updated.
  - `categories` ([] string) — optional
    The updated categories for the prompt.
  - `color` (string) — optional
    The updated color associated with the prompt.
  - `consumer` (string) — optional
    The updated consumer for the prompt.
  - `content` (string) — optional
    The updated content for the prompt.
  - `id` (string) — required
    The ID of the prompt to update.
  - `isDefault` (boolean) — optional
    Whether this prompt should be the default.
  - `isNewConversationDefault` (boolean) — optional
    Whether the prompt should be the default for new conversations.

## Responses

#### `200`

Indicates a successful call with the results of the bulk action.

`application/json`

- `attributes` (object)
  - `errors` ([] object)
    - `err_code` (string)
      A code representing the error type.
    - `message` (string)
      A message describing the error encountered.
    - `prompts` ([] object)
      List of prompts that encountered errors.
      - `id` (string)
        The ID of the prompt that encountered an error.
      - `name` (string)
        The name of the prompt that encountered an error.
    - `status_code` (integer)
      The HTTP status code associated with the error.
  - `results` ({})
    - `created` ([] object)
      List of prompts that were created.
      - `categories` ([] string)
        Categories associated with the prompt.
      - `color` (string)
        The color associated with the prompt.
      - `consumer` (string)
        The consumer that the prompt is associated with.
      - `content` (string)
        The content of the prompt.
      - `createdAt` (string)
        The timestamp of when the prompt was created.
      - `createdBy` (string)
        The user who created the prompt.
      - `id` (string · min: 1)
        A string that does not contain only whitespace characters.
      - `isDefault` (boolean)
        Whether this prompt is the default.
      - `isNewConversationDefault` (boolean)
        Whether this prompt is the default for new conversations.
      - `name` (string)
        The name of the prompt.
      - `namespace` (string)
        Kibana space where the prompt is located.
      - `promptType` (enum)
        Type of the prompt (either system or quick).
        Values: `system`, `quick`
      - `timestamp` (string · min: 1)
        A string that represents a timestamp in ISO 8601 format and does not contain only whitespace characters.
      - `updatedAt` (string)
        The timestamp of when the prompt was last updated.
      - `updatedBy` (string)
        The user who last updated the prompt.
      - `users` ([] object)
        List of users associated with the prompt.
        - `id` (string)
          User id.
        - `name` (string)
          User name.
    - `deleted` ([] string)
      List of IDs of prompts that were deleted.
    - `skipped` ([] object)
      List of prompts that were skipped.
      - `id` (string)
        The ID of the prompt that was skipped.
      - `name` (string)
        The name of the prompt that was skipped.
      - `skip_reason` (enum)
        Reason why a prompt was skipped during the bulk action.
        Values: `PROMPT_FIELD_NOT_MODIFIED`
    - `updated` ([] object)
      List of prompts that were updated.
      Same fields as `created` in `results`
  - `summary` ({})
    - `failed` (integer)
      The number of failed actions.
    - `skipped` (integer)
      The number of skipped actions.
    - `succeeded` (integer)
      The number of successfully performed actions.
    - `total` (integer)
      The total number of actions attempted.
- `message` (string)
  A message describing the result of the bulk action.
- `prompts_count` (integer)
  The number of prompts processed in the bulk action.
- `status_code` (integer)
  The HTTP status code of the response.
- `success` (boolean)
  Indicates if the bulk action was successful.
#### `400`

Bad Request response.

`application/json`

- `error` (string)
  A short error message.
- `message` (string)
  A detailed error message.
- `statusCode` (number)
  The HTTP status code for the error.
## Code Examples

#### curl

```curl
curl \
 --request POST 'http://localhost:5601/api/security_ai_assistant/prompts/_bulk_action' \
 --header "Authorization: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '{"delete":{"query":"name: test","ids":[]}}'
```

## Request Examples

#### Perform prompts bulk action

```json
{
  "create": [
    {
      "content": "Please verify the security settings.",
      "name": "New Security Prompt",
      "promptType": "system"
    }
  ],
  "delete": {
    "ids": [
      "prompt1",
      "prompt2"
    ]
  },
  "update": [
    {
      "content": "Updated content for security prompt.",
      "id": "prompt123"
    }
  ]
}
```

## Response Examples

#### Success

```json
{
  "attributes": {
    "errors": [],
    "results": {
      "created": [
        {
          "content": "Please verify the security settings.",
          "id": "prompt6",
          "name": "New Security Prompt",
          "promptType": "system"
        }
      ],
      "deleted": [
        "prompt2",
        "prompt3"
      ],
      "skipped": [
        {
          "id": "prompt4",
          "name": "Security Prompt",
          "skip_reason": "PROMPT_FIELD_NOT_MODIFIED"
        }
      ],
      "updated": [
        {
          "content": "Updated security settings prompt",
          "id": "prompt1",
          "name": "Security Prompt",
          "promptType": "system"
        }
      ]
    },
    "summary": {
      "failed": 0,
      "skipped": 1,
      "succeeded": 4,
      "total": 5
    }
  },
  "message": "Bulk action completed successfully.",
  "prompts_count": 5,
  "status_code": 200,
  "success": true
}
```

#### Perform prompts bulk action response400

```json
{
  "error": "Bad Request",
  "message": "Invalid prompt ID or missing required fields.",
  "statusCode": 400
}
```

