> ## 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 Document

> Creates a single document in a collection.



## OpenAPI

````yaml /openapi/framework/appdb.yaml post /domo/datastores/v2/collections/{collectionName}/documents
openapi: 3.0.0
info:
  title: Domo AppDB API
  version: v1
  description: >
    AppDB API for storing arbitrary JSON documents similar to a NoSQL database.
    This enables storing state within your DomoApp

    with optional syncing to Domo DataSets.


    Three layers provide data storage:

    - **Datastores**: Analogous to a database. A CustomApp has a single
    datastore created automatically.

    - **Collections**: Analogous to a collection in NoSQL or table in relational
    databases.

    - **Documents**: Analogous to documents in NoSQL or table rows in relational
    databases.
servers:
  - url: https://{instance}.domo.com
    description: Domo Instance
    variables:
      instance:
        default: example
        description: Your Domo instance name
security: []
paths:
  /domo/datastores/v2/collections/{collectionName}/documents:
    post:
      tags:
        - AppDB API
      summary: Create Document
      description: Creates a single document in a collection.
      parameters:
        - $ref: '#/components/parameters/CollectionName'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentCreate'
            example:
              content:
                name: Harry Potter
                house: Gryffindor
                wand:
                  wood: holly
                  core: phoenix feather
                  length: 11
                courses:
                  - Defense Against the Dark Arts
                  - Potions
                  - Transfiguration
                enrolledOn: '1991-09-01'
                lastDetention: '1994-06-08T20:00:00Z'
      responses:
        '200':
          description: Document created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Document'
              example:
                id: 402778f6-bc8d-4aa5-a581-e08e3fc98c05
                datastoreId: daee775a-3be4-410d-ba20-bb0d94ce51cb
                collectionId: 2148c830-14c2-478f-bb14-5c3019de46b4
                syncRequired: true
                owner: '540824222'
                createdBy: '540824222'
                createdOn: '2026-07-31T23:09:34.542Z'
                updatedOn: '2026-07-31T23:09:34.542Z'
                updatedBy: '540824222'
                content:
                  name: Harry Potter
                  house: Gryffindor
                  wand:
                    wood: holly
                    core: phoenix feather
                    length: 11
                  courses:
                    - Defense Against the Dark Arts
                    - Potions
                    - Transfiguration
                  enrolledOn: '1991-09-01'
                  lastDetention: '1994-06-08T20:00:00Z'
        '403':
          description: >-
            Forbidden. The user does not have permission to create documents on
            this collection — either directly or inherited through app
            permissions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: 403
                statusReason: >-
                  status 403 reading
                  DocumentsResourceClient#createDocument(UUID,DocumentDefinition)
                toe: 72B1APM37J-KOMYZ-3JLGX
        '404':
          description: >-
            Collection not found. Verify the collection name is correct (it is
            case-sensitive) and that the collection has been created or
            correctly wired in this app's datastore.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: 404
                statusReason: 'DA0088: Invalid collection name: Students'
                toe: FTYRJMBLKD-5HB2Z-H6W8A
      x-codeSamples:
        - lang: JavaScript
          label: domo.js
          source: >-
            const collectionName = 'Students';


            domo.post(`/domo/datastores/v2/collections/${collectionName}/documents`,
            {
              content: {
                name: 'Harry Potter',
                house: 'Gryffindor',
                wand: { wood: 'holly', core: 'phoenix feather', length: 11 },
                courses: ['Defense Against the Dark Arts', 'Potions', 'Transfiguration'],
                enrolledOn: '1991-09-01',
                lastDetention: '1994-06-08T20:00:00Z'
              }
            }).then(doc => console.log(doc));
        - lang: JavaScript
          label: domo.js v6
          source: |-
            // domo.js v6
            const collectionName = 'Students';

            // create auto-wraps content — pass content fields directly.
            const doc = await domo.appdb.create(collectionName, {
              name: 'Harry Potter',
              house: 'Gryffindor',
              wand: { wood: 'holly', core: 'phoenix feather', length: 11 },
              courses: ['Defense Against the Dark Arts', 'Potions', 'Transfiguration'],
              enrolledOn: '1991-09-01',
              lastDetention: '1994-06-08T20:00:00Z'
            });
            console.log(doc);
        - lang: cURL
          label: cURL
          source: |-
            # This API is only available inside a Domo app.
            # Use the JavaScript (domo.js) tab for the correct usage.
        - lang: Python
          label: Python
          source: |-
            # This API is only available inside a Domo app.
            # Use the JavaScript (domo.js) tab for the correct usage.
        - lang: PHP
          label: PHP
          source: |-
            // This API is only available inside a Domo app.
            // Use the JavaScript (domo.js) tab for the correct usage.
        - lang: Go
          label: Go
          source: |-
            // This API is only available inside a Domo app.
            // Use the JavaScript (domo.js) tab for the correct usage.
        - lang: Java
          label: Java
          source: |-
            // This API is only available inside a Domo app.
            // Use the JavaScript (domo.js) tab for the correct usage.
        - lang: Ruby
          label: Ruby
          source: |-
            # This API is only available inside a Domo app.
            # Use the JavaScript (domo.js) tab for the correct usage.
