Skip to main content
POST
/
ai
/
agents
/
chat
Start a chat session with an agent
curl --request POST \
  --url https://{cluster}.cognitedata.com/api/v1/projects/{project}/ai/agents/chat \
  --header 'Authorization: Bearer <token>' \
  --header 'content-type: <content-type>' \
  --data '
{
  "messages": [
    {
      "actionId": "<string>",
      "content": {
        "type": "<string>",
        "text": "<string>"
      },
      "role": "<string>",
      "type": "<string>",
      "data": []
    }
  ],
  "actions": [
    {
      "clientTool": {
        "name": "<string>",
        "parameters": {
          "type": "<string>",
          "description": "<string>",
          "properties": {},
          "propertyOrdering": [
            "<string>"
          ],
          "required": [
            "<string>"
          ]
        },
        "description": "<string>"
      },
      "type": "<string>"
    }
  ],
  "agentExternalId": "<string>",
  "agentId": "<string>",
  "cursor": "<string>",
  "stream": false
}
'
{
  "agentExternalId": "<string>",
  "agentId": "<string>",
  "response": {
    "messages": [
      {
        "content": {
          "type": "<string>",
          "text": "<string>"
        },
        "role": "<string>",
        "actions": [
          {
            "actionId": "<string>",
            "clientTool": {
              "name": "<string>",
              "arguments": "<string>"
            },
            "type": "<string>"
          }
        ],
        "data": [
          {
            "instanceId": {
              "externalId": "<string>",
              "space": "<string>"
            },
            "view": {
              "externalId": "<string>",
              "space": "<string>",
              "version": "<string>"
            },
            "properties": {},
            "type": "instance"
          }
        ],
        "reasoning": [
          {
            "content": [
              {
                "type": "<string>",
                "text": "<string>"
              }
            ]
          }
        ]
      }
    ],
    "cursor": "<string>",
    "type": "result"
  }
}

Authorizations

Authorization
string
header
required

Access token issued by the CDF project's configured identity provider. Access token must be an OpenID Connect token, and the project must be configured to accept OpenID Connect tokens. Use a header key of 'Authorization' with a value of 'Bearer $accesstoken'. The token can be obtained through any flow supported by the identity provider.

Headers

content-type
string
required

Body

application/json
messages
(ClientToolCallActionMessage · object | UserConfirmationResponseDTO · object | UserSessionResponseDTO · object | AgentChatMessageUserRequest · object)[]
required

A list of one or multiple input items for the agent, which include various content types used to generate a response.

Required array length: 1 - 1000 elements
actions
CustomClientActionDTO · object[]

Custom tool calls that a client can inject.

Maximum array length: 15
agentExternalId
string

An external ID that uniquely identifies the agent.

Pattern: ^[^\x00]{1,128}$
agentId
string
deprecated

Deprecated: Use AgentExternalId instead. This field uniquely identifies the agent, but is deprecated and will be removed in a future release. If both AgentId and AgentExternalId are provided, AgentExternalId takes precedence.

Pattern: ^[^\x00]{1,128}$
cursor
string

The cursor for continuing a multi-turn conversation. Omit this field to start a new conversation. To continue a conversation, pass the cursor value returned in the previous response. When cursor is provided, you do not need to resend earlier conversation history.

stream
boolean
default:false

Enable progress message streaming.

Response

Successful Response

agentExternalId
string
required

An external ID that uniquely identifies the agent.

Pattern: ^[^\x00]{1,128}$
agentId
string
required
deprecated

Deprecated: Use AgentExternalId instead. This field uniquely identifies the agent, but is deprecated and will be removed in a future release. If both AgentId and AgentExternalId are provided, AgentExternalId takes precedence.

Pattern: ^[^\x00]{1,128}$
response
Response · object
required
Last modified on April 23, 2026