---
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
    - `drop` boolean
  - `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.
  - `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
    - `drop` boolean
  - `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.
  - `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

## Other responses

- `409` — Collection already exists

## Changes

- **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/6c2fe01b69bc/schema)
