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

# Create import stream

> Add a new import stream.



## OpenAPI

````yaml /generated/openapi-import-generated-2023-12-01.json post /import/streams
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:
    post:
      tags:
        - Import Streams
      summary: Create import stream
      description: Add a new import stream.
      operationId: create-import-stream
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateStreamRequest'
              $schema: https://json-schema.org/draft/2020-12/schema
              $id: >-
                https://github.com/prequel-co/datafeed/internal/import/api/models/create-stream-request
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                properties:
                  status:
                    type: string
                    const: success
                  data:
                    $ref: '#/components/schemas/GetStreamResponse'
                    $schema: https://json-schema.org/draft/2020-12/schema
                    $id: >-
                      https://github.com/prequel-co/datafeed/internal/import/api/models/get-stream-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:
    CreateStreamRequest:
      properties:
        stream:
          $ref: '#/components/schemas/StreamOptions'
      additionalProperties: false
      type: object
      required:
        - stream
    GetStreamResponse:
      properties:
        stream:
          $ref: '#/components/schemas/StreamResource'
      additionalProperties: false
      type: object
      required:
        - stream
    StreamOptions:
      properties:
        name:
          type: string
          title: Name
          description: Name for this stream.
        is_enabled:
          type: boolean
          title: Is Enabled
          description: Whether this stream is enabled.
          default: false
        destination_id:
          type: string
          format: uuid
          title: Destination ID
          description: The ID of the destination this stream connects to.
        dataset_id:
          type: string
          format: uuid
          title: Dataset ID
          description: The ID of the dataset this stream uses as source.
        mappings:
          items:
            $ref: '#/components/schemas/MappingOptions'
          type: array
          title: Mappings
          description: Field mappings for this stream.
      additionalProperties: false
      type: object
      required:
        - name
        - destination_id
        - dataset_id
        - mappings
    StreamResource:
      properties:
        id:
          type: string
        name:
          type: string
        is_enabled:
          type: boolean
        destination_id:
          type: string
        dataset_id:
          type: string
        mappings:
          items:
            $ref: '#/components/schemas/MappingResource'
          type: array
        created_at:
          type: string
        updated_at:
          type: string
      additionalProperties: false
      type: object
      required:
        - id
        - name
        - is_enabled
        - destination_id
        - dataset_id
        - mappings
        - created_at
        - updated_at
    ErrorResponse:
      properties:
        status:
          type: string
          const: error
        message:
          type: string
        data:
          type: 'null'
      type: object
      required:
        - status
        - message
    MappingOptions:
      properties:
        field_type:
          type: string
          title: Field Type
          description: Type of field mapping (field or expression).
        column:
          additionalProperties:
            type: string
          type: object
          title: Column
          description: Column reference for field type mappings.
        expression:
          additionalProperties:
            type: string
          type: object
          title: Expression
          description: Configuration for expression field mappings.
        target_field:
          type: string
          title: Target Field
          description: The target field name in the destination.
      additionalProperties: false
      type: object
      required:
        - field_type
        - target_field
    MappingResource:
      properties:
        field_type:
          type: string
        column:
          additionalProperties:
            type: string
          type: object
        expression:
          additionalProperties:
            type: string
          type: object
        target_field:
          type: string
      additionalProperties: false
      type: object
      required:
        - field_type
        - target_field
  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

````