Skip to main content
POST
/
ai
/
tools
/
documents
/
ask
Ask questions about one or more documents.
curl --request POST \
  --url https://{cluster}.cognitedata.com/api/v1/projects/{project}/ai/tools/documents/ask \
  --header 'Authorization: Bearer <token>' \
  --header 'content-type: <content-type>' \
  --data '
{
  "fileIds": [
    {
      "id": 123
    }
  ],
  "question": "<string>",
  "additionalContext": "<string>",
  "ignoreUnknownIds": false,
  "language": "English"
}
'
{
  "content": [
    {
      "text": "<string>",
      "references": [
        {
          "fileId": 123,
          "fileName": "<string>",
          "locations": [
            {
              "bottom": 123,
              "left": 123,
              "pageNumber": 123,
              "right": 123,
              "top": 123
            }
          ],
          "externalId": "<string>",
          "instanceId": {
            "externalId": "<string>",
            "space": "<string>"
          }
        }
      ]
    }
  ]
}

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
fileIds
(DocumentInternalId · object | DocumentExternalId · object | DocumentInstanceId · object)[]
required

A list of file IDs, external IDs, or instance IDs pointing to PDF documents

Required array length: 1 - 100 elements
question
string
required

The question to ask about the documents.

Required string length: 1 - 2048
additionalContext
string

Optional additional context that the model can use to improve its answer

Required string length: 10 - 2048
ignoreUnknownIds
boolean
default:false

If true, the API will not fail if any documents are missing or not fully processed, but generate an answer based on available documents.

language
enum<string>
default:English

The language in which the answer should be provided.

Available options:
Chinese,
Dutch,
English,
French,
German,
Italian,
Japanese,
Korean,
Latvian,
Norwegian,
Portuguese,
Spanish,
Swedish

Response

Successful Response

content
Content · object[]
required

The content of an answer consists of one or more parts. Each part can have a different set of document locations connected to it.

Last modified on April 23, 2026