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

# Batch Upload Sequences

> Create multiple sequences from an array of patient data rows. Maximum 100 rows per request.

## Overview

This endpoint creates multiple sequences from an array of patient data rows.

**Key details:**

* Maximum **100 rows** per request
* Each row requires `phoneNumber`, `firstName`, and `lastName`
* Additional fields are mapped to sequence inputs based on the definition's `inputs_definition`
* All row input fields must be in **camelCase** as per agent convention

## Validation Mode

Set `validate_only: true` to validate rows without creating sequences. This lets you preview errors and warnings before committing the upload.


## OpenAPI

````yaml POST /sequence-manager/sequences/batch
openapi: 3.0.1
info:
  title: Clarion API
  description: >-
    Clarion's public facing API. For more information, please visit
    https://docs.clarionhealth.com
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.clarionhealth.com/v1
security:
  - bearerAuth: []
paths:
  /sequence-manager/sequences/batch:
    post:
      description: >-
        Create multiple sequences from an array of patient data rows. Maximum
        100 rows per request.
      requestBody:
        description: Batch upload request
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchUploadRequest'
            example:
              sequence_definition_id: 123
              next_activity_date: '2024-01-15T10:00:00Z'
              rows:
                - phoneNumber: '+15551234567'
                  firstName: John
                  lastName: Doe
                  dateOfBirth: '1990-01-15'
                - phoneNumber: '+15559876543'
                  firstName: Jane
                  lastName: Smith
                  dateOfBirth: '1985-06-20'
              validate_only: false
      responses:
        '200':
          description: Batch upload result with validation status and any errors/warnings
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchUploadResponse'
              examples:
                success:
                  summary: Successful upload with no issues
                  value:
                    valid: true
                    total_attempted: 2
                    created_count: 2
                    created:
                      - rowIndex: 0
                        sequence_id: 100
                      - rowIndex: 1
                        sequence_id: 101
                    errors: []
                    warnings: []
                validation_only:
                  summary: 'Validation only mode (validate_only: true)'
                  description: >-
                    When validate_only is true, sequences are validated but not
                    created. Use this to preview errors before committing.
                  value:
                    valid: true
                    total_attempted: 2
                    created: []
                    errors: []
                    warnings: []
                with_errors_and_warnings:
                  summary: Response with errors and duplicate warning
                  description: >-
                    Shows an error for an invalid phone number and a warning for
                    duplicate phone numbers within the same batch
                  value:
                    valid: false
                    total_attempted: 3
                    valid_count: 1
                    created: []
                    errors:
                      - row_index: 0
                        error:
                          message: Phone number is invalid
                          type: invalid
                    warnings:
                      - row_index: 2
                        warning:
                          message: Duplicate phone number +15551234567 found at row 1
                          type: duplicate_in_batch
        '400':
          description: >-
            Bad request - invalid input (e.g., missing required fields,
            exceeding 100 row limit)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
components:
  schemas:
    BatchUploadRequest:
      type: object
      properties:
        sequence_definition_id:
          type: integer
          description: ID of the sequence definition to use
        next_activity_date:
          type: string
          format: date-time
          description: >-
            ISO 8601 date for when the first activity should be scheduled.
            Defaults to now if not provided.
        rows:
          type: array
          description: >-
            Patient data rows (max 100). Each row requires phoneNumber,
            firstName, and lastName, plus any additional fields defined in the
            sequence definition's inputs_definition. All row input fields must
            be in camelCase as per agent convention.
          maxItems: 100
          items:
            type: object
            properties:
              phoneNumber:
                type: string
                description: Patient phone number (required)
              firstName:
                type: string
                description: Patient first name (required)
              lastName:
                type: string
                description: Patient last name (required)
            required:
              - phoneNumber
              - firstName
              - lastName
            additionalProperties:
              description: Additional fields mapped to sequence inputs (must be camelCase)
        validate_only:
          type: boolean
          default: false
          description: If true, validate without creating sequences
      required:
        - sequence_definition_id
        - rows
    BatchUploadResponse:
      type: object
      properties:
        valid:
          type: boolean
          description: True if all rows passed validation (warnings don't affect this)
        total_attempted:
          type: integer
          description: Total rows in the request
        valid_count:
          type: integer
          description: Rows that passed validation
        created_count:
          type: integer
          description: Sequences created (0 if validate_only was true)
        created:
          type: array
          description: Created sequence identifiers
          items:
            type: object
            properties:
              row_index:
                type: integer
                description: 0-based row index that corresponds to the row in the request
              sequence_id:
                type: integer
                description: The unique identifier for the created sequence
        errors:
          type: array
          description: Validation errors (rows with errors are not created)
          items:
            type: object
            properties:
              row_index:
                type: integer
                description: 0-based row index
              error:
                type: object
                properties:
                  message:
                    type: string
                  type:
                    type: string
                    enum:
                      - ineligible
                      - invalid
                      - other
        warnings:
          type: array
          description: Warnings (rows with warnings can still be created)
          items:
            type: object
            properties:
              row_index:
                type: integer
                description: 0-based row index
              warning:
                type: object
                properties:
                  message:
                    type: string
                  type:
                    type: string
                    enum:
                      - duplicate_in_batch
                    description: Same phone number appears multiple times in the batch
      example:
        valid: false
        total_attempted: 3
        valid_count: 1
        created_count: 0
        created: []
        errors:
          - row_index: 0
            error:
              message: Phone number is invalid
              type: invalid
        warnings:
          - row_index: 2
            warning:
              message: Duplicate phone number +15551234567 found at row 1
              type: duplicate_in_batch
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````