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

# Send a transactional e-mail

> Sends from a transactional template (`template`) or from HTML you supply (`html`). The e-mail is logged, followed (opens and clicks when the template asks for it) and counted against the allowance. Without `to`, the template's default recipients are used.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/transactional-mails/send
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/transactional-mails/send:
    post:
      tags:
        - Transactional e-mails
      summary: Send a transactional e-mail
      description: >-
        Sends from a transactional template (`template`) or from HTML you supply
        (`html`). The e-mail is logged, followed (opens and clicks when the
        template asks for it) and counted against the allowance. Without `to`,
        the template's default recipients are used.
      operationId: api.transactional.send
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                template:
                  type:
                    - string
                    - 'null'
                  description: The name of one of the team's transactional templates.
                html:
                  type:
                    - string
                    - 'null'
                  description: The HTML body, when no template is given.
                subject:
                  type:
                    - string
                    - 'null'
                  description: Replaces the template's subject.
                to:
                  type: array
                  items:
                    type: string
                    format: email
                cc:
                  type: array
                  items:
                    type: string
                    format: email
                bcc:
                  type: array
                  items:
                    type: string
                    format: email
                variables:
                  type: object
                  additionalProperties: true
                  description: 'They fill the template: {{ order.number }}, {% for %} loops…'
                locale:
                  type:
                    - string
                    - 'null'
                  description: >-
                    Which language version of the template to send (fr, pt-BR…).
                    Without a value, the base version.
                from_email:
                  type:
                    - string
                    - 'null'
                  format: email
                from_name:
                  type:
                    - string
                    - 'null'
                reply_to:
                  type:
                    - string
                    - 'null'
                  format: email
                mailer:
                  type:
                    - string
                    - 'null'
                  description: The name of a configured provider, to force that one.
                attachments:
                  type: array
                  maxItems: 10
                  items:
                    type: object
                    required:
                      - name
                      - content
                    properties:
                      name:
                        type: string
                      content:
                        type: string
                        format: byte
                        description: Content encoded in base64.
                      mime:
                        type: string
                        example: application/pdf
            example:
              template: confirmation-commande
              to:
                - ada@example.com
              locale: fr
              variables:
                customer:
                  name: Ada
                order:
                  number: A-1024
                  lines:
                    - Pain au levain
                    - Brioche
      responses:
        '201':
          description: E-mail sent.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/TransactionalMail'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: >-
            Invalid data, unknown template, neither template nor HTML, no
            recipient, or a sender that is not allowed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '502':
          description: >-
            The provider refused to send it; the e-mail is logged with the
            reason.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/TransactionalMail'
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:
    TransactionalMail:
      type: object
      properties:
        id:
          type: string
          format: uuid
        template:
          type:
            - string
            - 'null'
          description: The name of the template used, when there is one.
        subject:
          type: string
        from:
          type: string
          format: email
        to:
          type: array
          items:
            type: string
            format: email
        cc:
          type: array
          items:
            type: string
            format: email
        bcc:
          type: array
          items:
            type: string
            format: email
        status:
          type: string
          enum:
            - pending
            - sent
            - failed
        failure_reason:
          type:
            - string
            - 'null'
        opens:
          type: integer
        clicks:
          type: integer
        sent_at:
          type:
            - string
            - 'null'
          format: date-time
        created_at:
          type: string
          format: date-time
    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'
    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.

````