components:
  parameters:
    CollectionName:
      name: collectionName
      in: path
      required: true
      description: The name given to the collection in the manifest. Case-sensitive.
      schema:
        type: string
  schemas:
    DocumentCreate:
      type: object
      required:
        - content
      properties:
        content:
          type: object
          additionalProperties: true
          description: The document content matching collection schema
    Document:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the Document
        datastoreId:
          type: string
          format: uuid
          description: >-
            Unique identifier of the Datastore that this Document's Collection
            belongs to.
        collectionId:
          type: string
          format: uuid
          description: Unique identifier of the Collection this Document belongs to.
        syncRequired:
          type: boolean
          description: >-
            Whether or not this Document needs to be synced by Domo to the
            associated DataSet; only applies if the `syncEnabled` option is on
            for the Collection.
        owner:
          type: string
          description: User ID of the Document owner.
        createdBy:
          type: string
          description: User ID of the user who created the Document.
        createdOn:
          type: string
          format: date-time
          description: The ISO-8601 timestamp showing when this Document was created.
        updatedOn:
          type: string
          format: date-time
          description: The ISO-8601 timestamp showing when this Document was last updated.
        updatedBy:
          type: string
          description: User ID of the user who last updated the Document.
        content:
          type: object
          additionalProperties: true
          description: The actual Document content
      example:
        id: c023b254-647e-4839-b74b-b050d4c17447
        datastoreId: 5565fecc-a852-4799-83bf-f9423c0f7687
        collectionId: a3aaeeed-5210-4048-9ff0-d88fa0de4eda
        syncRequired: true
        owner: '870010733'
        createdBy: '870010733'
        createdOn: '2026-06-25T01:33:56.332Z'
        updatedOn: '2026-06-25T01:33:56.332Z'
        updatedBy: '870010733'
        content:
          name: Harry Potter
          house: Gryffindor
          wand:
            wood: holly
            core: phoenix feather
            length: 11
          courses:
            - Defense Against the Dark Arts
            - Potions
            - Transfiguration
          enrolledOn: '1991-09-01'
          lastDetention: '1994-06-08T20:00:00Z'
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: >-
            A plain-English explanation of the error. Present on some errors but
            not all.
        status:
          type: integer
          description: The HTTP error code
        statusReason:
          type: string
          description: >-
            A human-readable error message, sometimes including nested error
            detail
        toe:
          type: string
          description: >-
            Thread of Execution; a unique identifier that Support can use to
            find more info about your problem
      example:
        status: 404
        statusReason: 'DA0088: Invalid collection name: Students'
        toe: FTYRJMBLKD-5HB2Z-H6W8A

````