> This page is for version v1.3 (default).
> For other versions, use one of these documentation indexes:
> - v1.3 (default): https://docs.twelvelabs.io/v1.3/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.twelvelabs.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.twelvelabs.io/_mcp/server.

## Sort knowledge store items by custom metadata

You can now sort the items in a knowledge store by the value of a custom metadata key when you list them. Set the `sort_by` parameter to `metadata.<key>`. For example, `metadata.view_count` sorts the items by the `view_count` key.

To use this feature, upgrade to the latest version of the Python or Node.js SDK:

**`Python SDK`**

```sh Python SDK
pip install --upgrade twelvelabs
```

**`Node.js SDK`**

```sh Node.js SDK
npm install twelvelabs-js@latest
```

### SDK type changes (breaking change)

The `sort_by` parameter in Python and the `sortBy` parameter in Node.js are now strings. The SDKs no longer include the `KnowledgeStoreItemsListRequestSortBy` type. If your code uses this type, pass the value as a string instead, for example `"created_at"`.

For details, see the [List knowledge store items](/v1.3/api-reference/knowledge-store-items/list) page in the API Reference section, or the SDK reference for [Python](/v1.3/sdk-reference/python/knowledge-store-items#list-knowledge-store-items) and [Node.js](/v1.3/sdk-reference/node-js/knowledge-store-items#list-knowledge-store-items).