Skip to main content

Search documents.

POST/api/v1/documents/searchdocuments:search

Searches the documents the caller can read, as the Portal's Search app or by precise filters. query is full text (words are ANDed, OR, "exact phrase", -exclude). Two engines answer, chosen by the members sent. The precise engine reads meaning (a search by meaning; needs the organisation's document embeddings) and filter (a tree of and, or, not and {field, op, value} leaves over the document fields, ops eq, ne, in, gt, gte, lt, lte, contains, starts_with, is_null; lookup-backed fields are named <field>_id). The Search app's engine reads weights, facet_filters (folder, tag, location, document type, from, to, project, file author and so on), document_number_prefixes, reference_numbers, date_ranges (document, entry and file dates), exclude_duplicates and highlight (passages with their pages). One search cannot hold members of both. Each hit carries its score. Relevance pages by the engine's order; sort=document_id orders by document ID.

filter and meaning are not available for every organisation. A call that uses them where they are unavailable is refused with 422 unsupported_for_tenant, unless it also sends a member that the Search app's engine reads; that call is refused with 422 validation_failed.

Scopedocuments:search
AsynchronousNo
MCP toolsearch_documents
Portal permissionssearch_documents
Company capabilitysearch
Pagingsnapshot
Default order-relevance, document_id
Sort fieldsrelevance, document_id

Parameters​

NameInTypeRequiredDescription
limitqueryintegerOptionalDefault: 50; ≥ 1
cursorquerystringOptional
sortquerystringOptionalComma-separated sort fields, - for descending.
Docwize-Versionheaderstring (date)Optional

Request body​

Content typeType
application/jsonDocumentSearchInput

Responses​

StatusDescriptionBody
200Success.application/json object
400invalid_version, malformed_jsonapplication/problem+json Problem
401token_expired, unauthenticatedapplication/problem+json Problem
403forbidden, insufficient_scope, token_owner_inactiveapplication/problem+json Problem
405method_not_allowedapplication/problem+json Problem
406not_acceptableapplication/problem+json Problem
410cursor_expiredapplication/problem+json Problem
413payload_too_largeapplication/problem+json Problem
415unsupported_media_typeapplication/problem+json Problem
421wrong_regionapplication/problem+json Problem
422invalid_cursor, unsupported_for_tenant, validation_failedapplication/problem+json Problem
500internal_errorapplication/problem+json Problem
503tenant_unavailable, unavailableapplication/problem+json Problem
504timeoutapplication/problem+json Problem

200 body​

FieldTypeRequiredDescription
itemsarray of DocumentSearchHitRequired
next_cursorstring or nullRequired
warningsarray of objectRequired

Errors​

The problem codes this operation can answer with. Each code links to its page.

Schemas​

AdditionalField​

FieldTypeRequiredDescription
labelstring or nullRequired
valuestring or nullRequired

AdditionalFields​

FieldTypeRequiredDescription
additional_field_3AdditionalFieldRequired
additional_field_4AdditionalFieldRequired
additional_field_5AdditionalFieldRequired
additional_field_6AdditionalFieldRequired

CarbonCopy​

FieldTypeRequiredDescription
cc_idstringRequired
contactobject or nullRequiredThe contact of the organisation the copy names; null for the organisation on its own.
organisationobject or nullRequired

DocumentFile​

FieldTypeRequiredDescription
content_typestring or nullRequired
file_hashstring or nullRequiredThe hash the Portal stored for the file's content; null when none was recorded.
file_namestringRequired
has_pdfbooleanRequiredWhether a PDF rendition of the file is ready (an Office file converts on demand, so false only means not yet).
is_indexedbooleanRequiredWhether the file's text has been indexed for search.
page_countinteger or nullRequiredThe pages the file has, once the Portal has counted them; null before.
size_bytesstring or nullRequired
version_idstringRequired

DocumentFolder​

FieldTypeRequiredDescription
folder_idstringRequired
pathstring or nullRequired

DocumentSearchHit​

