Skip to navigation

Knowledge store items

Use these methods to add assets to a knowledge store as items, to tag moments and ranges of video items, and to organize items into named collections.

Knowledge store items

The KnowledgeStoreItems class provides methods to add and manage the items in a knowledge store.

Create a knowledge store item

Description: This method adds an asset to a knowledge store for processing. The operation is asynchronous. The item is created immediately with the queued status and processed in the background.

Asset size limits:

  • Video: Up to 10 GB
  • Images: Up to 32 MB

Function signature and example:

create(
knowledgeStoreId: string,
request: TwelvelabsApi.KnowledgeStoreItemsCreateRequest,
requestOptions?: KnowledgeStoreItems.RequestOptions
): Promise<TwelvelabsApi.KnowledgeStoreItem>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
assetIdstringYesThe unique identifier of the asset to add to the knowledge store. If you uploaded the asset before your plan moved to the new billing, enable storage accounting for it before you add it to a knowledge store. Use assets.enableStorageAccounting.
assetTypeKnowledgeStore
ItemAssetType
NoThe type of item to create. Values: video, image.
itemMetadataRecord<string,
KnowledgeStoreMetadataValue>
NoCustom metadata for the item. Keys are strings; values can be a string, a number, a boolean, or an array of strings. You can provide up to 50 key-value pairs.
metadataRecord<string,
KnowledgeStoreMetadataValue>
NoDeprecated. Use itemMetadata instead. The item stores the pairs in its itemMetadata field and not in its metadata field. Send itemMetadata or metadata, not both. A request that sets both returns a 400 error.
requestOptionsKnowledgeStoreItems.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

Returns a KnowledgeStoreItem object. The KnowledgeStoreItem object contains the following properties:

NameTypeDescription
idstringThe unique identifier of the knowledge store item.
assetTypeKnowledgeStore
ItemAssetType
The type of item. Values: video, image.
assetIdstringThe unique identifier of the source asset.
statusKnowledgeStore
ItemStatus
The processing status of the item. Values: queued, pending, processing, ready, failed. For the meaning of each value, see the Item statuses section on The knowledge store item object page.
systemMetadataKnowledgeStore
ItemSystemMetadata
System-generated metadata for the source asset. Its assetType field always matches the item’s top-level assetType field.
metadataRecord<string,
KnowledgeStoreMetadataValue>
The custom metadata of the source asset. Keys are strings; each value is a string, a number, a boolean, or an array of strings. The platform updates it when the user-defined metadata of the asset changes. To change it, use the updateUserMetadata method of client.assets. To set custom metadata for the knowledge store item only, use itemMetadata.
itemMetadataRecord<string,
KnowledgeStoreMetadataValue>
The custom metadata of the knowledge store item. Keys are strings; each value is a string, a number, a boolean, or an array of strings. It is separate from the custom metadata of the source asset. A change to the custom metadata of the source asset does not change this field. The same key can have different values in the metadata field and in the itemMetadata field. You set it when you create the item or change it with the updateKnowledgeStoreItemMetadata or replaceKnowledgeStoreItemMetadata methods of client.knowledgeStoreItems. This field is absent when no item metadata has been set.
enrichedMetadataRecord<string, unknown>Metadata that the platform extracts from the whole item, as defined by the enrichment configuration of the knowledge store. It contains the properties that have the granularity keyword set to video for a video, or to image for an image. Properties that have the granularity keyword set to shot do not appear in this field. Keys are the property names; each value matches its property definition. A property with no value is omitted. The field is present only when the item is ready and contains at least one value.
createdAtstringThe date and time when the item was created, in the RFC 3339 format.
updatedAtstringThe date and time when the item was last updated, in the RFC 3339 format.

API Reference

Create a knowledge store item.

Add assets to a knowledge store.

List knowledge store items

Description: This method returns a list of items in the specified knowledge store.

Function signature and example:

