Skip to main content
POST
/
documents
/
search
JavaScript SDK
const documents = await client.documents.search({
  search: {
    query: 'Stuck pipe'
  },
  filter: {
    in: {
      property: ['type'],
      values: ['Document', 'PDF']
    }
  },
  limit: 5
});
{
  "items": [
    {
      "item": {
        "id": 2384,
        "createdTime": 1519862400000,
        "sourceFile": {
          "name": "hamlet.txt",
          "directory": "plays/shakespeare",
          "source": "SubsurfaceConnectors",
          "mimeType": "application/octet-stream",
          "size": 1000,
          "hash": "23203f9264161714cdb8d2f474b9b641e6a735f8cea4098c40a3cab8743bd749",
          "assetIds": [],
          "labels": [
            {
              "externalId": "play"
            },
            {
              "externalId": "tragedy"
            }
          ],
          "geoLocation": {
            "type": "Point",
            "coordinates": [
              10.74609,
              59.91273
            ]
          },
          "datasetId": 4503599627370496,
          "securityCategories": [],
          "metadata": {}
        },
        "externalId": "haml001",
        "instanceId": {
          "space": "<string>",
          "externalId": "<string>"
        },
        "title": "Hamlet",
        "author": "William Shakespeare",
        "producer": "<string>",
        "modifiedTime": 1519958703000,
        "lastIndexedTime": 1521062805000,
        "mimeType": "text/plain",
        "extension": "pdf",
        "pageCount": 2,
        "type": "Document",
        "language": "en",
        "truncatedContent": "ACT I\nSCENE I. Elsinore. A platform before the castle.\n  FRANCISCO at his post. Enter to him BERNARDO\nBERNARDO\n  Who's there?\n",
        "assetIds": [
          42,
          101
        ],
        "labels": [
          {
            "externalId": "my.known.id"
          }
        ],
        "geoLocation": {
          "type": "Point",
          "coordinates": [
            10.74609,
            59.91273
          ]
        }
      },
      "highlight": {
        "name": [
          "amet elit <em>non diam</em> aliquam suscipit"
        ],
        "content": [
          "Nunc <em>vulputate erat</em> ipsum, at aliquet ligula vestibulum at",
          "<em>Quisque</em> lectus ex, fringilla aliquet <em>eleifend</em> nec, laoreet a velit.\n\nPhasellus <em>faucibus</em> risus arcu"
        ]
      }
    }
  ],
  "nextCursor": "<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.

Body

application/json

Fields to be set for the search request.

Filter with exact match

filter
and · object

A query that matches items matching boolean combinations of other queries. It is built using one or more boolean clauses, which can be of types: and, or or not

sort
object[]

List of properties to sort by. Currently only supports 1 property.

Required array length: 1 element
limit
integer<int32>
default:100

Maximum number of items. When using highlights the maximum value is reduced to 20.

Required range: 0 <= x <= 1000
cursor
string

Cursor for paging through results.

highlight
boolean

Whether or not matches in search results should be highlighted.

Response

The results of a search.

items
object[]
required
nextCursor
string

The cursor to get the next page of results (if available). The search endpoint only gives a limited number of results. A missing nextCursor does not imply there are no more results for the provided search.

Last modified on April 23, 2026