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

# Initialize load

> Initialize a new load for a stream with optional record IDs.



## OpenAPI

````yaml /generated/openapi-import-generated-2023-12-01.json post /import/streams/{stream_id}/load
openapi: 3.1.0
info:
  title: Prequel Data Import
  description: Data Import API spec
  version: '2023-12-01'
servers:
  - url: https://api.prequel.co
    description: Cloud-hosted server (US)
  - url: https://eu-api.prequel.co
    description: Cloud-hosted server (EU)
  - url: https://{custom_host}
    description: Self-hosted Prequel API host
security:
  - ApiKeyAuth: []
paths:
  /import/streams/{stream_id}/load:
    post:
      tags:
        - Streams
      summary: Initialize load
      description: Initialize a new load for a stream with optional record IDs.
      operationId: initialize-load
      parameters:
        - name: stream_id
          in: path
          required: true
          description: Import Stream ID.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InitializeLoadRequest'
              $schema: https://json-schema.org/draft/2020-12/schema
              $id: >-
                https://github.com/prequel-co/datafeed/internal/import/api/models/initialize-load-request
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                properties:
                  status:
                    type: string
                    const: success
                  data:
                    $ref: '#/components/schemas/InitializeLoadResponse'
                    $schema: https://json-schema.org/draft/2020-12/schema
                    $id: >-
                      https://github.com/prequel-co/datafeed/internal/import/api/models/initialize-load-response
                  message:
                    type: string
                type: object
                required:
                  - status
                  - data
                  - message
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    InitializeLoadRequest:
      properties:
        filter:
          $ref: '#/components/schemas/LoadFilterOptions'
          title: Filter
      additionalProperties: false
      type: object
    InitializeLoadResponse:
      properties:
        load:
          $ref: '#/components/schemas/LoadResource'
      additionalProperties: false
      type: object
      required:
        - load
    LoadFilterOptions:
      oneOf:
        - $ref: '#/components/schemas/LoadFilterOptionsLastModified'
        - $ref: '#/components/schemas/LoadFilterOptionsExtractTimestamp'
        - $ref: '#/components/schemas/LoadFilterOptionsRecords'
      discriminator:
        mapping:
          extract_timestamp:
            $ref: '#/components/schemas/LoadFilterOptionsExtractTimestamp'
          last_modified:
            $ref: '#/components/schemas/LoadFilterOptionsLastModified'
          records:
            $ref: '#/components/schemas/LoadFilterOptionsRecords'
        propertyName: type
    LoadResource:
      properties:
        id:
          type: string
        stream_id:
          type: string
        submitted_at:
          type: string
        started_at:
          type: string
        ended_at:
          type: string
        records_processed:
          type: integer
        records_transformed:
          type: integer
        records_valid:
          type: integer
        records_loaded:
          type: integer
        records_errored:
          type: integer
        error:
          $ref: '#/components/schemas/ErrorResource'
        record_ids:
          items:
            type: string
          type: array
        actor_id:
          type: string
        actor_type:
          type: string
      additionalProperties: false
      type: object
      required:
        - id
        - stream_id
        - submitted_at
        - actor_id
        - actor_type
    ErrorResponse:
      properties:
        status:
          type: string
          const: error
        message:
          type: string
        data:
          type: 'null'
      type: object
      required:
        - status
        - message
    LoadFilterOptionsLastModified:
      properties:
        type:
          type: string
          enum:
            - last_modified
        last_modified:
          $ref: '#/components/schemas/LastModifiedFilter'
      type: object
      required:
        - type
        - last_modified
      title: Last Modified
      unevaluatedProperties: false
    LoadFilterOptionsExtractTimestamp:
      properties:
        type:
          type: string
          enum:
            - extract_timestamp
        extract_timestamp:
          $ref: '#/components/schemas/ExtractTimestampFilter'
      type: object
      required:
        - type
        - extract_timestamp
      title: Extract Timestamp
      unevaluatedProperties: false
    LoadFilterOptionsRecords:
      properties:
        type:
          type: string
          enum:
            - records
        records:
          $ref: '#/components/schemas/RecordsFilter'
      type: object
      required:
        - type
        - records
      title: Records
      unevaluatedProperties: false
    ErrorResource:
      properties:
        error_code:
          type: string
        title:
          type: string
        blame:
          type: string
        documentation_url:
          type: string
        trace:
          type: string
        message:
          type: string
      additionalProperties: false
      type: object
      required:
        - error_code
        - title
        - blame
        - documentation_url
        - trace
        - message
    LastModifiedFilter:
      properties:
        start:
          type: string
          format: date-time
          title: Start bounds
        end:
          type: string
          format: date-time
          title: End bounds
      additionalProperties: false
      type: object
    ExtractTimestampFilter:
      properties:
        start:
          type: string
          format: date-time
        end:
          type: string
          format: date-time
      additionalProperties: false
      type: object
    RecordsFilter:
      properties:
        record_ids:
          items:
            type: string
          type: array
          maxItems: 100
          minItems: 1
          title: Record IDs
      additionalProperties: false
      type: object
      required:
        - record_ids
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````