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

# Import a file

> A CSV, TXT or XLSX file of 20 MB at most, with a header row. Without `mapping`, columns are recognised by their headers (email, first name, last name, tags, time zone, language…). One column must hold the e-mail address. The work happens in the background: follow the import in the answer.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/lists/{list}/imports
openapi: 3.1.0
info:
  title: Lekalao API
  version: 1.0.0
  description: >-
    Everything the interface does, your application can do too. Every call
    carries an API token (Settings → API tokens).
servers:
  - url: https://{host}
    description: Your installation
    variables:
      host:
        default: lekalao.example.com
        description: The domain of your own Lekalao
security:
  - bearer: []
tags:
  - name: Lists
  - name: Subscribers
  - name: Tags
  - name: Segments
  - name: Imports
  - name: Templates
  - name: Campaigns
  - name: Automations
  - name: Transactional e-mails
  - name: Revenue
  - name: Platform
paths:
  /api/v1/lists/{list}/imports:
    post:
      tags:
        - Imports
      summary: Import a file
      description: >-
        A CSV, TXT or XLSX file of 20 MB at most, with a header row. Without
        `mapping`, columns are recognised by their headers (email, first name,
        last name, tags, time zone, language…). One column must hold the e-mail
        address. The work happens in the background: follow the import in the
        answer.
      operationId: api.imports.store
      parameters:
        - name: list
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: The list's identifier (uuid).
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                mapping:
                  type: object
                  additionalProperties:
                    type: string
                  description: >-
                    Column header => email, first_name, last_name, tags,
                    timezone, locale, ignore, or attribute:name.
                tags:
                  type: array
                  maxItems: 20
                  items:
                    type: string
                  description: Given to every line.
                replace_tags:
                  type: boolean
                resubscribe_unsubscribed:
                  type: boolean
                  description: >-
                    Subscribes again the people in the file who had
                    unsubscribed.
      responses:
        '202':
          description: Import accepted and queued.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Import'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
        maxLength: 255
      description: >-
        Replay a write safely: the same key gives back the first answer for 24
        hours (header Idempotent-Replay: true).
  schemas:
    Import:
      type: object
      properties:
        id:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - draft
            - pending
            - processing
            - completed
            - failed
        file_name:
          type: string
        processed:
          type: integer
          description: Lines read.
        added:
          type: integer
        updated:
          type: integer
        failed:
          type: integer
        errors:
          type: array
          items:
            type: object
          description: The detail of the lines that were refused.
        created_at:
          type: string
          format: date-time
        finished_at:
          type:
            - string
            - 'null'
          format: date-time
        url:
          type: string
          format: uri
          description: Where to follow the progress.
    Message:
      type: object
      properties:
        message:
          type: string
    ValidationError:
      type: object
      properties:
        message:
          type: string
          example: The email field must be a valid email address.
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
  responses:
    Unauthenticated:
      description: No token, or an invalid or revoked one.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Message'
          example:
            message: Unauthenticated.
    Forbidden:
      description: The token lacks the ability needed, or the team is suspended.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Message'
    NotFound:
      description: Nothing of that uuid in the token's team.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Message'
    ValidationFailed:
      description: Invalid data.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
    TooManyRequests:
      description: >-
        The token's limit is reached. Wait the number of seconds Retry-After
        gives.
      headers:
        X-RateLimit-Limit:
          schema:
            type: integer
          description: Calls allowed per minute for this token.
        X-RateLimit-Remaining:
          schema:
            type: integer
        Retry-After:
          schema:
            type: integer
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: >-
        An API token. The "read" ability: GET routes only. "read + write": every
        route.

````