---
title: "Create a model response"
method: POST
path: "/api/security_ai_assistant/chat/complete"
tags: ["Security AI Assistant API"]
---

# Create a model response

`POST /api/security_ai_assistant/chat/complete`

**Spaces method and path for this operation:**

<div><span class="operation-verb post">post</span>&nbsp;<span class="operation-path">/s/{space_id}/api/security_ai_assistant/chat/complete</span></div>

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

Create a model response for the given chat conversation.

## Query parameters

- `content_references_disabled` boolean

## Request body

- SecurityAIAssistantAPIChatCompleteProps — The request payload for creating a chat completion.
  - `connectorId` string, required — Required connector identifier to route the request.
  - `conversationId` string, nonempty — A string that does not contain only whitespace characters.
  - `isStream` boolean — If true, the response will be streamed in chunks.
  - `langSmithApiKey` string — API key for LangSmith integration.
  - `langSmithProject` string — LangSmith project name for tracing.
  - `messages` SecurityAIAssistantAPIChatMessage[], required — List of chat messages exchanged so far.
    - `content` string — The textual content of the message.
    - `data` SecurityAIAssistantAPIMessageData — ECS-style metadata attached to the message.
    - `fields_to_anonymize` string[] — List of field names within the data object that should be anonymized.
    - `role` 'system' | 'user' | 'assistant', required — The role associated with the message in the chat.
  - `model` string — Model ID or name to use for the response.
  - `persist` boolean, required — Whether to persist the chat and response to storage.
  - `promptId` string — Prompt template identifier.
  - `responseLanguage` string — ISO language code for the assistant's response.

## Response `200`

Indicates a successful model response call.

## Other responses

- `400` — Bad Request response.

---

[API](https://skmtc.net/elastic/apis/kibana-apis.md) · [All operations](https://skmtc.net/elastic/apis/kibana-apis/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/elastic/kibana-apis/versions/531c9e2a7d23/schema)