list(
knowledgeStoreId: string,
request?: TwelvelabsApi.KnowledgeStoreItemsListRequest,
requestOptions?: KnowledgeStoreItems.RequestOptions
): Promise<core.Page<TwelvelabsApi.KnowledgeStoreItem>>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
pagenumberNoA number that identifies the page to retrieve. Default: 1.
pageLimitnumberNoThe number of items to return on each page. Default: 10. Max: 50.
sortByKnowledgeStore
ItemsListRequestSortBy
NoThe field to sort on. The following options are available:
- created_at: Sorts by the time, in the RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the item was created.
- updated_at: Sorts by the time, in the RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the item was last updated. Default: created_at.
sortOptionstringNoThe sorting direction. The following options are available:
- asc
- desc Default: desc.
statusKnowledgeStore
ItemsListRequestStatusItem[]
NoFilter by one or more item processing statuses. Values: queued, pending, processing, ready, failed. For the meaning of each value, see the Item statuses section on The knowledge store item object page.
requestOptionsKnowledgeStoreItems.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

Returns a Page<KnowledgeStoreItem> object that allows you to iterate through the paginated list of items. For the properties of each KnowledgeStoreItem object, see Create a knowledge store item.

API Reference

List knowledge store items.

Retrieve a knowledge store item

Description: This method retrieves the details of a specific knowledge store item.

Function signature and example:

retrieve(
knowledgeStoreId: string,
itemId: string,
requestOptions?: KnowledgeStoreItems.RequestOptions
): Promise<TwelvelabsApi.KnowledgeStoreItem>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
itemIdstringYesThe unique identifier of the knowledge store item.
requestOptionsKnowledgeStoreItems.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

Returns a KnowledgeStoreItem object. For its properties, see Create a knowledge store item.

API Reference

Retrieve a knowledge store item.

Delete a knowledge store item

Description: This method deletes the specified knowledge store item.

Function signature and example:

delete(
knowledgeStoreId: string,
itemId: string,
requestOptions?: KnowledgeStoreItems.RequestOptions
): Promise<void>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
itemIdstringYesThe unique identifier of the knowledge store item.
requestOptionsKnowledgeStoreItems.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

This method does not return a value.

API Reference

Delete a knowledge store item.

Update the item metadata

Description: This method updates the itemMetadata of the specified knowledge store item and returns the item. The platform merges your changes with the existing metadata:

  • A key with a value creates or replaces that key.
  • A key set to null deletes that key.
  • A key set to an empty string ("") or an empty array ([]) is ignored.
  • A key you omit from the request keeps its current value.

The metadata field of the item does not change. If the merged result contains more than 50 pairs, the request fails.

To replace all item metadata in a single call, use the Replace the item metadata method instead.

Function signature and example:

updateKnowledgeStoreItemMetadata(
knowledgeStoreId: string,
itemId: string,
request: TwelvelabsApi.UpdateKnowledgeStoreItemMetadataRequest,
requestOptions?: KnowledgeStoreItems.RequestOptions
): Promise<TwelvelabsApi.KnowledgeStoreItem>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
itemIdstringYesThe unique identifier of the knowledge store item.
itemMetadataRecord<string,
KnowledgeStoreMetadataEditValue>
YesThe keys to change. Send at least one key. Keys are strings of up to 128 characters. String values can have up to 8192 characters. Values can be a string, a number, a boolean, an array of strings, or null to delete the key. A nested object and an array containing anything other than strings are rejected. An integer must fit in 53 bits (-9007199254740991 to 9007199254740991). Send a wider integer, or an identifier that must be preserved verbatim, as a string.
requestOptionsKnowledgeStoreItems.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

Returns a KnowledgeStoreItem object. For its properties, see Create a knowledge store item.

API Reference

Update the item metadata.

Replace the item metadata

Description: This method replaces the entire itemMetadata of the specified knowledge store item and returns the item. Unlike the Update the item metadata method, which merges your changes with the existing metadata, this method overwrites the stored value in full:

  • A key with a value creates or replaces that key.
  • A key you omit, or set to an empty string (""), an empty array ([]), or null, is removed.

