> ## Documentation Index
> Fetch the complete documentation index at: https://sure-917046f5-mintlify-docs-update-1787366041488.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload import session chunk

> Attach an ordered Sure NDJSON chunk to an import session. Chunks are idempotent by sequence and client_chunk_id with content verification.



## OpenAPI

````yaml /openapi.yaml post /api/v1/import_sessions/{id}/chunks
openapi: 3.0.3
info:
  title: Sure API
  version: v1
  description: OpenAPI documentation generated from executable request specs.
servers:
  - url: https://app.sure.am
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
paths:
  /api/v1/import_sessions/{id}/chunks:
    parameters:
      - name: id
        in: path
        required: true
        description: Import session ID
        schema:
          type: string
    post:
      tags:
        - Import Sessions
      summary: Upload import session chunk
      description: >-
        Attach an ordered Sure NDJSON chunk to an import session. Chunks are
        idempotent by sequence and client_chunk_id with content verification.
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - sequence
                - raw_file_content
              properties:
                sequence:
                  type: integer
                  minimum: 1
                  description: >-
                    One-based chunk sequence. Earlier dependency chunks must
                    have lower sequence numbers.
                client_chunk_id:
                  type: string
                  nullable: true
                  description: Client-provided idempotency key for this chunk.
                raw_file_content:
                  type: string
                  description: Raw Sure NDJSON content. Each chunk is limited to 10MB.
          multipart/form-data:
            schema:
              type: object
              required:
                - sequence
                - file
              properties:
                sequence:
                  type: integer
                  minimum: 1
                  description: >-
                    One-based chunk sequence. Earlier dependency chunks must
                    have lower sequence numbers.
                client_chunk_id:
                  type: string
                  nullable: true
                  description: Client-provided idempotency key for this chunk.
                file:
                  type: string
                  format: binary
                  description: >-
                    Multipart Sure NDJSON file upload. Each chunk is limited to
                    10MB.
      responses:
        '201':
          description: chunk uploaded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImportSessionResponse'
        '401':
          description: unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: insufficient scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: import session not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: chunk conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: missing or invalid content
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - apiKeyAuth: []
components:
  schemas:
    ImportSessionResponse:
      type: object
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/ImportSession'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        message:
          type: string
          nullable: true
        details:
          oneOf:
            - type: array
              items:
                type: string
            - type: object
          nullable: true
        errors:
          type: array
          items:
            type: string
          nullable: true
          description: >-
            Validation error messages (alternative to details used by trades,
            valuations, etc.)
    ImportSession:
      type: object
      required:
        - id
        - type
        - status
        - chunks_count
        - summary
        - chunks
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        type:
          type: string
          enum:
            - SureImport
        status:
          type: string
          enum:
            - pending
            - importing
            - complete
            - failed
        client_session_id:
          type: string
          nullable: true
        expected_chunks:
          type: integer
          nullable: true
          minimum: 1
        chunks_count:
          type: integer
          minimum: 0
        summary:
          type: object
          additionalProperties:
            type: object
            additionalProperties:
              type: integer
        error:
          type: object
          additionalProperties: true
          nullable: true
        chunks:
          type: array
          items:
            $ref: '#/components/schemas/ImportSessionChunk'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    ImportSessionChunk:
      type: object
      required:
        - id
        - sequence
        - status
        - rows_count
        - summary
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        sequence:
          type: integer
          minimum: 1
        client_chunk_id:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - pending
            - importing
            - complete
            - failed
        rows_count:
          type: integer
          minimum: 0
        summary:
          type: object
          additionalProperties:
            type: object
            additionalProperties:
              type: integer
        error:
          type: object
          additionalProperties: true
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      name: X-Api-Key
      in: header
      description: API key for authentication. Generate one from your account settings.

````