> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeroentropy.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Add Collection

> Adds a collection.

If the collection already exists, a `409 Conflict` status code will be returned.



## OpenAPI

````yaml /api-reference/openapi.json post /collections/add-collection
openapi: 3.1.0
info:
  title: ZeroEntropy API
  description: This API provides access to ZeroEntropy's SoTA retrieval pipeline. Enjoy!
  version: 0.1.0
servers:
  - url: https://api.zeroentropy.dev/v1
    description: ZeroEntropy API
  - url: https://eu-api.zeroentropy.dev/v1
    description: ZeroEntropy API (EU datacenters)
security: []
paths:
  /collections/add-collection:
    post:
      tags:
        - Collections
      summary: Add Collection
      description: >-
        Adds a collection.


        If the collection already exists, a `409 Conflict` status code will be
        returned.
      operationId: add_collection_collections_add_collection_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddCollectionRequest'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DefaultResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              example:
                detail: Description of Error
        '409':
          description: Conflict
          content:
            application/json:
              example:
                detail: Description of Error
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    AddCollectionRequest:
      properties:
        collection_name:
          type: string
          title: Collection Name
          description: >-
            The name of the collection to add. The maximum length of this string
            is 1024 characters. If special characters are used, then the UTF-8
            encoded string cannot exceed 1024 bytes.
        num_shards:
          type: integer
          title: Num Shards
          description: >-
            [ADVANCED] The number of shards to use for this collection. By using
            K shards, your documents can index with K times more throughput.
            However, queries will be automatically sent to all K shards and then
            aggregated. For large collections, this can make queries faster. But
            for small collections, this will make queries slower. `num_shards`
            must be one of [1, 8, 16, 32, 64]. The default is 1.
          default: 1
      type: object
      required:
        - collection_name
      title: AddCollectionRequest
    DefaultResponse:
      properties:
        message:
          type: string
          title: Message
          description: >-
            This string will always be "Success!". This may change in the
            future.
          default: Success!
      type: object
      title: DefaultResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      description: >-
        The `Authorization` header must be provided in the format `Bearer
        <your-api-key>`.


        You can get your API Key at the
        [Dashboard](https://dashboard.zeroentropy.dev/)!
      scheme: bearer

````