To clear all item metadata, send an empty object ({}) in the itemMetadata field. The metadata field of the item does not change.

Function signature and example:

replaceKnowledgeStoreItemMetadata(
knowledgeStoreId: string,
itemId: string,
request: TwelvelabsApi.ReplaceKnowledgeStoreItemMetadataRequest,
requestOptions?: KnowledgeStoreItems.RequestOptions
): Promise<TwelvelabsApi.KnowledgeStoreItem>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
itemIdstringYesThe unique identifier of the knowledge store item.
itemMetadataRecord<string,
KnowledgeStoreMetadataEditValue>
YesThe complete itemMetadata of the item after the request. Up to 50 pairs. Keys are strings of up to 128 characters. String values can have up to 8192 characters. Values can be a string, a number, a boolean, or an array of strings. A nested object and an array containing anything other than strings are rejected. An integer must fit in 53 bits (-9007199254740991 to 9007199254740991). Send a wider integer, or an identifier that must be preserved verbatim, as a string.
requestOptionsKnowledgeStoreItems.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

Returns a KnowledgeStoreItem object. For its properties, see Create a knowledge store item.

API Reference

Replace the item metadata.

Item tags

The KnowledgeStoreItemTags class provides methods to tag moments and ranges of video items. A tag carries custom metadata.

Create an item tag

Description: This method tags a moment or a range of a video item and returns the tag. Set startSec to tag a moment. Set startSec and endSec to tag a range. A video item holds up to 100 tags. The method returns a 422 error for an item that is not a video item, and when the item already holds 100 tags.

Function signature and example:

create(
knowledgeStoreId: string,
itemId: string,
request: TwelvelabsApi.CreateKnowledgeStoreItemTagRequest,
requestOptions?: KnowledgeStoreItemTags.RequestOptions
): Promise<TwelvelabsApi.KnowledgeStoreItemTag>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
itemIdstringYesThe unique identifier of the knowledge store item.
startSecnumberYesThe start of the tag, in seconds from the start of the video. The value must be 0 or greater. It must be less than the duration of the video.
endSecnumberNoThe end of the range, in seconds from the start of the video. It must be greater than startSec. It must not exceed the duration of the video. Omit it, or send null, to tag a single moment.
tagMetadataRecord<string,
KnowledgeStoreMetadataValue>
YesThe custom metadata of the tag, as key-value pairs. Send at least one key. Up to 50 pairs. Keys are strings of up to 128 characters. String values can have up to 8192 characters. Values can be a string, a number, a boolean, or an array of strings. A nested object, an array containing anything other than strings, and a null value are rejected. An integer must fit in 53 bits (-9007199254740991 to 9007199254740991). Send a wider integer, or an identifier that must be preserved verbatim, as a string.
requestOptionsKnowledgeStoreItem
Tags.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

Returns a KnowledgeStoreItemTag object. The KnowledgeStoreItemTag object contains the following properties:

NameTypeDescription
idstringThe unique identifier of the item tag.
knowledgeStoreIdstringThe unique identifier of the knowledge store.
itemIdstringThe unique identifier of the knowledge store item that holds the tag.
startSecnumberThe start of the tag, in seconds from the start of the video.
endSecnumberThe end of the range, in seconds from the start of the video. The field is absent for a tag on a single moment.
tagMetadataRecord<string,
KnowledgeStoreMetadataValue>
The custom metadata of the tag. Keys are strings. Each value is a string, a number, a boolean, or an array of strings.
createdAtstringThe date and time when the tag was created, in the RFC 3339 format.
updatedAtstringThe date and time when the tag was last updated, in the RFC 3339 format.

API Reference

Create an item tag.

List item tags

Description: This method returns the tags of the specified knowledge store item. The platform sorts the tags by startSec, earliest first. Tags with the same startSec are sorted by id.

Function signature and example:

