This page provides an overview of collection-related APIs.
Object Overview
Collections provide a logical grouping of source documents within the Lexi data catalog and search platform.
Endpoint, URL, and Supported Methods
Collections are managed via the Lexi server API at [http|https]://[hostname]:[port]/v1.0/tenants/[tenant-guid]/collections
Supported methods include: GET
HEAD
PUT
DELETE
Structure
Objects have the following structure:
{
"GUID": "default",
"TenantGUID": "default",
"Name": "My first collection",
"AllowOverwrites": true,
"AdditionalData": "Created by setup",
"CreatedUtc": "2024-07-10T05:11:51.000000Z"
}
Properties:
GUID
GUID
globally unique identifier for the objectTenantGUID
GUID
globally unique identifier for the tenantName
string
name of the objectAllowOverwrites
bool
boolean specifying whether or not a source document could be overwrittenAdditionalData
string
user-supplied notes or additional dataCreatedUtc
datetime
timestamp from creation, in UTC time
Create
To create, call PUT /v1.0/tenants/[tenant-guid]/collections/[collection-guid]
with the following properties using the Lexi server: Name
AllowOverwrites
AdditionalData
curl -X PUT http://localhost:8601/v1.0/tenants/[tenant-guid]/collections \
-H "Content-Type: application/json" \
-H "Authorization: Bearer [accesskey]" \
-d '
{
"Name": "My collection",
"AllowOverwrites": true,
"AdditionalData": "My notes"
}'
import { ViewLexiSdk } from "view-sdk";
const api = new ViewLexiSdk(
"http://localhost:8000/", //endpoint
"<tenant-guid>", //tenant Id
"default" //access key
);
const createCollection = async () => {
try {
const response = await api.collectionsSdk.create({
Name: "My second collection [ASH]",
AdditionalData: "Yet another collection",
});
console.log(response, "Collection created successfully");
} catch (err) {
console.log("Error creating Collection:", err);
}
};
createCollection();
import view_sdk
from view_sdk import lexi
sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")
def createCollection():
collection = lexi.Collection.create(
Name="My second collection",
AdditionalData="Yet another collection"
)
print(collection)
createCollection()
using View.Sdk;
using View.Sdk.Lexi;
ViewLexiSdk sdk = new ViewLexiSdk(Guid.Parse("<tenant-guid>"),"default", "http://localhost:8000/");
Collection newCollection = new Collection
{
Name = "My second collection [ASH]",
AdditionalData = "Yet another collection",
};
Collection createdCollection = await sdk.CreateCollection(newCollection);
Read
To read a collection by GUID, call GET /v1.0/tenants/[tenant-guid]/collections/[collection-guid]
. If the object exists, it will be returned as a JSON object in the response body. If it does not exist, a 404 will be returned with a NotFound
error response.
{
"GUID": "oneminute",
"TenantGUID": "default",
"Name": "Every minute",
"Schedule": "MinutesInterval",
"Interval": 1,
"CreatedUtc": "2024-07-10T05:21:00.000000Z"
}
curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/collections/00000000-0000-0000-0000-000000000000' \
--header 'Authorization: ••••••'
import { ViewLexiSdk } from "view-sdk";
const api = new ViewLexiSdk(
"http://localhost:8000/", //endpoint
"<tenant-guid>", //tenant Id
"default" //access key
);
const retrieveCollection = async () => {
try {
const response = await api.collectionsSdk.read(
"<collection-guid>"
);
console.log(response, "Collection fetched successfully");
} catch (err) {
console.log("Error fetching Collection:", err);
}
};
retrieveCollection();
import view_sdk
from view_sdk import lexi
sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")
def readCollection():
collection = lexi.Collection.retrieve("<collection-guid>")
print(collection)
readCollection()
using View.Sdk;
using View.Sdk.Lexi;
ViewLexiSdk sdk = new ViewLexiSdk(Guid.Parse("<tenant-guid>"),"default", "http://localhost:8000/");
Collection collection = await sdk.RetrieveCollection(Guid.Parse("<collection-guid>"));
Read all
To read all collections, call GET /v1.0/tenants/[tenant-guid]/collections
. This API will return a JSON array. If the object exists, it will be returned as a JSON object in the response body. If it does not exist, a 404 will be returned with a NotFound
error response.
[
{
"GUID": "00000000-0000-0000-0000-000000000000",
"TenantGUID": "00000000-0000-0000-0000-000000000000",
"Name": "My first collection",
"AllowOverwrites": true,
"AdditionalData": "Created by setup",
"CreatedUtc": "2025-03-25T21:12:32.461527Z"
}
]
curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/collections' \
--header 'Authorization: ••••••'
import { ViewLexiSdk } from "view-sdk";
const api = new ViewLexiSdk(
"http://localhost:8000/", //endpoint
"<tenant-guid>", //tenant Id
"default" //access key
);
const retrieveCollections = async () => {
try {
const response = await api.collectionsSdk.readAll();
console.log(response, "Collection fetched successfully");
} catch (err) {
console.log("Error fetching Collection:", err);
}
};
retrieveCollections();
import view_sdk
from view_sdk import lexi
sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")
def readAllCollections():
collections = lexi.Collection.retrieve_all()
print(collections)
readAllCollections()
using View.Sdk;
using View.Sdk.Lexi;
ViewLexiSdk sdk = new ViewLexiSdk(Guid.Parse("<tenant-guid>"),"default", "http://localhost:8000/");
List<Collection> collections = await sdk.RetrieveCollections();
Enumerate Collection Documents
Enumerate objects by using POST /v1.0/tenants/[tenant-guid]/collections/[guid]/documents?enumerate
. The resultant object will appear as:
{
"Success": true,
"Timestamp": {
"Start": "2024-10-27T06:01:17.502560Z",
"TotalMs": 91.21,
"Messages": {
... log messages ...
}
},
"MaxResults": 1000,
"IterationsRequired": 1,
"ContinuationToken": "3135b2ba-7939-4cc3-8849-bff23b27bc9a",
"EndOfResults": false,
"RecordsRemaining": 46,
"Objects": [
{
"GUID": "1fdbe0c8-8b85-4b0e-ac42-dd4757684a9f",
"TenantGUID": "default",
"BucketGUID": "example-data-bucket",
"CollectionGUID": "default",
"ObjectGUID": "f615ac92-d1d1-4b46-8cc5-acf721131067",
"ObjectKey": "5.pdf",
"ObjectVersion": "1",
"ContentType": "application/pdf",
"DocumentType": "Pdf",
"SourceUrl": "http://dcc249eaaf06:8001/v1.0/tenants/default/buckets/example-data-bucket/objects/5.pdf",
"ContentLength": 31811,
"MD5Hash": "DC477A85FF3882BBFDEB03D7B79ECC9E",
"SHA1Hash": "CC5D85073F193A578F97D46B8A6E4CE946270B5F",
"SHA256Hash": "E5285C6023A46E4E8917C67CCB56B91FED2E578A7AA3129680012C029868B321",
"CreatedUtc": "2024-10-25T14:14:22.000000Z"
},
{ ... }
]
}
curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/collections/00000000-0000-0000-0000-000000000000/documents?enumerate=null' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"MaxResults": 100,
"Skip": 0,
"ContinuationToken": null,
"Ordering": "CreatedDescending",
"Filters": [
{
"Field": "ObjectKey",
"Condition": "IsNotNull",
"Value": ""
}
]
}'
import { ViewLexiSdk } from "view-sdk";
const api = new ViewLexiSdk(
"http://localhost:8000/", //endpoint
"<tenant-guid>", //tenant Id
"default" //access key
);
const enumerateCollection = async () => {
try {
const response = await api.sourceDocumentSdk.enumerate(
"<collection-guid>",
{
MaxResults: 100,
Skip: 0,
ContinuationToken: null,
Ordering: "CreatedDescending",
Filters: [
{
Field: "ObjectKey",
Condition: "IsNotNull",
Value: "",
},
],
}
);
console.log(response, "Collections enumerated successfully");
} catch (err) {
console.log("Error enumerating Collections:", err);
}
};
enumerateCollection();
import view_sdk
from view_sdk import lexi
sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")
def enumerateCollectionDocuments():
documents = lexi.Collection.enumerate_documents("<collection-guid>",{
"MaxResults": 100,
"Skip": 0,
"ContinuationToken": None,
"Ordering": "CreatedDescending",
"Filters": [
{
"Field": "ObjectKey",
"Condition": "IsNotNull",
"Value": ""
}
]
}
)
print(documents)
enumerateCollectionDocuments()
Read Top Terms
To read a collection top terms by GUID, call GET /v1.0/tenants/[tenant-guid]/collections/[collection-guid]/topterms?max-keys=10
. If the object exists, it will be returned as a JSON object in the response body. If it does not exist, a 404 will be returned with a NotFound
error response.
{
"yes": 152463,
"answered": 48717,
"apple": 20362,
"2023": 19689,
"compliance": 17300,
"2022": 11238,
"2024": 5169,
"b2b": 2808,
"digital": 2801,
"products": 2800
}
curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/collections/00000000-0000-0000-0000-000000000000/topterms?max-keys=10' \
--header 'Authorization: ••••••'
import { ViewLexiSdk } from "view-sdk";
const api = new ViewLexiSdk(
"http://localhost:8000/", //endpoint
"<tenant-guid>", //tenant Id
"default" //access key
);
const retrieveTopTerms = async () => {
try {
const response = await api.collectionsSdk.readTopTerms(
"<collection-guid>"
);
console.log(response, "top term fetched successfully");
} catch (err) {
console.log("Error fetching top terms:", err);
}
};
retrieveTopTerms();
import view_sdk
from view_sdk import lexi
sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")
def readTopTerms():
terms = lexi.Collection.retrieve_top_terms("<collection-guid>")
print(terms)
readTopTerms()
Read Statistics
To read a collection statistics by GUID, call GET /v1.0/tenants/[tenant-guid]/collections/[collection-guid]/topterms?max-keys=10
. If the object exists, it will be returned as a JSON object in the response body. If it does not exist, a 404 will be returned with a NotFound
error response.
{
"Collection": {
"GUID": "00000000-0000-0000-0000-000000000000",
"TenantGUID": "00000000-0000-0000-0000-000000000000",
"Name": "My first collection",
"AllowOverwrites": true,
"AdditionalData": "Created by setup",
"CreatedUtc": "2025-03-25T21:12:32.461527Z"
},
"DocumentCount": 227,
"TotalBytes": 197530629,
"TermCount": 200697,
"KeyValueCount": 8
}
curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/collections/00000000-0000-0000-0000-000000000000?stats=null' \
--header 'Authorization: ••••••'
import { ViewLexiSdk } from "view-sdk";
const api = new ViewLexiSdk(
"http://localhost:8000/", //endpoint
"<tenant-guid>", //tenant Id
"default" //access key
);
const retrieveCollectionStatistics = async () => {
try {
const response = await api.collectionsSdk.readStatistics(
"<collection-guid>"
);
console.log(response, "Statistics fetched successfully");
} catch (err) {
console.log("Error fetching Statistics:", err);
}
};
retrieveCollectionStatistics();
import view_sdk
from view_sdk import lexi
sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")
def readCollectionStatistics():
statistics = lexi.Collection.retrieve_statistics("<collection-guid>")
print(statistics)
readCollectionStatistics()
using View.Sdk;
using View.Sdk.Lexi;
ViewLexiSdk sdk = new ViewLexiSdk(Guid.Parse("<tenant-guid>"),"default", "http://localhost:8000/");
CollectionStatistics collectionStatistics = await sdk.RetrieveCollectionStatistics(Guid.Parse("<collection-guid>"));
Check existance
To check if a collection exist by GUID, call HEAD /v1.0/tenants/[tenant-guid]/collections/[collection-guid]
.
curl --location --head 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/collections/00000000-0000-0000-0000-000000000000' \
--header 'Authorization: ••••••'
import { ViewLexiSdk } from "view-sdk";
const api = new ViewLexiSdk(
"http://localhost:8000/", //endpoint
"<tenant-guid>", //tenant Id
"default" //access key
);
const collectionExists = async () => {
try {
const response = await api.collectionsSdk.exists(
"<collection-guid>"
);
console.log(response, "collection exists");
} catch (err) {
console.log("Error fetching collection:", err);
}
};
collectionExists();
import view_sdk
from view_sdk import lexi
sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")
def existsCollection():
exists = lexi.Collection.exists("<collection-guid>")
print(exists)
existsCollection()
Search Collection
To search for a collection, call POST /v1.0/tenants/[tenant-guid]/collections/[collection-guid]/document?search
curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/collections/00000000-0000-0000-0000-000000000000/documents?search=null' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"MaxResults": 2,
"Skip": 1,
"ContinuationToken": "",
"Ordering": "CreatedDescending",
"Filter": {
"CreatedAfter": "2024-01-01 00:00:00.000000",
"CreatedBefore": "2025-01-01 00:00:00.000000",
"Terms": [
"foo"
],
"MimeTypes": [
],
"Prefixes": [
],
"Suffixes": [
],
"SchemaFilters": [
]
}
}'
import { ViewLexiSdk } from "view-sdk";
const api = new ViewLexiSdk(
"http://localhost:8000/", //endpoint
"<tenant-guid>", //tenant Id
"default" //access key
);
const searchCollection = async () => {
try {
const response = await api.searchCollectionSdk.searchDocuments(
"<collection-guid>",
{
MaxResults: 100,
Skip: 0,
ContinuationToken: "",
Ordering: "CreatedDescending",
Filter: {
CreatedAfter: "2025-01-01 00:00:00.000000",
CreatedBefore: "2026-01-01 00:00:00.000000",
Terms: ["view"],
MimeTypes: [],
Prefixes: [],
Suffixes: [],
SchemaFilters: [],
},
}
);
console.log(response, "Collections searched successfully");
} catch (err) {
console.log("Error searching Collections:", err);
}
};
searchCollection()
import view_sdk
from view_sdk import lexi
sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")
def searchCollection():
search = lexi.Collection.search("<collection-guid>",
MaxResults= 2,
Skip= 1,
ContinuationToken= "",
Ordering= "CreatedDescending",
Filter= {
"CreatedAfter": "2024-01-01 00:00:00.000000",
"CreatedBefore": "2025-01-01 00:00:00.000000",
"Terms": [
"foo"
],
"MimeTypes": [
],
"Prefixes": [
],
"Suffixes": [
],
"SchemaFilters": [
]
})
print(search)
searchCollection()
Search collection and include data
To search for a collection with data, call POST /v1.0/tenants/[tenant-guid]/collections/[collection-guid]/document?search&incldata
curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/collections/00000000-0000-0000-0000-000000000000/documents?search=null&incldata=null' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"MaxResults": 2,
"Skip": 1,
"ContinuationToken": "",
"Ordering": "CreatedDescending",
"Filter": {
"CreatedAfter": "2024-01-01 00:00:00.000000",
"CreatedBefore": "2025-01-01 00:00:00.000000",
"Terms": [
"foo"
],
"MimeTypes": [
],
"Prefixes": [
],
"Suffixes": [
],
"SchemaFilters": [
]
}
}'
import { ViewLexiSdk } from "view-sdk";
const api = new ViewLexiSdk(
"http://localhost:8000/", //endpoint
"<tenant-guid>", //tenant Id
"default" //access key
);
const searchCollection = async () => {
try {
const response = await api.searchCollectionSdk.searchDocuments(
"<collection-guid>",
{
MaxResults: 100,
Skip: 0,
ContinuationToken: "",
Ordering: "CreatedDescending",
Filter: {
CreatedAfter: "2025-01-01 00:00:00.000000",
CreatedBefore: "2026-01-01 00:00:00.000000",
Terms: ["view"],
MimeTypes: [],
Prefixes: [],
Suffixes: [],
SchemaFilters: [],
},
},
true
);
console.log(response, "Collections searched successfully");
} catch (err) {
console.log("Error searching Collections:", err);
}
};
searchCollection();
import view_sdk
from view_sdk import lexi
sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")
def searchCollection():
search = lexi.Collection.search("<collection-guid>",
include_data=True,
MaxResults= 2,
Skip= 1,
ContinuationToken= "",
Ordering= "CreatedDescending",
Filter= {
"CreatedAfter": "2024-01-01 00:00:00.000000",
"CreatedBefore": "2025-01-01 00:00:00.000000",
"Terms": [
"foo"
],
"MimeTypes": [
],
"Prefixes": [
],
"Suffixes": [
],
"SchemaFilters": [
]
})
print(search)
searchCollection()
Search collection and include top terms
To search for a collection with top terms, call POST /v1.0/tenants/[tenant-guid]/collections/[collection-guid]/document?search&incltopterms
curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/collections/00000000-0000-0000-0000-000000000000/documents?search=null&incltopterms=null' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"MaxResults": 2,
"Skip": 1,
"ContinuationToken": "",
"Ordering": "CreatedDescending",
"Filter": {
"CreatedAfter": "2024-01-01 00:00:00.000000",
"CreatedBefore": "2025-01-01 00:00:00.000000",
"Terms": [
"foo"
],
"MimeTypes": [
],
"Prefixes": [
],
"Suffixes": [
],
"SchemaFilters": [
]
}
}'
import { ViewLexiSdk } from "view-sdk";
const api = new ViewLexiSdk(
"http://localhost:8000/", //endpoint
"<tenant-guid>", //tenant Id
"default" //access key
);
const searchCollection = async () => {
try {
const response = await api.searchCollectionSdk.searchDocuments(
"<collection-guid>",
{
MaxResults: 100,
Skip: 0,
ContinuationToken: "",
Ordering: "CreatedDescending",
Filter: {
CreatedAfter: "2025-01-01 00:00:00.000000",
CreatedBefore: "2026-01-01 00:00:00.000000",
Terms: ["view"],
MimeTypes: [],
Prefixes: [],
Suffixes: [],
SchemaFilters: [],
},
},
undefined,
true
);
console.log(response, "Collections searched successfully");
} catch (err) {
console.log("Error searching Collections:", err);
}
};
searchCollection();
import view_sdk
from view_sdk import lexi
sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")
def searchCollection():
search = lexi.Collection.search("<collection-guid>",
include_top_terms=True,
MaxResults= 2,
Skip= 1,
ContinuationToken= "",
Ordering= "CreatedDescending",
Filter= {
"CreatedAfter": "2024-01-01 00:00:00.000000",
"CreatedBefore": "2025-01-01 00:00:00.000000",
"Terms": [
"foo"
],
"MimeTypes": [
],
"Prefixes": [
],
"Suffixes": [
],
"SchemaFilters": [
]
})
print(search)
searchCollection()
Search collection and emit result
To search for a collection and emit result, call POST /v1.0/tenants/[tenant-guid]/collections/[collection-guid]/document?search&async
curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/collections/00000000-0000-0000-0000-000000000000/documents?search=null&async=null' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"MaxResults": 2,
"Skip": 1,
"ContinuationToken": "",
"Ordering": "CreatedDescending",
"Filter": {
"CreatedAfter": "2024-01-01 00:00:00.000000",
"CreatedBefore": "2025-01-01 00:00:00.000000",
"Terms": [
"foo"
],
"MimeTypes": [
],
"Prefixes": [
],
"Suffixes": [
],
"SchemaFilters": [
]
}
}'
import { ViewLexiSdk } from "view-sdk";
const api = new ViewLexiSdk(
"http://localhost:8000/", //endpoint
"<tenant-guid>", //tenant Id
"default" //access key
);
const searchCollection = async () => {
try {
const response = await api.searchCollectionSdk.searchDocuments(
"<collection-guid>",
{
MaxResults: 2,
Skip: 1,
ContinuationToken: "",
Ordering: "CreatedDescending",
Filter: {
CreatedAfter: "2024-01-01 00:00:00.000000",
CreatedBefore: "2025-01-01 00:00:00.000000",
Terms: ["foo"],
MimeTypes: [],
Prefixes: [],
Suffixes: [],
SchemaFilters: [],
},
},
undefined,
undefined,
true
);
console.log(response, "Collections searched successfully");
} catch (err) {
console.log("Error searching Collections:", err);
}
};
searchCollection()
import view_sdk
from view_sdk import lexi
sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")
def searchCollection():
search = lexi.Collection.search("<collection-guid>",
emit_results=True,
MaxResults= 2,
Skip= 1,
ContinuationToken= "",
Ordering= "CreatedDescending",
Filter= {
"CreatedAfter": "2024-01-01 00:00:00.000000",
"CreatedBefore": "2025-01-01 00:00:00.000000",
"Terms": [
"foo"
],
"MimeTypes": [
],
"Prefixes": [
],
"Suffixes": [
],
"SchemaFilters": [
]
})
print(search)
searchCollection()
Delete
To delete a collection by GUID, call DELETE /v1.0/tenants/[tenant-guid]/collections/[collection-guid]
. If the collection is not empty, a 400 will be returned.
curl --location --request DELETE 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/collections/00000000-0000-0000-0000-000000000000' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data ''
import { ViewLexiSdk } from "view-sdk";
const api = new ViewLexiSdk(
"http://localhost:8000/", //endpoint
"<tenant-guid>", //tenant Id
"default" //access key
);
const deleteCollection = async () => {
try {
const response = await api.collectionsSdk.delete(
"<collection-guid>"
);
console.log(response, "Collection deleted successfully");
} catch (err) {
console.log("Error deleting Collection:", err);
}
};
deleteCollection();
import view_sdk
from view_sdk import lexi
sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")
def deleteCollection():
response = lexi.Collection.delete("<collection-guid>")
print(response)
deleteCollection()
using View.Sdk;
using View.Sdk.Lexi;
ViewLexiSdk sdk = new ViewLexiSdk(Guid.Parse("<tenant-guid>"),"default", "http://localhost:8000/");
bool deleted = await sdk.DeleteCollection(Guid.Parse("<collection-guid>"));