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

# Create Collection

> Create a new collection in a datastore. Pass `datastoreId` as a query parameter.

If you plan to use sync, note the following:

<Note>
**Date formatting:** Documents containing `DATE` or `DATETIME` data must use the format `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ` to sync correctly.
</Note>

<Warning>
**Only top-level fields can be synced.** Column names must be **top-level keys** in the document's `content` object; dot notation does not traverse nested objects during sync. To include a nested object, use the top-level key name (e.g., `wand`) — the synced value will be the JSON string representation of that object (e.g., `{"wood":"holly","core":"phoenix feather","length":11}`).
</Warning>

<Warning>
**Incorrect schema types prevent DataSet creation.** The accepted column types are `STRING` · `LONG` · `DECIMAL` · `DOUBLE` · `DATE` · `DATETIME`. If your AppDB DataSet doesn't appear after 15 minutes, verify your schema uses only these values — common mistakes include `NUMBER` or `INTEGER`.
</Warning>

<Warning>
**Collections won't sync if the collection owner lacks permissions on the target DataSet.** If that user is removed from Domo, syncing stops. The new owner must have both Collection ownership and Admin Permissions.
</Warning>




## OpenAPI

````yaml /openapi/product/appdb.yaml post /api/datastores/v1/collections
openapi: 3.0.0
info:
  title: App DB API
  version: v1
  description: |
    The App DB API allows developers to interact with AppDB, a NoSQL database 
    for storing arbitrary JSON documents. This API supports CRUD operations, 
    querying, and aggregation, enabling developers to manage data efficiently 
    within their Domo applications.
servers:
  - url: https://{instance}.domo.com
    description: Domo Instance
    variables:
      instance:
        default: api
        description: Your specific Domo instance name (e.g., mycompany)
security:
  - developerToken: []
tags:
  - name: Documents
    description: Manage individual documents in an AppDB collection.
  - name: Collections
    description: Manage AppDB collections (schema, permissions).
  - name: App DB API (Product)
    description: Manage documents and collections in AppDB.
paths:
  /api/datastores/v1/collections:
    post:
      tags:
        - App DB API (Product)
      summary: Create Collection
      description: >
        Create a new collection in a datastore. Pass `datastoreId` as a query
        parameter.


        If you plan to use sync, note the following:


        <Note>

        **Date formatting:** Documents containing `DATE` or `DATETIME` data must
        use the format `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ` to sync correctly.

        </Note>


        <Warning>

        **Only top-level fields can be synced.** Column names must be
        **top-level keys** in the document's `content` object; dot notation does
        not traverse nested objects during sync. To include a nested object, use
        the top-level key name (e.g., `wand`) — the synced value will be the
        JSON string representation of that object (e.g.,
        `{"wood":"holly","core":"phoenix feather","length":11}`).

        </Warning>


        <Warning>

        **Incorrect schema types prevent DataSet creation.** The accepted column
        types are `STRING` · `LONG` · `DECIMAL` · `DOUBLE` · `DATE` ·
        `DATETIME`. If your AppDB DataSet doesn't appear after 15 minutes,
        verify your schema uses only these values — common mistakes include
        `NUMBER` or `INTEGER`.

        </Warning>


        <Warning>

        **Collections won't sync if the collection owner lacks permissions on
        the target DataSet.** If that user is removed from Domo, syncing stops.
        The new owner must have both Collection ownership and Admin Permissions.

        </Warning>
      parameters:
        - name: datastoreId
          in: query
          required: true
          schema:
            type: string
          description: The ID of the datastore to create the collection in.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Name for the collection.
                syncEnabled:
                  type: boolean
                  description: >-
                    Whether to enable periodic syncing to a linked Domo DataSet.
                    Requires `schema` to be provided; the API returns a 400 if
                    `syncEnabled: true` is passed without a schema.
                schema:
                  type: object
                  properties:
                    columns:
                      type: array
                      items:
                        $ref: '#/components/schemas/CollectionColumn'
            example:
              name: users
              syncEnabled: true
              schema:
                columns:
                  - name: username
                    type: STRING
                  - name: email
                    type: STRING
      responses:
        '201':
          description: Collection created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Collection'
        '400':
          description: >-
            Bad Request. Common causes: `syncEnabled: true` was passed without a
            `schema`; or the required `name` field was missing.
components:
  schemas:
    CollectionColumn:
      type: object
      properties:
        type:
          type: string
          enum:
            - STRING
            - LONG
            - DECIMAL
            - DOUBLE
            - DATE
            - DATETIME
        name:
          type: string
    Collection:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the collection.
        datastoreId:
          type: string
          format: uuid
          description: ID of the datastore this collection belongs to.
        defaultPermissions:
          nullable: true
          description: >-
            Comma-separated default permission set for new app grants on this
            collection, or null if not set.
        requiredAuthorities:
          nullable: true
          description: >-
            Maps CollectionOperation names to required authority strings, or
            null if not set.
        owner:
          type: integer
          description: User ID of the collection owner.
        name:
          type: string
          description: Name of the collection.
        datasourceId:
          type: string
          nullable: true
          description: ID of the linked Domo DataSet, or null if not yet linked.
        schema:
          type: object
          properties:
            columns:
              type: array
              items:
                $ref: '#/components/schemas/CollectionColumn'
        filters:
          nullable: true
          description: >-
            Array of document-level filter predicates applied to read
            operations, or null if not set.
        syncEnabled:
          type: boolean
          description: Whether documents are periodically synced to the linked DataSet.
        syncRequired:
          type: boolean
          description: Whether a sync is pending.
        fullReplaceRequired:
          type: boolean
        lastSync:
          type: string
          format: date-time
          nullable: true
        createdOn:
          type: string
          format: date-time
        updatedOn:
          type: string
          format: date-time
        updatedBy:
          type: integer
      example:
        id: 232e6d6c-46e9-49b6-a137-8933f0f05999
        datastoreId: 39b88a97-8247-4c0d-ba1d-8ed78d1a6680
        defaultPermissions: null
        requiredAuthorities: null
        owner: 870010733
        name: users
        datasourceId: null
        schema:
          columns:
            - type: STRING
              name: username
            - type: STRING
              name: email
        filters: null
        syncEnabled: true
        syncRequired: false
        fullReplaceRequired: false
        lastSync: null
        createdOn: '2024-01-15T18:42:30.115Z'
        updatedOn: '2024-01-15T18:42:30.115Z'
        updatedBy: 870010733
  securitySchemes:
    developerToken:
      type: apiKey
      in: header
      name: X-DOMO-Developer-Token
      description: Domo Developer Token for authentication.

````