list(
knowledgeStoreId: string,
itemId: string,
request?: TwelvelabsApi.KnowledgeStoreItemTagsListRequest,
requestOptions?: KnowledgeStoreItemTags.RequestOptions
): Promise<core.Page<TwelvelabsApi.KnowledgeStoreItemTag>>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
itemIdstringYesThe unique identifier of the knowledge store item.
pagenumberNoA number that identifies the page to retrieve. Default: 1.
pageLimitnumberNoThe number of items to return on each page. Default: 10. Max: 50.
requestOptionsKnowledgeStoreItem
Tags.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

Returns a Page<KnowledgeStoreItemTag> object that allows you to iterate through the paginated list of item tags. For the properties of each KnowledgeStoreItemTag object, see Create an item tag.

API Reference

List item tags.

Retrieve an item tag

Description: This method retrieves the details of a specific tag of a knowledge store item.

Function signature and example:

retrieve(
knowledgeStoreId: string,
itemId: string,
tagId: string,
requestOptions?: KnowledgeStoreItemTags.RequestOptions
): Promise<TwelvelabsApi.KnowledgeStoreItemTag>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
itemIdstringYesThe unique identifier of the knowledge store item.
tagIdstringYesThe unique identifier of the item tag.
requestOptionsKnowledgeStoreItem
Tags.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

Returns a KnowledgeStoreItemTag object. For its properties, see Create an item tag.

API Reference

Retrieve an item tag.

Update an item tag

Description: This method updates the range or the tagMetadata of the specified tag and returns the tag. Send at least one field. A field you omit keeps its current value. To clear the end of the range, send endSec as null. The tag becomes a single moment. The platform merges your changes to tagMetadata with the existing metadata:

  • A key with a value creates or replaces that key.
  • A key set to null deletes that key.
  • A key set to an empty string ("") or an empty array ([]) is ignored.
  • A key you omit from the request keeps its current value.

The tag must keep at least one key in tagMetadata, and it holds up to 50 pairs. If the merged result breaks either limit, the request fails.

Function signature and example:

update(
knowledgeStoreId: string,
itemId: string,
tagId: string,
request?: TwelvelabsApi.UpdateKnowledgeStoreItemTagRequest,
requestOptions?: KnowledgeStoreItemTags.RequestOptions
): Promise<TwelvelabsApi.KnowledgeStoreItemTag>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
itemIdstringYesThe unique identifier of the knowledge store item.
tagIdstringYesThe unique identifier of the item tag.
startSecnumberNoThe new start of the tag, in seconds from the start of the video. The value must be 0 or greater. It must be less than the duration of the video. The tag must still end after it starts.
endSecnumberNoThe new end of the range, in seconds from the start of the video. It must be greater than startSec. It must not exceed the duration of the video. Send null to clear the end, which turns a range into a single moment. Omit the field to keep the current end.
tagMetadataRecord<string,
KnowledgeStoreMetadataEditValue>
NoThe keys to change. Send at least one key. Keys are strings of up to 128 characters. String values can have up to 8192 characters. Values can be a string, a number, a boolean, an array of strings, or null to delete the key. A key you omit keeps its current value. A nested object and an array containing anything other than strings are rejected. The tag holds up to 50 pairs after the merge. An integer must fit in 53 bits (-9007199254740991 to 9007199254740991). Send a wider integer, or an identifier that must be preserved verbatim, as a string.
requestOptionsKnowledgeStoreItem
Tags.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

Returns a KnowledgeStoreItemTag object. For its properties, see Create an item tag.

API Reference

Update an item tag.

Delete an item tag

Description: This method deletes the specified tag of a knowledge store item.

Function signature and example:

delete(
knowledgeStoreId: string,
itemId: string,
tagId: string,
requestOptions?: KnowledgeStoreItemTags.RequestOptions
): Promise<void>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
itemIdstringYesThe unique identifier of the knowledge store item.
tagIdstringYesThe unique identifier of the item tag.
requestOptionsKnowledgeStoreItem
Tags.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

This method does not return a value.

API Reference

Delete an item tag.