FieldTypeRequiredDescription
actual_submission_datestring or nullRequired
additional_fieldsAdditionalFieldsRequired
attachment_statestring or nullRequirednone, has_attachments or is_attachment (the document is an attachment of another); null unless include names attachment_state.
carbon_copiesarray of CarbonCopyRequiredThe organisations and contacts the document is copied to; empty unless include names carbon_copies.
created_atstring (date-time) or nullRequired
created_byUserRef or nullRequired
descriptionstring or nullRequired
document_datestring or nullRequired
document_idstringRequired
document_numberstring or nullRequired
document_statusobject or nullRequiredThe status shown as Status in the Portal (lookup_actionstatus).
document_sub_typeobject or nullRequired
document_typeobject or nullRequired
duplicate_ofstring or nullRequiredThe number of the document this one duplicates (the Portal's Duplicate Of).
fileDocumentFile or nullRequiredThe current file (name, type, size), as GET /documents/{document_id} shows it; null when the document has none or include leaves file out.
foldersarray of DocumentFolderRequiredThe folders the document is filed in that the caller can see, as GET /documents/{document_id} lists them; empty unless include names folders.
from_contactobject or nullRequired
from_organisationobject or nullRequired
highlightsarray of SearchHighlightRequiredPassages that matched the query, with their pages; empty unless the search asked for highlight, and for the precise engine (filter, meaning).
is_latest_revisionbooleanRequired
is_lockedbooleanRequired
is_privilegedbooleanRequired
locationsarray of SearchHitLocationRequiredThe locations the document is filed in; empty unless include names locations.
main_document_datestring or nullRequired
ownerUserRef or nullRequired
page_endnumber or nullRequiredLast page of the range this document covers in its file.
page_startnumber or nullRequiredFirst page of the range this document covers in its file.
post_review_statusobject or nullRequired
projectobject or nullRequiredThe stored project number text, with the project's ID when one matches.
project_organisationobject or nullRequired
reference_numberstring or nullRequired
relevancenumber or nullRequired1 is relevant (the default), 0 is irrelevant (the Portal's Irrelevant switch).
responded_withstring or nullRequiredThe reference of the document that responded to this one (the Portal's Responded With).
response_datestring or nullRequired
response_due_datestring or nullRequired
revision_numberstring or nullRequired
scorenumberRequiredHow well the document matches the query, higher first. 0 when the search has no query.
tagsarray of SearchHitTagRequiredThe document's tags that are open to the caller; empty unless include names tags.
to_contactobject or nullRequired
to_organisationobject or nullRequired

DocumentSearchInput​

FieldTypeRequiredDescription
date_rangesarray of SearchDateRangeInputOptionalKeep the documents whose dates fall in every range.
document_number_prefixesarray of stringOptionalKeep the documents whose number starts with one of these, ignoring case.
exclude_duplicatesboolean or nullOptionalHide the documents that duplicate another document's number.
facet_filtersarray of SearchFacetFilterInputOptionalKeep the documents whose folder, tag, location, file author and so on hold one of the values. The values are the ones POST /documents/aggregate lists.
filterobject or nullOptionalA tree of and, or, not and {field, op, value} leaves over the document fields (precise engine).
highlightSearchHighlightOptionsInput or nullOptionalReturn the passages of each hit that hold the query's words, with their pages (Search app's engine).
includearray of stringOptionalColumns to add to each hit, as the Search app's results grid shows them: folders, tags, locations, carbon_copies, attachment_state, file. None when left out.
meaningstring or nullOptionalA search by meaning (needs the organisation's document embeddings; precise engine).
querystring or nullOptionalFull text: words are ANDed; OR, "exact phrase" and -exclude work. The Search app's engine also reads parentheses, NOT, AND, a trailing * and field:term, and matches the fields weights names, not only the content.
reference_numbersarray of stringOptionalKeep the documents whose reference number contains one of these, ignoring case.
weightsSearchWeightsInput or nullOptionalHow much each field counts towards the score of a match of the query. 0 leaves a field out.

SearchDateRangeInput​

FieldTypeRequiredDescription
fieldstringRequiredOne of document_date, created_at, file_created_at, file_modified_at.
fromstring (date) or nullOptionalThe first day; open when left out.
tostring (date) or nullOptionalThe last day; open when left out.

SearchFacetFilterInput​

FieldTypeRequiredDescription
facetstringRequiredOne of document_type, document_sub_type, from, to, project, folder, location, tag, created_by, file_content_type, file_author, file_last_author, file_producer, file_title.
valuesarray of SearchFacetValueInputRequiredAlternatives: a document is kept when its facet holds any of them.

SearchFacetValueInput​

FieldTypeRequiredDescription
include_childrenbooleanOptionalWith match exact, also select the values under this one in a hierarchy (a folder's subfolders): the facet starts with the value, ignoring case.
matchstring or nullOptionalexact (the default: the facet equals the value) or contains (the facet contains the text, ignoring case).
valuestringRequiredA value as the facet lists it. An empty string selects the documents with no value.

SearchHighlight​

FieldTypeRequiredDescription
fieldstringRequiredThe field the passage comes from: content, document_number, description, reference_number, from, to, ccs, other_number or folders.
htmlstringRequiredThe passage with the matched words in <b>; everything else is HTML-escaped.
pageinteger or nullRequiredThe 1-based page of the document the passage is on; null when the text has no pages.

SearchHighlightOptionsInput​

FieldTypeRequiredDescription
fragment_sizeinteger or nullOptionalCharacters per passage, 20 to 2000 (default 150).
fragmentsinteger or nullOptionalPassages per field and hit, 1 to 20 (default 3).

SearchHitLocation​

FieldTypeRequiredDescription
location_idstringRequired
pathstring or nullRequired

SearchHitTag​

FieldTypeRequiredDescription
namestringRequired
tag_idstringRequired

SearchWeightsInput​

FieldTypeRequiredDescription
ccsinteger or nullOptional
contentinteger or nullOptional
descriptioninteger or nullOptional
document_numberinteger or nullOptional
foldersinteger or nullOptional
frominteger or nullOptional
other_numberinteger or nullOptional
reference_numberinteger or nullOptional
tointeger or nullOptional

UserRef​

FieldTypeRequiredDescription
display_namestringRequired
kindstring: user, system, integration or stringRequired
user_idstring or nullRequired