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

# Create Collection

> Create a collection. Clauses are optional so an empty collection can be curated later. Collection CRUD is free.



## OpenAPI

````yaml post /v1/collections
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.trychannel3.com
    description: Production
security: []
paths:
  /v1/collections:
    post:
      tags:
        - collections
      summary: Create Collection
      description: >-
        Create a collection. Clauses are optional so an empty collection can be
        curated later. Collection CRUD is free.
      operationId: create_collection_v1_collections_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCollectionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectionResponse'
        '401':
          description: Unauthorized - Invalid or missing authentication
          content:
            application/json:
              examples:
                missing_key:
                  summary: Missing API Key
                  value:
                    detail: >-
                      Unauthorized. Missing authentication key. Make sure to
                      attach an x-api-key with your request. Need help? Reach
                      out to support@trychannel3.com.
                invalid_key:
                  summary: Invalid API Key
                  value:
                    detail: >-
                      API key was provided but is invalid. Need help? Reach out
                      to support@trychannel3.com.
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - APIKeyHeader: []
components:
  schemas:
    CreateCollectionRequest:
      properties:
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: >-
            Display name. Defaults to 'Collection {{n}}' for this account or
            user.
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Optional vendor-facing notes for this collection.
        user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: User Id
          description: >-
            Optional partner user id. Scopes the collection to one end user and
            serves as the default x-user-id on collection-scoped search, browse,
            and conversation requests when the caller omits that header.
        clauses:
          items:
            $ref: '#/components/schemas/CollectionClauseInput'
          type: array
          title: Clauses
          description: >-
            OR across clauses. Within a clause, brand_ids, website_ids, and
            category_ids are ORed inside each list and ANDed across lists.
          default: []
      additionalProperties: false
      type: object
      title: CreateCollectionRequest
    CollectionResponse:
      properties:
        collection_id:
          type: string
          title: Collection Id
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: User Id
        clauses:
          items:
            $ref: '#/components/schemas/CollectionClause'
          type: array
          title: Clauses
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - collection_id
        - name
        - clauses
        - created_at
        - updated_at
      title: CollectionResponse
    ErrorResponse:
      properties:
        detail:
          anyOf:
            - type: string
            - items:
                additionalProperties: true
                type: object
              type: array
          title: Detail
      type: object
      required:
        - detail
      title: ErrorResponse
    CollectionClauseInput:
      properties:
        brand_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Brand Ids
          description: >-
            OR within this list. AND with the clause's other lists. OR against
            other clauses.
        website_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Website Ids
          description: >-
            Merchant ids or domains; OR within this list. AND with the clause's
            other lists. Domains are stored as merchant ids.
        category_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Category Ids
          description: OR within this list. AND with the clause's other lists.
        product_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Product Ids
      additionalProperties: false
      type: object
      title: CollectionClauseInput
      description: Clause payload for create / add_clauses (server mints clause_id).
    CollectionClause:
      allOf:
        - $ref: '#/components/schemas/CollectionClauseInput'
        - type: object
          required:
            - clause_id
          properties:
            clause_id:
              type: string
              title: Clause Id
      title: CollectionClause
      description: Persisted clause with a stable server-minted id.
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````