---
title: "Create a new collection"
method: POST
path: "/collections"
tags: ["collections"]
---

# Create a new collection

`POST /collections`

When a collection is created, we give it a name and describe the fields that will be indexed from the documents added to the collection.

## Request body

- CollectionSchema
  - `name` string, required — Name of the collection
  - `fields` Field[], required — A list of fields for querying, filtering and faceting
    - `name` string, required
    - `type` string, required
    - `optional` boolean
    - `facet` boolean
    - `index` boolean
    - `locale` string
    - `sort` boolean
    - `infix` boolean
    - `num_dim` integer
    - `drop` boolean
    - `embed` object
      - `from` string[], required
      - `model_config` object, required
        - `model_name` string, required
        - `api_key` string
        - `access_token` string
        - `client_id` string
        - `client_secret` string
        - `project_id` string
  - `default_sorting_field` string — The name of an int32 / float field that determines the order in which the search results are ranked when a sort_by clause is not provided during searching. This field must indicate some kind of popularity.
  - `token_separators` string[] — List of symbols or special characters to be used for splitting the text into individual words in addition to space and new-line characters.
  - `enable_nested_fields` boolean — Enables experimental support at a collection level for nested object or object array fields. This field is only available if the Typesense server is version `0.24.0.rcn34` or later.
  - `symbols_to_index` string[] — List of symbols or special characters to be indexed.

## Response `201`

Collection successfully created

- CollectionResponse
  - `name` string, required — Name of the collection
  - `fields` Field[], required — A list of fields for querying, filtering and faceting
    - `name` string, required
    - `type` string, required
    - `optional` boolean
    - `facet` boolean
    - `index` boolean
    - `locale` string
    - `sort` boolean
    - `infix` boolean
    - `num_dim` integer
    - `drop` boolean
    - `embed` object
      - `from` string[], required
      - `model_config` object, required
        - `model_name` string, required
        - `api_key` string
        - `access_token` string
        - `client_id` string
        - `client_secret` string
        - `project_id` string
  - `default_sorting_field` string — The name of an int32 / float field that determines the order in which the search results are ranked when a sort_by clause is not provided during searching. This field must indicate some kind of popularity.
  - `token_separators` string[] — List of symbols or special characters to be used for splitting the text into individual words in addition to space and new-line characters.
  - `enable_nested_fields` boolean — Enables experimental support at a collection level for nested object or object array fields. This field is only available if the Typesense server is version `0.24.0.rcn34` or later.
  - `symbols_to_index` string[] — List of symbols or special characters to be indexed.
  - `num_documents` integer, required — Number of documents in the collection
  - `created_at` integer, required — Timestamp of when the collection was created (Unix epoch in seconds)

## Other responses

- `400` — Bad request, see error message for details
- `409` — Collection already exists

## Changes

- **2024-02-13** `14b1d3553228` — 2 breaking, 2 warning, 13 info
  - the `symbols_to_index/items/` request property's minLength was increased from `0` to `1`
  - the `token_separators/items/` request property's minLength was increased from `0` to `1`
  - the `symbols_to_index/items/` request property's maxLength was set to `1`
  - the `token_separators/items/` request property's maxLength was set to `1`
  - …13 more
- **2022-08-04** `6c2fe01b69bc` — 4 breaking, 30 warning, 9 info
  - the `allOf[#/components/schemas/CollectionSchema]/symbols_to_index/items/` response property's maxLength was unset from `1` for the response status `201`
  - the `allOf[#/components/schemas/CollectionSchema]/token_separators/items/` response property's maxLength was unset from `1` for the response status `201`
  - the `allOf[#/components/schemas/CollectionSchema]/symbols_to_index/items/` response property's minLength was decreased from `1` to `0` for the response status `201`
  - the `allOf[#/components/schemas/CollectionSchema]/token_separators/items/` response property's minLength was decreased from `1` to `0` for the response status `201`
  - …39 more

[Change history](https://skmtc.dev/typesense/apis/typesense-api/changes/collections/post.md)

---

[API](https://skmtc.dev/typesense/apis/typesense-api.md) · [All operations](https://skmtc.dev/typesense/apis/typesense-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/typesense/typesense-api/revisions/06457e69ca0f/schema)