Item collections

The KnowledgeStoreItemCollections class provides methods to organize items into named collections that you can reference together.

Create an item collection

Description: This method creates an item collection in the specified knowledge store. An item collection is a named collection of items. Use item collections to organize and reference subsets of items together.

Function signature and example:

create(
knowledgeStoreId: string,
request: TwelvelabsApi.KnowledgeStoreItemCollectionsCreateRequest,
requestOptions?: KnowledgeStoreItemCollections.RequestOptions
): Promise<TwelvelabsApi.KnowledgeStoreItemCollection>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
namestringYesThe name of the item collection. Must be unique within the knowledge store.
descriptionstringNoAn optional description of the item collection.
metadataRecord<string,
KnowledgeStoreMetadataValue>
NoCustom metadata for the item collection. Keys are strings; values can be a string, a number, a boolean, or an array of strings. You can provide up to 10 key-value pairs.
requestOptionsKnowledgeStoreItem
Collections.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

Returns a KnowledgeStoreItemCollection object. The KnowledgeStoreItemCollection object contains the following properties:

NameTypeDescription
idstringThe unique identifier of the item collection.
knowledgeStoreIdstringThe unique identifier of the knowledge store this collection belongs to.
namestringThe name of the item collection.
descriptionstringThe description of the item collection.
metadataRecord<string,
KnowledgeStoreMetadataValue>
Custom metadata for the item collection. Keys are strings; each value is a string, a number, a boolean, or an array of strings.
memberCountnumberThe number of items in the collection.
createdAtstringThe date and time when the item collection was created, in the RFC 3339 format.
updatedAtstringThe date and time when the item collection was last updated, in the RFC 3339 format.

API Reference

Create an item collection.

List item collections

Description: This method returns a list of the item collections in the specified knowledge store.

Function signature and example:

list(
knowledgeStoreId: string,
request?: TwelvelabsApi.KnowledgeStoreItemCollectionsListRequest,
requestOptions?: KnowledgeStoreItemCollections.RequestOptions
): Promise<core.Page<TwelvelabsApi.KnowledgeStoreItemCollection>>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
pagenumberNoA number that identifies the page to retrieve. Default: 1.
pageLimitnumberNoThe number of items to return on each page. Default: 10. Max: 50.
sortByKnowledgeStoreItem
CollectionsList
RequestSortBy
NoThe field to sort on. The following options are available:
- created_at: Sorts by the time, in the RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the item collection was created.
- updated_at: Sorts by the time, in the RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the item collection was last updated.
- name: Sorts alphabetically by the name of the item collection. Default: created_at.
sortOptionstringNoThe sorting direction. The following options are available:
- asc
- desc Default: desc.
requestOptionsKnowledgeStoreItem
Collections.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

Returns a Page<KnowledgeStoreItemCollection> object that allows you to iterate through the paginated list of item collections. For the properties of each KnowledgeStoreItemCollection object, see Create an item collection.

API Reference

List item collections.

Retrieve an item collection

Description: This method retrieves the details of a specific item collection.

Function signature and example:

retrieve(
knowledgeStoreId: string,
collectionId: string,
requestOptions?: KnowledgeStoreItemCollections.RequestOptions
): Promise<TwelvelabsApi.KnowledgeStoreItemCollection>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
collectionIdstringYesThe unique identifier of the knowledge store item collection.
requestOptionsKnowledgeStoreItem
Collections.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

Returns a KnowledgeStoreItemCollection object. For its properties, see Create an item collection.

API Reference

Retrieve an item collection.

Update an item collection

Description: This method updates the name, description, and metadata fields of the specified item collection.

Function signature and example:

