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

# Batch Upload Resources

> Uploads multiple resources via the event processor for asynchronous processing. This is more efficient for large batches of data. When upsert is enabled, new data is merged with existing data (PATCH-like behavior), preserving existing fields. Null values will explicitly delete the field (required fields cannot be deleted and will return a validation error). The batch ID can be used to retrieve the status of the batch using the /api/batches/:batchId endpoint. The maximum number of resources that can be uploaded in a single batch is 1000. If dependencyWaitTimeout is set to a value > 0, resources with missing dependencies (from schema definitions using $ref fields) will be stored in a pending state. The pending resources will be automatically processed once their dependencies become available. The pending resources will be deleted after the specified duration (dependencyWaitTimeout) if their dependencies are not available. The default value for dependencyWaitTimeout is 0, which means that resources with missing dependencies will be rejected immediately.



## OpenAPI

````yaml POST /api/resources/{schemaDefinitionNameOrId}/batch
openapi: 3.0.0
info:
  title: Reach API
  version: 1.0.0
  description: API documentation for Reach platform
servers:
  - url: https://api.embedreach.com
    description: Production server
security: []
paths:
  /api/resources/{schemaDefinitionNameOrId}/batch:
    post:
      tags:
        - Partner Resources
      summary: Batch Upload Resources
      description: >-
        Uploads multiple resources via the event processor for asynchronous
        processing. This is more efficient for large batches of data. When
        upsert is enabled, new data is merged with existing data (PATCH-like
        behavior), preserving existing fields. Null values will explicitly
        delete the field (required fields cannot be deleted and will return a
        validation error). The batch ID can be used to retrieve the status of
        the batch using the /api/batches/:batchId endpoint. The maximum number
        of resources that can be uploaded in a single batch is 1000. If
        dependencyWaitTimeout is set to a value > 0, resources with missing
        dependencies (from schema definitions using $ref fields) will be stored
        in a pending state. The pending resources will be automatically
        processed once their dependencies become available. The pending
        resources will be deleted after the specified duration
        (dependencyWaitTimeout) if their dependencies are not available. The
        default value for dependencyWaitTimeout is 0, which means that resources
        with missing dependencies will be rejected immediately.
      parameters:
        - name: reach-tenant-id
          in: header
          required: false
          schema:
            type: string
            description: >-
              If using a platform scoped JWT, you can pass in a header to
              impersonate a specific tenant to impersonate the request as.
        - schema:
            type: string
            description: The name or id of the schema definition to upload the resources to
          required: true
          description: The name or id of the schema definition to upload the resources to
          name: schemaDefinitionNameOrId
          in: path
        - schema:
            type: string
            enum:
              - upsert
              - reject
            default: upsert
            description: >-
              What to do if the resource already exists. upsert will merge new
              data with existing data (PATCH-like behavior), preserving existing
              fields not included in the request. Null values will delete
              fields. reject will throw an error if the resource already exists
          required: false
          description: >-
            What to do if the resource already exists. upsert will merge new
            data with existing data (PATCH-like behavior), preserving existing
            fields not included in the request. Null values will delete fields.
            reject will throw an error if the resource already exists
          name: onconflict
          in: query
        - schema:
            type: boolean
            nullable: true
            default: false
            description: >-
              Whether to allow extra fields that are not defined in the schema.
              If true, extra fields will be accepted but not saved. If false,
              requests with extra fields will be rejected.
          required: false
          description: >-
            Whether to allow extra fields that are not defined in the schema. If
            true, extra fields will be accepted but not saved. If false,
            requests with extra fields will be rejected.
          name: ignoreUnknownFields
          in: query
        - schema:
            type: integer
            nullable: true
            minimum: 0
            maximum: 86400
            default: 0
            description: >-
              Timeout in seconds for storing resources with missing dependencies
              as pending. Dependencies refer to resources referenced via $ref
              fields in the schema definition. If 0 or not provided, resources
              with missing dependencies will be rejected. If > 0, resources with
              missing dependencies will be stored in pending state for the
              specified duration. Maximum value is 86400 seconds (24 hours).
          required: false
          description: >-
            Timeout in seconds for storing resources with missing dependencies
            as pending. Dependencies refer to resources referenced via $ref
            fields in the schema definition. If 0 or not provided, resources
            with missing dependencies will be rejected. If > 0, resources with
            missing dependencies will be stored in pending state for the
            specified duration. Maximum value is 86400 seconds (24 hours).
          name: dependencyWaitTimeout
          in: query
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                resources:
                  type: array
                  items:
                    type: object
                    additionalProperties:
                      nullable: true
                  description: An array of resources to upload
              required:
                - resources
      responses:
        '202':
          description: Status 202 response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      batchId:
                        type: string
                        description: The batch ID for tracking the processing status
                      message:
                        type: string
                        description: Status message about the processing request
                      recordCount:
                        type: number
                        description: The number of records sent for processing
                      schemaDefinitionId:
                        type: string
                        description: The schema definition ID used for processing
                    required:
                      - batchId
                      - message
                      - recordCount
                      - schemaDefinitionId
                required:
                  - success
        '400':
          description: Bad Request - Validation or request error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                    default: false
                  message:
                    type: string
                    description: Error message describing what went wrong
                  errors:
                    type: array
                    items:
                      type: string
                    description: Optional array of specific validation errors
                required:
                  - message
        '404':
          description: Status 404 response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      error:
                        type: string
                    required:
                      - error
                required:
                  - success

````