> 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.

# List knowledge stores

GET https://api.twelvelabs.io/v1.3/knowledge-stores

This method returns a list of the knowledge stores in your account.


Reference: https://docs.twelvelabs.io/api-reference/knowledge-stores/list

## Authentication

- `x-api-key` header (required) — Your API key. You can find your API key on the API Keys page.

## Request

### Query parameters

- `page` (integer, optional, default: 1) — A number that identifies the page to retrieve. **Default**: `1`.
- `page_limit` (integer, optional, default: 10) — The number of items to return on each page. **Default**: `10`. **Max**: `50`.
- `sort_by` (enum, optional, default: created_at) — The 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 knowledge store was created. - `updated_at`: Sorts by the time, in the RFC 3339 format ("YYYY-MM-DDTHH:mm:ssZ"), when the knowledge store was updated. **Default**: `created_at`.
  - Allowed values: `created_at`, `updated_at`
- `sort_option` (string, optional, default: desc) — The sorting direction. The following options are available: - `asc` - `desc` **Default**: `desc`.
- `asset_id` (string, optional) — Filter by the unique identifier of an asset. A knowledge store matches when it contains an item that uses the asset. The item can have any status. If the identifier is valid but belongs to no asset, the platform returns a `200` response with an empty `data` array. It does not return an error. If you send an empty value or a value that is not a valid asset identifier, the platform returns a `400` error with the `parameter_invalid` code. It returns the same error if you repeat the parameter.

## Response

### 200

The knowledge stores have been successfully retrieved.

- `data` (list of KnowledgeStore, optional) — An array containing the knowledge stores.
- `page_info` (page_info, optional) — An object that provides information about pagination.

## Errors

### 400 Bad Request Error

The request has failed.

- `code` (string, optional) — A string representing the code associated with the error. See the [Error codes](/v1.3/api-reference/error-codes) page for details.
- `message` (string, optional) — A human-readable string describing the error, intended to be suitable for display in a user interface.

## Types

### KnowledgeStore

A knowledge store contains your videos and images plus the understanding the platform derives from them: spatiotemporal context, a typed ontology, and embeddings for semantic retrieval. It is the corpus agents reason over: the full collection, not just individual clips.

- `_id` (string, optional) — The unique identifier of the knowledge store.
- `name` (string, optional) — The name of the knowledge store.
- `description` (string, optional) — An optional description of the knowledge store.
- `ingestion_config` (IngestionConfig, optional) — The ingestion configuration set when this knowledge store was created. Immutable.
- `item_count` (integer, optional) — The number of items in the knowledge store.
- `created_at` (string, optional) — The date and time when the knowledge store was created, in the RFC 3339 format.
- `updated_at` (string, optional) — The date and time when the knowledge store was last updated, in the RFC 3339 format.
- `metadata` (map from string to KnowledgeStoreMetadataValue, optional) — Custom metadata for the knowledge store. Keys are strings; each value is a string, a number, a boolean, or an array of strings.

### page_info

An object that provides information about pagination.

- `limit_per_page` (integer, optional) — The maximum number of items on each page.
- `page` (integer, optional) — The page you retrieved.
- `total_page` (integer, optional) — The total number of pages.
- `total_results` (integer, optional) — The total number of results.

### IngestionConfig

Configuration that controls how content added to the knowledge store is processed.

- `enrichment_config` (EnrichmentConfig, required) — Metadata enrichment configuration. The `type` field selects one variant: - `type: json_schema` - Structured extraction conforming to a provided JSON Schema. - `type: description` - Natural-language instructions that the platform converts into a schema internally.

### KnowledgeStoreMetadataValue

A single custom-metadata value: a string, a number, a boolean, or an array of strings. The value keeps the JSON type sent; 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). A wider integer, or an identifier that must be preserved verbatim, must be sent as a string.

- string
- integer
- double
- boolean
- list of string

### EnrichmentConfig

Metadata enrichment configuration. The `type` field selects one variant: - `type: json_schema` - Structured extraction conforming to a provided JSON Schema. - `type: description` - Natural-language instructions that the platform converts into a schema internally.

