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

# Replace Document

> Replaces an existing document in a collection — the entire `content` object is overwritten with whatever you send. To update individual fields without replacing the whole document, use Partially Update Documents instead.



## OpenAPI

````yaml /openapi/framework/appdb.yaml put /domo/datastores/v2/collections/{collectionName}/documents/{documentId}
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/{documentId}:
    put:
      tags:
        - AppDB API
      summary: Replace Document
      description: >-
        Replaces an existing document in a collection — the entire `content`
        object is overwritten with whatever you send. To update individual
        fields without replacing the whole document, use Partially Update
        Documents instead.
      parameters:
        - $ref: '#/components/parameters/CollectionName'
        - $ref: '#/components/parameters/DocumentId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentUpdate'
            example:
              content:
                name: Harry Potter
                house: Gryffindor
                wand:
                  wood: holly
                  core: phoenix feather
                  length: 11
                courses:
                  - Defense Against the Dark Arts
                  - Potions
                  - Transfiguration
                prefect: false
                enrolledOn: '1991-09-01'
                lastDetention: '1994-06-08T20:00:00Z'
      responses:
        '200':
          description: Document updated successfully. Returns the full updated document.
          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-08-01T09:14:23.209Z'
                updatedBy: '540824222'
                content:
                  name: Harry Potter
                  house: Gryffindor
                  wand:
                    wood: holly
                    core: phoenix feather
                    length: 11
                  courses:
                    - Defense Against the Dark Arts
                    - Potions
                    - Transfiguration
                  prefect: false
                  enrolledOn: '1991-09-01'
                  lastDetention: '1994-06-08T20:00:00Z'
        '403':
          description: >-
            Forbidden. The user does not have the UPDATE_CONTENT permission on
            this collection.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: 403
                statusReason: >-
                  status 403 reading
                  DocumentsResourceClient#updateDocument(UUID,UUID,DocumentDefinition)
                toe: BU22GXWMDI-ILY50-5YX28
        '404':
          description: Document not found. Verify the document ID is correct.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: 404
                statusReason: >-
                  status 404 reading
                  DocumentsResourceClient#getDocument(UUID,UUID);
                  content:{"message":"Document with id
                  '0599350c-6fdc-41fc-a2ff-c56b78b1a0cf' not
                  found","status":404,"statusReason":"Not Found"}
                toe: HVJA1FVUF6-BCB2D-SYWOO
      x-codeSamples:
        - lang: JavaScript
          label: domo.js
          source: >-
            const collectionName = 'Students';

            const documentId = '402778f6-bc8d-4aa5-a581-e08e3fc98c05';


            // PUT replaces the entire document — include all fields, not just
            the ones changing.

            domo.put(`/domo/datastores/v2/collections/${collectionName}/documents/${documentId}`,
            {
              content: {
                name: 'Harry Potter',
                house: 'Gryffindor',
                wand: { wood: 'holly', core: 'phoenix feather', length: 11 },
                courses: ['Defense Against the Dark Arts', 'Potions', 'Transfiguration'],
                prefect: false
              }
            }).then(doc => console.log(doc));
        - lang: JavaScript
          label: domo.js v6
          source: >-
            // domo.js v6

            const collectionName = 'Students';

            const documentId = '402778f6-bc8d-4aa5-a581-e08e3fc98c05';


            // update auto-wraps content — pass content fields directly.

            // this replaces the entire document — include all fields, not just
            the ones changing.

            const doc = await domo.appdb.update(collectionName, documentId, {
              name: 'Harry Potter',
              house: 'Gryffindor',
              wand: { wood: 'holly', core: 'phoenix feather', length: 11 },
              courses: ['Defense Against the Dark Arts', 'Potions', 'Transfiguration'],
              prefect: false
            });

            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
    DocumentId:
      name: documentId
      in: path
      required: true
      description: The UUID of the document.
      schema:
        type: string
        format: uuid
  schemas:
    DocumentUpdate:
      type: object
      required:
        - content
      properties:
        content:
          type: object
          additionalProperties: true
          description: Updated document content
    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

````