Skip to main content
POST
/
documents
/
passages
/
search
Semantic search for passages
curl --request POST \
  --url https://{cluster}.cognitedata.com/api/v1/projects/{project}/documents/passages/search \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "filter": {
    "and": [
      {
        "prefix": {
          "property": [
            "name"
          ],
          "value": "Report"
        }
      },
      {
        "equals": {
          "property": [
            "type"
          ],
          "value": "PDF"
        }
      }
    ]
  },
  "expansionStrategy": {
    "strategy": "symmetric",
    "chunk_count": 2
  },
  "limit": 10
}
'
{
  "items": [
    {
      "text": "Pump installation\nFollow these 15 steps:\n ...",
      "document": {
        "id": 1234
      },
      "locations": [
        {
          "page_number": 3,
          "left": 68.78,
          "right": 478.56,
          "top": 75.04,
          "bottom": 386.1
        },
        {
          "page_number": 4,
          "left": 68.78,
          "right": 478.56,
          "top": 75.04,
          "bottom": 386.1
        }
      ]
    }
  ]
}

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.

Body

application/json

Fields to be set for the search request.

Narrow down search results. You must specify atleast one filter of type semanticSearch, lexicalSearch or both.

filter
bool filters · object
required

A query that matches items matching boolean combinations of other queries. Currently only supports and clause.

expansionStrategy
object
required

A expansion strategy to to increase the text view for each passage returned. Helpful to increase context for an LLM.

limit
integer<int32>
default:10

Maximum number of items.

Required range: 1 <= x <= 10

Response

List of most relevant document passages for a given query. The results are sorted by relevance, and contains metadata such as page numbers.

items
object[]
required
Last modified on April 23, 2026