update(
knowledgeStoreId: string,
collectionId: string,
request?: TwelvelabsApi.KnowledgeStoreItemCollectionsUpdateRequest,
requestOptions?: KnowledgeStoreItemCollections.RequestOptions
): Promise<TwelvelabsApi.KnowledgeStoreItemCollection>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
collectionIdstringYesThe unique identifier of the knowledge store item collection.
namestringNoThe name of the item collection. Must be unique within the knowledge store.
descriptionstringNoAn optional description of the item collection.
metadataRecord<string,
KnowledgeStoreMetadataValue>
NoCustom metadata for the item collection. Keys are strings; values can be a string, a number, a boolean, or an array of strings. You can provide up to 10 key-value pairs. The provided object replaces the existing metadata in full, so include every key you want to keep and omit the ones you want to remove. To clear all metadata, set this field to an empty object ({}).
requestOptionsKnowledgeStoreItem
Collections.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

Returns a KnowledgeStoreItemCollection object. For its properties, see Create an item collection.

API Reference

Update an item collection.

Delete an item collection

Description: This method deletes the specified item collection. The items themselves remain in the knowledge store.

Function signature and example:

delete(
knowledgeStoreId: string,
collectionId: string,
requestOptions?: KnowledgeStoreItemCollections.RequestOptions
): Promise<void>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
collectionIdstringYesThe unique identifier of the knowledge store item collection.
requestOptionsKnowledgeStoreItem
Collections.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

This method does not return a value.

API Reference

Delete an item collection.

List items in an item collection

Description: This method returns a list of the items in the specified item collection.

Function signature and example:

listItems(
knowledgeStoreId: string,
collectionId: string,
request?: TwelvelabsApi.KnowledgeStoreItemCollectionsListItemsRequest,
requestOptions?: KnowledgeStoreItemCollections.RequestOptions
): Promise<core.Page<TwelvelabsApi.KnowledgeStoreItem>>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
collectionIdstringYesThe unique identifier of the knowledge store item collection.
pagenumberNoA number that identifies the page to retrieve. Default: 1.
pageLimitnumberNoThe number of items to return on each page. Default: 10. Max: 50.
requestOptionsKnowledgeStoreItem
Collections.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

Returns a Page<KnowledgeStoreItem> object that allows you to iterate through the paginated list of items in the collection. For the properties of each KnowledgeStoreItem object, see Create a knowledge store item.

API Reference

List items in an item collection.

Add items to an item collection

Description: This method adds one or more items to the specified item collection. This operation is idempotent — items already in the collection are skipped. Every identifier must reference an existing item in the knowledge store.

Function signature and example:

addItems(
knowledgeStoreId: string,
collectionId: string,
request: TwelvelabsApi.KnowledgeStoreItemCollectionsAddItemsRequest,
requestOptions?: KnowledgeStoreItemCollections.RequestOptions
): Promise<TwelvelabsApi.KnowledgeStoreItemCollection>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
collectionIdstringYesThe unique identifier of the knowledge store item collection.
itemIdsstring[]YesThe unique identifiers of the items to add to the collection. Include up to 500 identifiers per request.
requestOptionsKnowledgeStoreItem
Collections.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

Returns a KnowledgeStoreItemCollection object. For its properties, see Create an item collection.

API Reference

Add items to an item collection.

Remove items from an item collection

Description: This method removes one or more items from the specified item collection. This operation is idempotent — identifiers that do not match a member of the collection are ignored. The items themselves remain in the knowledge store.

Function signature and example:

removeItems(
knowledgeStoreId: string,
collectionId: string,
request: TwelvelabsApi.KnowledgeStoreItemCollectionsRemoveItemsRequest,
requestOptions?: KnowledgeStoreItemCollections.RequestOptions
): Promise<void>

Parameters

NameTypeRequiredDescription
knowledgeStoreIdstringYesThe unique identifier of the knowledge store.
collectionIdstringYesThe unique identifier of the knowledge store item collection.
itemIdsstring[]YesThe unique identifiers of the items to remove from the collection. Include up to 500 identifiers per request.
requestOptionsKnowledgeStoreItem
Collections.
RequestOptions
NoPer-call SDK settings such as timeout, retries, and headers. For all fields, see Request options.

Return value

This method does not return a value.

API Reference

Remove items from an item collection.