---
title: "Create Datastore"
method: POST
path: "/datastores"
tags: ["/datastores"]
---

# Create Datastore

`POST /datastores`

Create a new `Datastore`.

A `Datastore` is a collection of documents. Documents can be ingested into and deleted from a `Datastore`.

A `Datastore` can be linked to one or more `Agents`, and conversely, an `Agent` can be associated with one or more `Datastores` to ground its responses with relevant data. This flexible many-to-many relationship allows `Agents` to draw from multiple sources of information. This linkage of `Datastore` to `Agent` is done through the `Create Agent` or `Edit Agent` APIs.

> Note that self-serve users are currently required to create datastores through our UI. Otherwise, they will receive the following message: "This endpoint is disabled as you need to go through checkout. Please use the UI to make this request."

## Request body

- DatastoreInput — DatastoreInput for creating a new datastore. If no type is provided, we default to unstructured.
  - `name` string, required — Name of the datastore
  - `configuration` UnstructuredDatastoreConfigModel — Configuration for unstructured datastores.
    - `parsing` DatastoreParseConfiguration — Configuration for data extraction settings from documents at datastore level. Controls settings for document parsing. Includes those from `/parse` API along with some extra ingestion-only ones.
      - `figure_captioning_prompt` string — Prompt to use for generating image captions. Must be non-empty if `figure_caption_mode` is `custom`. Otherwise, must be null.
      - `figure_caption_mode` 'default' | 'custom' | 'ignore' — Mode for figure captioning. - `default`: Use the default figure prompt, which generates a detailed caption for each figure. - `custom`: Use a custom prompt. - `ignore`: Disable figure captioning.
      - `enable_split_tables` boolean — Whether to enable table splitting, which splits large tables into smaller tables with at most `max_split_table_cells` cells each. In each split table, the table headers are reproduced as the first row(s). This is useful for preserving context when tables are too large to fit into one chunk.
      - `max_split_table_cells` integer — Maximum number of cells for split tables. Ignored if `enable_split_tables` is False.
    - `chunking` ChunkingConfiguration — Configuration for document chunking settings.
      - `chunking_mode` 'hierarchy_depth' | 'hierarchy_heading' | 'static_length' | 'page_level' — Defines available chunking strategies. - `hierarchy_depth`: Creates a new chunk whenever a higher-level section heading is encountered. - `hierarchy_heading`: Creates a new chunk whenever any section heading is encountered. - `static_length`: Creates chunks of a fixed length. - `page_level`: Creates chunks that cannot run over page boundaries.
      - `max_chunk_length_tokens` integer — Target maximum length of text tokens chunks for chunking. Chunk length may exceed this value in some edge cases.
      - `min_chunk_length_tokens` integer — Target minimum length of chunks in tokens. Must be at least 384 tokens less than `max_chunk_length_tokens`. Chunk length may be shorter than this value in some edge cases. Ignored if `chunking_mode` is `page_level`.
      - `enable_hierarchy_based_contextualization` boolean — Whether to enable section-based contextualization for chunking
    - `html_config` HtmlConfiguration — Configuration for HTML document ingestion settings.
      - `max_chunk_length_tokens` integer — Target maximum length of text tokens chunks for chunking. Chunk length may exceed this value in some edge cases.

## Response `200`

Successful Response

- CreateDatastoreOutput
  - `id` string, uuid, required — ID of the datastore

## Other responses

- `422` — Validation Error

## Changes

- **2025-08-26** `db7245c74772` — 1 info
  - added the new optional request property `configuration`

[Change history](https://skmtc.dev/contextualai/apis/endpoints/changes/datastores/post.md)

---

[API](https://skmtc.dev/contextualai/apis/endpoints.md) · [All operations](https://skmtc.dev/contextualai/apis/endpoints/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/contextualai/endpoints/revisions/ca7f807eec8b/schema)
