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

# Subscribe a batch of addresses

> Up to 1,000 subscribers in one call. Up to 100, the work happens at once and the answer reports line by line (200). Past that, the batch goes to the background like an import and the answer is an import to follow (202). One line in error does not lose the others.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/lists/{list}/subscribers/batch
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}/subscribers/batch:
    post:
      tags:
        - Subscribers
      summary: Subscribe a batch of addresses
      description: >-
        Up to 1,000 subscribers in one call. Up to 100, the work happens at once
        and the answer reports line by line (200). Past that, the batch goes to
        the background like an import and the answer is an import to follow
        (202). One line in error does not lose the others.
      operationId: api.subscribers.batch
      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:
          application/json:
            schema:
              type: object
              required:
                - subscribers
              properties:
                subscribers:
                  type: array
                  minItems: 1
                  maxItems: 1000
                  items:
                    $ref: '#/components/schemas/SubscriberInput'
                skip_confirmation:
                  type: boolean
                  default: false
                replace_tags:
                  type: boolean
                  default: false
                  description: Replaces the tags instead of adding them.
            example:
              subscribers:
                - email: ada@example.com
                  tags:
                    - client
                - email: alan@example.com
                  locale: en
      responses:
        '200':
          description: Batch handled at once.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        index:
                          type: integer
                        email:
                          type: string
                        id:
                          type: string
                        outcome:
                          type: string
                          enum:
                            - subscribed
                            - pending
                            - already_subscribed
                            - skipped_unsubscribed
                            - failed
                        message:
                          type: string
                          description: There when outcome is failed.
                  meta:
                    type: object
                    properties:
                      added:
                        type: integer
                      updated:
                        type: integer
                      failed:
                        type: integer
              example:
                data:
                  - index: 0
                    email: ada@example.com
                    id: 9d5c2a1e-8f3b-4c7a-9e21-3b8f0c6d4a12
                    outcome: subscribed
                  - index: 1
                    email: alan@example.com
                    outcome: failed
                    message: This address is blocked.
                meta:
                  added: 1
                  updated: 0
                  failed: 1
        '202':
          description: A batch of more than 100 lines, handed to the queue.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Import'
                  meta:
                    type: object
                    properties:
                      queued:
                        type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          description: Invalid data, or every line failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '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:
    SubscriberInput:
      type: object
      required:
        - email
      properties:
        email:
          type: string
          format: email
          maxLength: 255
        first_name:
          type:
            - string
            - 'null'
          maxLength: 255
        last_name:
          type:
            - string
            - 'null'
          maxLength: 255
        timezone:
          type:
            - string
            - 'null'
          description: A valid IANA time zone.
        locale:
          type:
            - string
            - 'null'
          description: An ISO 639-1 code, with an optional region (fr, en, pt-BR).
        attributes:
          type: object
          additionalProperties: true
          description: Merged with the attributes already there.
        tags:
          type: array
          items:
            type: string
            maxLength: 255
          description: Added to the subscriber's own; an unknown tag is created.
    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.
    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
    Message:
      type: object
      properties:
        message:
          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'
    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.

````