Filtered queries and folder browsing without text; keyword, semantic and hybrid search with it.
const url = 'https://api.contentsurface.io/v1/search';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"text":"invoices March","mode":null,"folders":["nod_01j9n4wqr0e008000000000001"],"includeDescendants":null,"filters":{"type":["File"],"modifiedAt":{"gte":"2026-01-01T00:00:00Z"},"attributes":{"department":"Finance"}},"sort":null,"page":null,"top":10,"passages":1,"include":{"relations":{"definitions":["invoiceContacts"],"sample":1}}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.contentsurface.io/v1/search \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "text": "invoices March", "mode": null, "folders": [ "nod_01j9n4wqr0e008000000000001" ], "includeDescendants": null, "filters": { "type": [ "File" ], "modifiedAt": { "gte": "2026-01-01T00:00:00Z" }, "attributes": { "department": "Finance" } }, "sort": null, "page": null, "top": 10, "passages": 1, "include": { "relations": { "definitions": [ "invoiceContacts" ], "sample": 1 } } }'One endpoint for finding nodes, trimmed to what the caller may read.
- Without
text(query mode):filtersalone select nodes, ordered bysort, or folders first and then by name; cursor-paged. WithincludeDescendants: falseand exactly one folder infolders, it browses: the folder’s direct children. - Withtext: hybrid search (default), ormode: keywordormode: semantic. Every word must occur somewhere in the node — its name, attributes or text; quoted phrases,ORand-wordwork. Keyword mode is cursor-paged; hybrid and semantic return the besttop(default 20, at most 50) and ignorepage.passagesadds the matched text to the first 10 hits. - In every mode,include.relationsadds a short summary of each of the first 10 hits’ relations: per relation definition and side, how many related nodes the caller can read (at most 100,countCappedbeyond) and the first few by ID. It is read after the results are chosen and never changes them; the full list is onGET /v1/nodes/{id}/relations/{definitionId}.
filters narrows the result strictly in every mode. It holds standard fields (name, type, isFolder, isContent, mimeType, size, createdAt, modifiedAt), attributes keyed by attribute key, and related: the nodes related to an anchor node, optionally through one relation definition. A condition is a value (equals), a list (any of), a range (gte, gt, lte, lt), { "startsWith": … } (ignoring case) or, on text-list attributes, { "all": [ … ] }. Conditions combine with AND; OR exists only within one field’s list. At most 20 conditions and 100 values per list. indexedAt, indexState, indexCoverage and semanticCoverage are for repository admins only. GET /v1/attributes lists the attribute keys and whether each is filterable or sortable.
Access can be granted on a folder deep in the tree without its parents, so a readable node may sit below folders the caller cannot read. Browsing from root does not reach it; onlyEntryPoints: true in filters lists such entry points — nodes the caller can read whose parent they cannot — and combines with text, every other filter, sorting and paging (false is the same as leaving it out; a repository admin reading all content has none). In each path, every run of folders the caller cannot read shows as one … (/Projects/…/Contracts), never their names.
There is no total count, only hasMore. An unknown field or attribute key, a value of the wrong type or a form the attribute does not allow is 400 validation-failed naming the field; a range or sort on an attribute whose sort index is still being built is 409. When the query cannot be embedded, hybrid search falls back to keyword ranking (the response’s mode says keyword), and semantic search answers 503 search-semantic-unavailable with Retry-After. Any user with the content scope.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”A search, a filtered query or a folder browse.
object
The search text, up to 1,000 characters. Every word must occur in the node; "quoted phrases", OR and -word work. Omit it for a query by filters alone or to browse.
With text only: hybrid (default, words and meaning), keyword (words only) or semantic (meaning only).
The folders to search in (nod_…, or root), at most 100; omitted, the whole repository.
True (default): search the folders and everything below them. False browses: exactly one folder in folders, and the result is its direct children.
Conditions every result must meet, ANDed: standard fields (name, type, isFolder, isContent,
mimeType, size, createdAt, modifiedAt), attributes by key, related — an object
{ "node", "definition", "side" }, or a list of up to 5, for the nodes related to an anchor node —
and onlyEntryPoints: true for the caller’s entry points: nodes they can read whose parent they
cannot (the Portal’s Shared with you). A condition is a value, a list (any of), a range (gte,
gt, lte, lt), { "startsWith": … } or { "all": [ … ] }.
Without text only: the order, at most one entry. Omitted: folders first, then by name.
How a query without text is ordered.
object
name, createdAt, modifiedAt, size, indexedAt (repository admins only) or attributes.{key} for a sortable attribute.
asc (default) or desc. Nodes without a value come last either way.
Hybrid and semantic searches: how many results, default 20, at most 50.
With text only: how many matching passages of text each of the first 10 results carries, 0–3; default 0.
Extra information on the first 10 results, read after the results are chosen: it never changes them.
object
A short summary of each result’s relations: how many related nodes per relation definition and side, capped at 100, and the first few.
object
Relation definition keys, at most 20, ignoring case; omitted, every active definition a result takes part in. An unknown or inactive key is 400.
How many related nodes each summary names, 0–5, first by ID; default 3. 0 gives counts only.
Example
{ "text": "invoices March", "mode": null, "folders": [ "nod_01j9n4wqr0e008000000000001" ], "includeDescendants": null, "filters": { "type": [ "File" ], "modifiedAt": { "gte": "2026-01-01T00:00:00Z" }, "attributes": { "department": "Finance" } }, "sort": null, "page": null, "top": 10, "passages": 1, "include": { "relations": { "definitions": [ "invoiceContacts" ], "sample": 1 } }}Responses
Section titled “Responses”OK
The results of a search.
object
How the search ran: query (no text), keyword, semantic or hybrid. keyword for a hybrid search means meaning could not be used this time.
The results, trimmed to what the caller may read, best or first first.
A node: a folder, document, record or message in the repository, as the caller may see it. It never carries a source’s address, link or identifier.
object
The node’s ID (nod_…); stable while the node exists.
The node’s name: a folder’s or file’s name, a record’s or message’s title.
The node’s place in the repository: the folder names from the root folder, joined by /. Each run of folders you cannot read shows as one … (/Projects/…/Contracts). Changes when a folder above is renamed or its access changes.
The parent folder’s ID (nod_…); null for the root folder.
virtualFolder (a folder that exists only in ContentSurface), mountFolder (where a source is
placed), groupFolder (a folder ContentSurface creates below a mount folder to group related
records, such as an account’s Contacts) or item (anything from a source).
True when the node can have children — whether or not it has any now. Browse it with a search whose includeDescendants is false.
Where a folder’s children come from: hierarchy (folders as arranged in ContentSurface or the
source) or relations (records arranged below a record by how they relate); null when the node
cannot have children.
True when the node has content to retrieve with the content call. A node can be a folder and have content, such as an email with attachments.
The node’s document type, such as File, Email or Account; null for ContentSurface’s own folders.
When the item was created in the source.
Who created the item, as the source names them.
When the item was last changed in the source.
Who last changed the item, as the source names them.
The content’s size in bytes; null without content.
The content’s MIME type, such as application/pdf.
When the content was last indexed. Repository admins only.
Whether the content’s text is indexed: indexed, reused (taken over from an identical document),
tooLarge, excludedType, encrypted or noText; null while not yet indexed. Repository admins only.
Why the index is incomplete, by reason: characterCeiling (text beyond the extraction limit),
extractionTimeout, embeddedDocuments (attachments left out), indexedTextCap (text beyond the
plan’s indexed-text cap is searchable by keyword only) or ocrPages (pages not read by OCR); empty
when complete. Repository admins only.
How much of the content is searchable by meaning, in percent. Repository admins only.
The node’s attributes by key — source fields a repository admin mapped, such as author or department. Values are strings, numbers, booleans, dates or lists of them.
object
The attributes a repository admin chose to show with every result of this document type, in their order, as display text; empty, never null.
One entry of the attribute preview: an attribute’s label and its value as display text.
object
The attribute’s key, as in attributes.
The attribute’s name, for display.
The value as display text: dates formatted, lists joined, long text shortened.
A short fragment of the document’s text, for showing with a result; null when it has none.
The relevance score of a search with text; higher is better. Null otherwise. In semantic mode it is the similarity of the best match, while the order also favours a document that matches in several places, so a result can show a slightly higher score than the one before it.
Search only: the related records below this record that matched the search instead of the record itself, such as an order’s lines, at most three, best first. Such records are never results of their own: they are found through the record they belong to. Null when none matched.
A related record a search result was found by.
object
The matched record (nod_…).
The matched record’s name.
The name of the group folder it sits in below the result, such as Lines.
Search with passages only: the hit’s best matching passages of text, best first. Empty for a hit
found by its name or attributes alone; null for hits beyond the first 10, and without passages.
A matched passage of a document’s text, or — when its text is withheld — its page and why.
object
The passage verbatim; null when withheld.
Where the passage starts in the document’s extracted text, in characters.
The passage’s length in characters.
The page the passage starts on, where the document has pages.
Why text is null: beyondIndexedTextCap (past the plan’s indexed-text cap) or notStoredYet (indexed before passages were kept; re-indexing adds it).
Search with include.relations only: a summary of the hit’s relations, one entry per relation
definition and side with at least one related node the caller can read. Null for hits beyond the
first 10, and without include.relations.
A search hit’s relations through one relation definition, seen from one side: a capped count and the first related nodes.
object
The relation definition’s key, as filters.related.definition takes it.
The relation definition (rld_…): list every related node with GET /v1/nodes/{id}/relations/{definitionId}.
What the related nodes are, seen from the hit, such as Cases or Account.
The side the hit is on, from or to, as the related-nodes call takes it.
How many related nodes the caller can read, at most 100; the exact count is on GET /v1/nodes/{id}/relations.
True when there are more than 100, and count says 100.
The first related nodes by ID, as many as include.relations.sample asked; empty when it was 0.
A related node named in a hit’s relation summary: enough to show and open it.
object
The related node (nod_…).
Its name.
Its document type, such as Case; null for ContentSurface’s own folders.
virtualFolder, mountFolder, groupFolder or item, as on a node.
The node’s own address in the API (/v1/nodes/{id}): a stable name for it, not a credential — a reader still needs access.
Pass as page.cursor for the next page; null on the last page and for hybrid and semantic searches.
True when there is a next page. There is no total count.
Example
{ "mode": "hybrid", "items": [ { "id": "nod_01j9n4wqr0e008000000000004", "name": "March invoices.pdf", "path": "/Finance/Finance share/Invoices 2026/March invoices.pdf", "parentId": "nod_01j9n4wqr0e008000000000003", "kind": "item", "isFolder": false, "childrenFrom": null, "isContent": true, "type": "File", "createdAt": "2026-09-14T08:30:00+00:00", "createdBy": "Maria Novak", "modifiedAt": "2026-11-03T15:12:00+00:00", "modifiedBy": "Luka Horvat", "size": 482133, "mimeType": "application/pdf", "indexedAt": null, "indexState": null, "indexCoverage": null, "semanticCoverage": null, "attributes": { "title": "Invoices March 2026", "department": "Finance", "pageCount": 14 }, "attributePreview": [ { "key": "department", "label": "Department", "value": "Finance" }, { "key": "pageCount", "label": "Page count", "value": "14" } ], "contentPreview": "Summary of the invoices issued in March 2026 to Contoso Ltd and Fabrikam, with payment terms of 30 days…", "score": 0.0331, "matchedDetails": null, "passages": [ { "text": "Invoices issued in March 2026: Contoso Ltd, 12 invoices, total 48,200 EUR, due within 30 days.", "charStart": 1180, "charLength": 92, "page": 2, "withheld": null } ], "relations": [ { "definition": "invoiceContacts", "definitionId": "rld_01j9n4wvr0e008000000000003", "name": "Contacts", "side": "from", "count": 4, "countCapped": false, "sample": [ { "id": "nod_01j9n4wqr0e00800000000000g", "name": "Ana Novak", "type": "Contact", "kind": "item" } ] } ], "permalink": "/v1/nodes/nod_01j9n4wqr0e008000000000004" }, { "id": "nod_01j9n4wqr0e008000000000005", "name": "Budget 2027.xlsx", "path": "/Finance/Finance share/Budget 2027.xlsx", "parentId": "nod_01j9n4wqr0e008000000000002", "kind": "item", "isFolder": false, "childrenFrom": null, "isContent": true, "type": "File", "createdAt": "2026-09-14T08:30:00+00:00", "createdBy": "Maria Novak", "modifiedAt": "2026-11-03T15:12:00+00:00", "modifiedBy": "Luka Horvat", "size": 96512, "mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "indexedAt": null, "indexState": null, "indexCoverage": null, "semanticCoverage": null, "attributes": { "department": "Finance" }, "attributePreview": [ { "key": "department", "label": "Department", "value": "Finance" } ], "contentPreview": null, "score": 0.0164, "matchedDetails": null, "passages": [], "relations": [], "permalink": "/v1/nodes/nod_01j9n4wqr0e008000000000005" } ], "nextCursor": null, "hasMore": false}The request is not valid: a malformed ID, body, filter or parameter.
RFC 9457 problem details. code is the stable reason; confirmation problems add impact and impactToken.
object
urn:contentsurface:problem:{code}.
A short summary for people; may change.
The HTTP status code.
What happened in this case, for people; may change.
The stable, machine-readable reason, such as version-mismatch; branch on this.
For validation-failed: the request field that is not valid.
For confirmation-required: repeat the call with ?confirm={impactToken} to go ahead.
For confirmation-required: what the change would affect, such as the users or folders losing access.
Example
{ "type": "urn:contentsurface:problem:validation-failed", "title": "The request is not valid.", "status": 400, "detail": "No active relation definition 'invoiceContact'.", "code": "validation-failed", "field": "include.relations.definitions[0]"}No valid access token, or it no longer holds for the user (suspended, signed out, relation removed).
RFC 9457 problem details. code is the stable reason; confirmation problems add impact and impactToken.
object
urn:contentsurface:problem:{code}.
A short summary for people; may change.
The HTTP status code.
What happened in this case, for people; may change.
The stable, machine-readable reason, such as version-mismatch; branch on this.
For validation-failed: the request field that is not valid.
For confirmation-required: repeat the call with ?confirm={impactToken} to go ahead.
For confirmation-required: what the change would affect, such as the users or folders losing access.
Example
{ "type": "urn:contentsurface:problem:unauthorized", "title": "Not authenticated.", "status": 401, "detail": "A valid access token is required.", "code": "unauthorized"}Authenticated but not allowed: a missing scope or role, an impersonated token on an admin endpoint, or an inactive tenant.
RFC 9457 problem details. code is the stable reason; confirmation problems add impact and impactToken.
object
urn:contentsurface:problem:{code}.
A short summary for people; may change.
The HTTP status code.
What happened in this case, for people; may change.
The stable, machine-readable reason, such as version-mismatch; branch on this.
For validation-failed: the request field that is not valid.
For confirmation-required: repeat the call with ?confirm={impactToken} to go ahead.
For confirmation-required: what the change would affect, such as the users or folders losing access.
Example
{ "type": "urn:contentsurface:problem:scope-required", "title": "Not allowed.", "status": 403, "detail": "This endpoint requires the cs.content scope.", "code": "scope-required"}Absent: not existing, in another tenant, or not readable by the caller — never distinguished.
RFC 9457 problem details. code is the stable reason; confirmation problems add impact and impactToken.
object
urn:contentsurface:problem:{code}.
A short summary for people; may change.
The HTTP status code.
What happened in this case, for people; may change.
The stable, machine-readable reason, such as version-mismatch; branch on this.
For validation-failed: the request field that is not valid.
For confirmation-required: repeat the call with ?confirm={impactToken} to go ahead.
For confirmation-required: what the change would affect, such as the users or folders losing access.
Example
{ "type": "urn:contentsurface:problem:not-found", "title": "Not found.", "status": 404, "detail": "The resource does not exist.", "code": "not-found"}Conflicts with the current state, or needs confirmation (confirmation-required with impactToken).
RFC 9457 problem details. code is the stable reason; confirmation problems add impact and impactToken.
object
urn:contentsurface:problem:{code}.
A short summary for people; may change.
The HTTP status code.
What happened in this case, for people; may change.
The stable, machine-readable reason, such as version-mismatch; branch on this.
For validation-failed: the request field that is not valid.
For confirmation-required: repeat the call with ?confirm={impactToken} to go ahead.
For confirmation-required: what the change would affect, such as the users or folders losing access.
Example
{ "type": "urn:contentsurface:problem:attribute-index-pending", "title": "The request conflicts with the current state.", "status": 409, "detail": "The indexes of 'department' are still being built; retry later.", "code": "attribute-index-pending", "field": "filters.attributes.department"}Load protection: the tenant is making too many calls, or running too many searches or content streams, at once. Transient and never a quota; retry after Retry-After seconds.
RFC 9457 problem details. code is the stable reason; confirmation problems add impact and impactToken.
object
urn:contentsurface:problem:{code}.
A short summary for people; may change.
The HTTP status code.
What happened in this case, for people; may change.
The stable, machine-readable reason, such as version-mismatch; branch on this.
For validation-failed: the request field that is not valid.
For confirmation-required: repeat the call with ?confirm={impactToken} to go ahead.
For confirmation-required: what the change would affect, such as the users or folders losing access.
Example
{ "type": "urn:contentsurface:problem:too-many-requests", "title": "Too many requests.", "status": 429, "detail": "The tenant is running as many searches as one replica serves, and the queue is full; retry shortly.", "code": "too-many-requests", "retryAfter": 1}