Search

Search Document Collection

POST
Search across all documents in a document collection using the document metadata and contents.

Request

This endpoint expects an object.
documentCollectionId
UUIDRequired
searchQuery
stringRequired
userEmail
stringRequired
The email of the user making the search request for permissions reduction.
structuredQueryFilters
list of objectsRequired
The structured query filters to apply to the search query.
searchOptions
objectOptional
metadataFilterExpression
stringOptional
Legacy metadata filter expression to apply to the search query. Use structuredQueryFilters instead.

Response

This endpoint returns an object
searchTermsUsed
list of strings
structuredFiltersApplied
list of objects
searchId
UUID
results
list of objects
POST
1curl -X POST https://api.credal.ai/api/v0/search/searchDocumentCollection \
2 -H "Authorization: Bearer <apiKey>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "documentCollectionId": "82e4b12a-6990-45d4-8ebd-85c00e030c24",
6 "searchQuery": "ABC Corp",
7 "userEmail": "jack@credal.ai",
8 "structuredQueryFilters": [
9 {
10 "field": "status",
11 "operator": "==",
12 "value": "Open"
13 }
14 ],
15 "searchOptions": {
16 "maxChunks": 10,
17 "mergeContents": true,
18 "threshold": 0.8,
19 "enableSmartFiltering": true,
20 "enableQueryExtraction": true,
21 "enableReranking": true
22 }
23}'
200Successful
1{
2 "searchTermsUsed": [
3 "ABC Corp"
4 ],
5 "structuredFiltersApplied": [
6 {
7 "field": "status",
8 "operator": "==",
9 "value": "Open"
10 }
11 ],
12 "searchId": "76b534be-5d5c-11ee-b268-87f1fd934c81",
13 "results": [
14 {
15 "documentId": "82e4b12a-6990-45d4-8ebd-85c00e030c24",
16 "documentName": "ABC Corp - Initial meeting transcript",
17 "documentMetadata": {
18 "customerName": "ABC Corp",
19 "meetingDate": "2021-01-01T00:00:00Z"
20 },
21 "chunks": [
22 {
23 "chunkId": "8d49fa7e-f09a-4bd4-ae94-4c089c9043a0",
24 "chunkIndex": 0,
25 "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
26 "score": 0.9
27 },
28 {
29 "chunkId": "c24f99f9-2477-461b-8f8f-90a82a40879d",
30 "chunkIndex": 1,
31 "text": "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore",
32 "score": 0.8
33 },
34 {
35 "chunkId": "6413d18c-b37f-4985-9045-cc8d6e100a17",
36 "chunkIndex": 2,
37 "text": "sunt in culpa qui officia deserunt mollit anim id est laborum.",
38 "score": 0.7
39 }
40 ],
41 "mergedContents": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore. sunt in culpa qui officia deserunt mollit anim id est laborum."
42 },
43 {
44 "documentId": "90998ceb-1c10-4d2a-96cb-acf89fa3005e",
45 "documentName": "XYZ Corp - Follow-up transcript",
46 "documentMetadata": {
47 "customerName": "XYZ Corp",
48 "meetingDate": "2021-01-02T00:00:00Z"
49 },
50 "chunks": [
51 {
52 "chunkId": "3664912a-3edb-4d88-b624-80db99d383e6",
53 "chunkIndex": 0,
54 "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
55 "score": 0.7
56 },
57 {
58 "chunkId": "da9d43a4-2927-442c-8e5c-b9ef86f56fc3",
59 "chunkIndex": 1,
60 "text": "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore",
61 "score": 0.9
62 },
63 {
64 "chunkId": "8d882e9f-8eda-479b-ae2a-359ebae7b626",
65 "chunkIndex": 2,
66 "text": "sunt in culpa qui officia deserunt mollit anim id est laborum.",
67 "score": 0.75
68 }
69 ],
70 "mergedContents": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore. sunt in culpa qui officia deserunt mollit anim id est laborum."
71 }
72 ]
73}