POST /api/security_ai_assistant/chat/complete

Spaces method and path for this operation:

post /s/{space_id}/api/security_ai_assistant/chat/complete

Refer to Spaces for more information.

Create a model response for the given chat conversation.

Query parameters

  • content_references_disabled boolean

    If true, the response will not include content references.

    Default value is false.

application/json

Body Required

  • connectorId string Required

    Required connector identifier to route the request.

  • conversationId string(nonempty)

    A string that does not contain only whitespace characters.

    Minimum length is 1.

  • 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 array[object] Required

    List of chat messages exchanged so far.

    Hide messages attributes Show messages attributes object

    A message exchanged within the AI chat conversation.

    • content string

      The textual content of the message.

    • data object

      ECS-style metadata attached to the message.

      Additional properties are allowed.

    • fields_to_anonymize array[string]

      List of field names within the data object that should be anonymized.

    • role string Required

      The role associated with the message in the chat.

      Values are system, user, or assistant.

  • 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.

Responses

  • 200 application/octet-stream

    Indicates a successful model response call.

  • 400 application/json

    Bad Request response.

    Hide response attributes Show response attributes object
    • error string

      Error type.

    • message string

      Human-readable error message.

    • statusCode number

      HTTP status code.

POST /api/security_ai_assistant/chat/complete
curl \
 --request POST 'http://localhost:5601/api/security_ai_assistant/chat/complete' \
 --header "Authorization: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '{"connectorId":"conn-001","persist":true,"messages":[{"role":"user","content":"What are common phishing techniques?"}]}'
Request example
{
  "connectorId": "conn-001",
  "conversationId": "abc123",
  "isStream": true,
  "langSmithApiKey": "<LANGSMITH_API_KEY>",
  "langSmithProject": "security_ai_project",
  "messages": [
    {
      "content": "What are some common phishing techniques?",
      "data": {
        "user_id": "user_789"
      },
      "fields_to_anonymize": [
        "user.name",
        "source.ip"
      ],
      "role": "user"
    }
  ],
  "model": "gpt-4",
  "persist": true,
  "promptId": "prompt_456",
  "responseLanguage": "en"
}
Response examples (200)
(streaming binary response)
Response examples (400)
{
  "error": "Bad Request",
  "message": "Invalid request payload.",
  "statusCode": 400
}