For AI agents: markdown of this page — /docs-content-en/note/documents/search.md documentation index — /llms.txt

Search documents

GET /v1/note/documents/search

Runs a full-text search over the titles and contents of documents from knowledge bases available to the key, as well as documents to which direct access has been granted. Use it to find documents by keywords when the identifier is not known in advance.

The generic filter parameter is not applied by this endpoint. By default, the API preserves the previous HTTP 200 response and data, adds Warning: 299 - "filter is not supported on this endpoint and was ignored", and records unsupported-filter use in the server log. The POST form retains its previous behavior.

Parameters

Parameter Type Required Description
Parameterquery (query) Typestring Requiredyes DescriptionSearch query. Minimum 3 characters, maximum 200
Parameterlimit (query) Typeinteger Requiredno DescriptionNumber of results, from 1 to 200
Parameteroffset (query) Typeinteger Requiredno DescriptionResult offset, from 0 to 10000. Defaults to 0

Next page. If meta.hasMore is true, repeat the same query and limit with the offset increased by the page size: after limit=20&offset=0, request limit=20&offset=20. Search is capped at offset 10000: if hasMore is still true there, another search page is unavailable. Use the document list to traverse all documents.

Examples

curl — personal key

Terminal
curl -G https://vibecode.bitrix24.com/v1/note/documents/search \
  --data-urlencode "query=contract" \
  --data-urlencode "limit=20" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl -G https://vibecode.bitrix24.com/v1/note/documents/search \
  --data-urlencode "query=contract" \
  --data-urlencode "limit=20" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"

JavaScript — personal key

javascript
const params = new URLSearchParams({ query: 'contract', limit: '20' })
const res = await fetch(`https://vibecode.bitrix24.com/v1/note/documents/search?${params}`, {
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
const { data } = await res.json()
console.log('Found:', data)

JavaScript — OAuth application

javascript
const params = new URLSearchParams({ query: 'contract', limit: '20' })
const res = await fetch(`https://vibecode.bitrix24.com/v1/note/documents/search?${params}`, {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})
const { data } = await res.json()

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata Typearray DescriptionArray of found documents
Fielddata[].documentId Typenumber DescriptionDocument identifier. Get the document: GET /v1/note/documents/:id
Fielddata[].collectionId Typenumber DescriptionThe document's knowledge base. List: GET /v1/note/collections
Fielddata[].title Typestring DescriptionDocument title
Fielddata[].score Typenumber DescriptionRelevance score of the match
Fielddata[].snippet Typestring DescriptionDocument fragment with highlighted matches in HTML
Fielddata[].sharedAccess Typeboolean Descriptiontrue if the document is available via direct access rather than knowledge base membership
Fieldmeta.hasMore Typeboolean DescriptionWhether there are more results beyond limit

Response example

JSON
{
  "success": true,
  "data": [
    {
      "documentId": 11,
      "collectionId": 9,
      "title": "Chapter 1",
      "score": 0.0984337329864502,
      "snippet": "<mark>Chapter</mark> 1\nDocument text",
      "sharedAccess": false
    },
    {
      "documentId": 5,
      "collectionId": 7,
      "title": "Chapter 1 (updated)",
      "score": 0.0984337329864502,
      "snippet": "<mark>Chapter</mark> 1\nUpdated text",
      "sharedAccess": false
    }
  ],
  "meta": {
    "hasMore": false
  }
}

Error response example

400 — query shorter than 3 characters:

JSON
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "`query` must be at least 3 characters"
  }
}

Errors

HTTP Code Description
HTTP200 CodeWarning: 299 DescriptionThe filter is ignored by default; previous data is preserved and the warning is sent in the Warning header.
HTTP400 (strict mode only) CodeUNSUPPORTED_FILTER DescriptionThe server mode is disabled by default; until it is enabled, the endpoint preserves HTTP 200 and the previous data.
HTTP400 CodeINVALID_PARAMS Descriptionquery is missing or shorter than 3 characters
HTTP400 CodeINVALID_PARAMS Descriptionlimit is outside the range from 1 to 200
HTTP400 CodeINVALID_PARAMS Descriptionoffset is not an integer from 0 to 10000
HTTP403 CodeSCOPE_DENIED DescriptionThe key lacks the note scope
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no tokens configured

Full list of common API errors — Errors.

Known specifics

The snippet field contains HTML. The fragment arrives with HTML markup — matches are wrapped in <mark>…</mark> tags rather than Markdown. An application that displays snippet in its interface must sanitize this HTML by removing unsafe constructs before rendering it. Otherwise, third-party code could be injected into the page through the document contents (XSS).

POST form of the request. The endpoint also accepts POST /v1/note/documents/search with the same parameters in a JSON body: { "query": "contract", "limit": 20, "offset": 20 }. The response is identical in both forms. The canonical form is GET. If a parameter is passed both in the query string and in the body, the body value takes precedence.

See also