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

# Bulk Upsert Documents

> Insert or update multiple documents in a single request. Documents with a matching `id` are updated; documents without a matching `id` are created. Each document is limited to 2 MB.



## OpenAPI

````yaml /openapi/product/appdb.yaml put /api/datastores/v2/collections/{collectionId}/documents/bulk
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/v2/collections/{collectionId}/documents/bulk:
    put:
      tags:
        - App DB API (Product)
      summary: Bulk Upsert Documents
      description: >-
        Insert or update multiple documents in a single request. Documents with
        a matching `id` are updated; documents without a matching `id` are
        created. Each document is limited to 2 MB.
      parameters:
        - name: collectionId
          in: path
          required: true
          schema:
            type: string
          description: The ID of the collection.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    description: Document ID to update. Omit to create a new document.
                  content:
                    type: object
                    additionalProperties: true
                    description: Arbitrary JSON content of the document.
            example:
              - id: a8428d64-a01d-49b2-9144-ddeec001acf8
                content:
                  campaignName: Q2 Campaign
                  region: West
                  status: Inactive
              - content:
                  campaignName: New Campaign
                  region: North
                  status: Active
      responses:
        '200':
          description: Returns the number of updated and created documents.
          content:
            application/json:
              schema:
                type: object
                properties:
                  Updated:
                    type: integer
                    description: Number of documents updated.
                  Created:
                    type: integer
                    description: Number of documents created.
              example:
                Updated: 1
                Created: 1
        '404':
          $ref: '#/components/responses/CollectionNotFound'
components:
  responses:
    CollectionNotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            message: >-
              Cannot find permission from source [USER:870010733] to target
              [MAGNUM_COLLECTION:a3f7d891-bc24-4e56-9a12-c7e3b0f845d2].
              Permission Service reports that one or both does not exist
            status: 404
            statusReason: Not Found
            toe: RG3808D5LS-DHKE4-TG5EB
  schemas:
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: A human-readable error message.
        status:
          type: integer
          description: HTTP status code.
        statusReason:
          type: string
          description: HTTP status reason phrase.
        toe:
          type: string
          description: Trace identifier for support; stands for Thread of Execution.
  securitySchemes:
    developerToken:
      type: apiKey
      in: header
      name: X-DOMO-Developer-Token
      description: Domo Developer Token for authentication.

````