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

# Enviar email

> Envia um email transacional via Amazon SES. Suporta texto simples, HTML, múltiplos destinatários, CC/BCC, reply-to e anexos referenciados por chave S3 (ver `POST /attachments/presign`).



## OpenAPI

````yaml /openapi.json post /emails
openapi: 3.0.3
info:
  title: Sendaki Transactional API
  description: >-
    API transacional do Sendaki — envia emails e gere anexos a partir da tua
    aplicação. Autenticada por API key. Domínios de envio são geridos no
    workspace (app.sendaki.tech), não por esta API.
  version: 1.0.0
servers:
  - url: https://awsapi.sendaki.tech
    description: Produção
security:
  - apiKey: []
tags:
  - name: Emails
    description: Envia emails transacionais.
  - name: Attachments
    description: Upload e download de ficheiros anexados aos emails.
paths:
  /emails:
    post:
      tags:
        - Emails
      summary: Enviar email
      description: >-
        Envia um email transacional via Amazon SES. Suporta texto simples, HTML,
        múltiplos destinatários, CC/BCC, reply-to e anexos referenciados por
        chave S3 (ver `POST /attachments/presign`).
      operationId: sendEmail
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendEmailRequest'
            examples:
              simples:
                summary: Email de texto simples
                value:
                  from: hello@saviamaria.me
                  to:
                    - destinatario@example.com
                  subject: Olá!
                  body:
                    text: Olá! Isto é um email de texto simples.
              html:
                summary: Email com HTML e texto (recomendado)
                value:
                  from: hello@saviamaria.me
                  to:
                    - destinatario@example.com
                  subject: Olá!
                  body:
                    html: <h1>Olá!</h1><p>Isto é um email em HTML.</p>
                    text: Olá! Isto é um email de texto simples.
              com_display_name:
                summary: Com nome de exibição e reply-to
                value:
                  from: noreply@saviamaria.me
                  from_name: Sávia Maria
                  to:
                    - cliente@example.com
                  reply_to:
                    - suporte@saviamaria.me
                  subject: Confirmação de encomenda
                  body:
                    html: <p>A sua encomenda foi confirmada.</p>
                    text: A sua encomenda foi confirmada.
              com_anexo:
                summary: Com anexo
                value:
                  from: hello@saviamaria.me
                  to:
                    - cliente@example.com
                  subject: 'Fatura #001'
                  body:
                    html: <p>Segue em anexo a sua fatura.</p>
                    text: Segue em anexo a sua fatura.
                  attachments:
                    - filename: fatura-001.pdf
                      key: attachments/org123/1778360121432-fatura-001.pdf
                      content_type: application/pdf
      responses:
        '201':
          description: Email enviado com sucesso
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendEmailResponse'
              examples:
                sem_anexos:
                  summary: Sem anexos
                  value:
                    message_id: >-
                      0100019e0a483464-9b289638-9a1b-4bc2-826b-4841a416a8ab-000000
                    from: hello@saviamaria.me
                    to:
                      - destinatario@example.com
                    subject: Olá!
                    attachments: []
                com_anexos:
                  summary: Com anexos
                  value:
                    message_id: >-
                      0100019e0eafdab4-e6ced2d9-6f0e-427f-8636-3b85372e08af-000000
                    from: hello@saviamaria.me
                    to:
                      - cliente@example.com
                    subject: 'Fatura #001'
                    attachments:
                      - attachments/org123/1778360121432-fatura-001.pdf
        '400':
          description: Campos obrigatórios em falta ou inválidos
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: string
              example:
                errors:
                  - from é obrigatório
                  - to é obrigatório
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: >-
            Email rejeitado pelo SES — domínio do from não verificado, ou (em
            Sandbox) destinatário não verificado
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
              example:
                error: Domínio não verificado
        '500':
          $ref: '#/components/responses/ServerError'
        '503':
          description: Envio pausado pelo SES
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
              example:
                error: Envio pausado
components:
  schemas:
    SendEmailRequest:
      type: object
      required:
        - from
        - to
        - subject
        - body
      properties:
        from:
          type: string
          format: email
          description: >-
            Endereço de envio — tem de pertencer a um domínio verificado no
            workspace (app.sendaki.tech → Settings → Domains).
        from_name:
          type: string
          description: >-
            Nome de exibição do remetente. Recomendado — melhora a
            entregabilidade no Gmail.
        to:
          type: array
          items:
            type: string
            format: email
          minItems: 1
          description: Lista de destinatários.
        cc:
          type: array
          items:
            type: string
            format: email
          description: Destinatários em cópia.
        bcc:
          type: array
          items:
            type: string
            format: email
          description: Destinatários em cópia oculta.
        reply_to:
          type: array
          items:
            type: string
            format: email
          description: Endereço(s) para onde vai a resposta.
        subject:
          type: string
          description: Assunto do email.
        body:
          $ref: '#/components/schemas/EmailBody'
        attachments:
          type: array
          items:
            $ref: '#/components/schemas/EmailAttachment'
          description: Ficheiros já uploaded via POST /attachments/presign.
    SendEmailResponse:
      type: object
      properties:
        message_id:
          type: string
        from:
          type: string
        to:
          type: array
          items:
            type: string
        subject:
          type: string
        attachments:
          type: array
          items:
            type: string
    ErrorMessage:
      type: object
      properties:
        error:
          type: string
    EmailBody:
      type: object
      description: Tem de incluir html e/ou text.
      properties:
        html:
          type: string
          description: Versão HTML do email.
        text:
          type: string
          description: Versão em texto simples do email.
    EmailAttachment:
      type: object
      required:
        - filename
        - key
      properties:
        filename:
          type: string
          description: Nome do ficheiro tal como aparece no email.
        key:
          type: string
          description: Key do ficheiro no S3, devolvida por POST /attachments/presign.
        content_type:
          type: string
          description: 'MIME type do ficheiro, ex: application/pdf.'
  responses:
    Unauthorized:
      description: API key em falta ou inválida
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
          example:
            message: Unauthorized
    ServerError:
      description: Erro interno do servidor
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
          example:
            error: mensagem do erro
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: API key gerada em app.sendaki.tech → Settings → API Keys.

````