- `type`: `json_schema` (json_schema)
  - `json_schema` (EnrichmentConfigJsonSchemaJsonSchema, required) — A JSON Schema (draft 2020-12) that defines the structure of metadata to extract. The platform accepts only the JSON Schema keywords listed below; unknown keywords return a `422` error. Keep schemas focused — deeply nested or overly complex schemas may degrade extraction quality. **Supported keywords** | Category | Keywords | | ---------- | ------------------------------------------------ | | Core | `type`, `title`, `description`, `enum` | | Object | `properties`, `required`, `additionalProperties` | | Array | `items`, `prefixItems`, `minItems`, `maxItems` | | Number | `minimum`, `maximum` | | String | `format` | | Extraction | `granularity` | Notes: * The root `type` keyword must be `"object"`. * The `granularity` keyword sets how often the platform extracts a top-level property. Use `shot` to extract a value for each shot of a video, `video` to extract one value for each video, or `image` to extract one value for each image. A shot is a continuous part of a video between two scene changes. The default is `shot`. The platform extracts `shot` and `video` properties only from videos, and `image` properties only from images. It returns `video` and `image` values in the [`enriched_metadata`](/v1.3/api-reference/knowledge-store-items/retrieve#response.body.enriched_metadata) field of the item. A `granularity` keyword on a nested property returns a `422` error. * Every entry under the `properties` keyword (including nested ones) must include a `description` field. This text guides extraction quality. * The `required` keyword behaves as in standard JSON Schema, at the granularity of each property: a required `shot` property has a value for each shot, and a required `video` property has one for each video. * The `additionalProperties` keyword accepts a boolean value (`true` or `false`). Use `false` to enforce strict shapes. The platform does not support schema-valued forms. * **Unknown keywords return `422` — they are not silently ignored.** If you generate schemas programmatically (for example, using `pydantic.model_json_schema()`), strip annotative keywords such as `default`, `examples`, and `readOnly` before submitting. * **The platform does not support nullable fields.** This includes both `nullable: true` and `type: ["string", "null"]`. To express an optional field, omit it from the `required` array — the platform omits the field from the result when no value is present. **Not supported (returns `422`)** * Schema composition: `anyOf`, `allOf`, `oneOf`, `not` * Conditional schemas: `if` / `then` / `else` * Property dependencies: `dependentSchemas`, `dependentRequired` * Object size constraints: `minProperties`, `maxProperties` * String constraints: `pattern`, `minLength`, `maxLength` * Number constraints: `exclusiveMinimum`, `exclusiveMaximum`, `multipleOf` * Value constraints: `const` * Null handling: `nullable`, `type` arrays (e.g., `["string", "null"]`) * Annotative keywords: `default`, `examples`, `readOnly`, `writeOnly` * References and reuse: `$ref`, `$defs`, `definitions` * Any other keyword not listed under "Supported keywords" above
- `type`: `description` (description)
  - `description` (string, required) — A natural-language description of what knowledge should be extracted from the videos. The platform converts this into a JSON Schema internally.

### EnrichmentConfigJsonSchemaJsonSchema

A JSON Schema (draft 2020-12) that defines the structure of metadata to extract. The platform accepts only the JSON Schema keywords listed below; unknown keywords return a `422` error. Keep schemas focused — deeply nested or overly complex schemas may degrade extraction quality. **Supported keywords** | Category | Keywords | | ---------- | ------------------------------------------------ | | Core | `type`, `title`, `description`, `enum` | | Object | `properties`, `required`, `additionalProperties` | | Array | `items`, `prefixItems`, `minItems`, `maxItems` | | Number | `minimum`, `maximum` | | String | `format` | | Extraction | `granularity` | Notes: * The root `type` keyword must be `"object"`. * The `granularity` keyword sets how often the platform extracts a top-level property. Use `shot` to extract a value for each shot of a video, `video` to extract one value for each video, or `image` to extract one value for each image. A shot is a continuous part of a video between two scene changes. The default is `shot`. The platform extracts `shot` and `video` properties only from videos, and `image` properties only from images. It returns `video` and `image` values in the [`enriched_metadata`](/v1.3/api-reference/knowledge-store-items/retrieve#response.body.enriched_metadata) field of the item. A `granularity` keyword on a nested property returns a `422` error. * Every entry under the `properties` keyword (including nested ones) must include a `description` field. This text guides extraction quality. * The `required` keyword behaves as in standard JSON Schema, at the granularity of each property: a required `shot` property has a value for each shot, and a required `video` property has one for each video. * The `additionalProperties` keyword accepts a boolean value (`true` or `false`). Use `false` to enforce strict shapes. The platform does not support schema-valued forms. * **Unknown keywords return `422` — they are not silently ignored.** If you generate schemas programmatically (for example, using `pydantic.model_json_schema()`), strip annotative keywords such as `default`, `examples`, and `readOnly` before submitting. * **The platform does not support nullable fields.** This includes both `nullable: true` and `type: ["string", "null"]`. To express an optional field, omit it from the `required` array — the platform omits the field from the result when no value is present. **Not supported (returns `422`)** * Schema composition: `anyOf`, `allOf`, `oneOf`, `not` * Conditional schemas: `if` / `then` / `else` * Property dependencies: `dependentSchemas`, `dependentRequired` * Object size constraints: `minProperties`, `maxProperties` * String constraints: `pattern`, `minLength`, `maxLength` * Number constraints: `exclusiveMinimum`, `exclusiveMaximum`, `multipleOf` * Value constraints: `const` * Null handling: `nullable`, `type` arrays (e.g., `["string", "null"]`) * Annotative keywords: `default`, `examples`, `readOnly`, `writeOnly` * References and reuse: `$ref`, `$defs`, `definitions` * Any other keyword not listed under "Supported keywords" above

- `type` (enum, required) — The top-level type of the schema. Must be `"object"`. Primitive and array top-level types are not supported. The platform uses this object structure to map extracted metadata to named fields.
  - Allowed values: `object`
- `properties` (map from string to any, required) — A map of property names to their JSON Schema definitions. Each property must include a field named `description`. The platform uses this field to guide extraction quality. Omitting it returns a `422` error.

## Examples

**Response**

```json
{
  "data": [
    {
      "_id": "ks_069e9869-1ea3-7481-8000-dae72bf6be6e",
      "name": "Product Demo Analysis",
      "description": "Knowledge store for product demo videos",
      "ingestion_config": {
        "enrichment_config": {
          "type": "json_schema",
          "json_schema": {
            "type": "object",
            "properties": {
              "brand": {
                "type": "string",
                "description": "The brand featured in the video",
                "granularity": "video"
              },
              "topic": {
                "type": "string",
                "description": "The main topic discussed in this shot",
                "granularity": "shot"
              }
            },
            "required": [
              "topic"
            ]
          }
        }
      },
      "item_count": 5,
      "created_at": "2024-01-15T09:30:00Z",
      "updated_at": "2024-01-15T09:30:00Z",
      "metadata": {}
    }
  ],
  "page_info": {
    "limit_per_page": 10,
    "page": 1,
    "total_page": 1,
    "total_results": 2
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.twelvelabs.io/v1.3/knowledge-stores"

querystring = {"sort_by":"created_at","asset_id":"6298d673f1090f1100476d4c"}

headers = {"x-api-key": "<apiKey>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'https://api.twelvelabs.io/v1.3/knowledge-stores?sort_by=created_at&asset_id=6298d673f1090f1100476d4c';
const options = {method: 'GET', headers: {'x-api-key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.twelvelabs.io/v1.3/knowledge-stores?sort_by=created_at&asset_id=6298d673f1090f1100476d4c"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-api-key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.twelvelabs.io/v1.3/knowledge-stores?sort_by=created_at&asset_id=6298d673f1090f1100476d4c")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.twelvelabs.io/v1.3/knowledge-stores?sort_by=created_at&asset_id=6298d673f1090f1100476d4c")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.twelvelabs.io/v1.3/knowledge-stores?sort_by=created_at&asset_id=6298d673f1090f1100476d4c', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.twelvelabs.io/v1.3/knowledge-stores?sort_by=created_at&asset_id=6298d673f1090f1100476d4c");
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["x-api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/knowledge-stores?sort_by=created_at&asset_id=6298d673f1090f1100476d4c")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```