---
title: "Отправка письма через ключ"
method: POST
path: "/v1/external-mails/send/{key_id}"
tags: ["Транзакционная почта"]
---

# Отправка письма через ключ

`POST /v1/external-mails/send/{key_id}`

## Request

- Base URL: `https://api.rusender.ru/api`
- URL: `https://api.rusender.ru/api/v1/external-mails/send/{key_id}`
- Auth: HTTP bearer

Публичный endpoint отправки транзакционного письма через указанный key_id с Bearer token Public API.

## Path parameters

- `key_id` integer, required

## Headers

- `Idempotency-Key` string

## Request body

- ReceivedExternalMailDataDTO
  - `mail` ReceivedExternalMailDTO, required
    - `to` EmailContactTypeDto, required
      - `email` string, email, required
      - `name` string
    - `from` EmailContactTypeDto, required
      - `email` string, email, required
      - `name` string
    - `subject` string, required
    - `previewTitle` string
    - `headers` object
    - `cc` string
    - `bcc` string
    - `attachments` ReceivedExternalMailAttachmentsDto[]
    - `html` string: HTML content of the email. At least one of html or text must be provided.
    - `text` string: Plain text content of the email. At least one of html or text must be provided.
  - `idempotencyKey` string

## Response `200`

Письмо принято в обработку.

- ExternalMailSendResponseDTO
  - `uuid` string, uuid, required
  - `additionalRecipients` union[]: List of additional recipients or errors
    - union
      - AdditionalRecipientUUID
        - `uuid` string, uuid, required
      - AdditionalRecipientError
        - `error` string, required
  - `warning` string, nullable, required

## Other responses

- `400`: Request body validation failed, or attachments could not be processed (parse error, forbidden file type, or total size over the limit).
- `401`: Provided API token is invalid.
- `402`: Is not enough resource on user balance
- `403`: Required scope `external_mail.send` is missing, the sending key is not accessible, or the key is not active.
- `404`: The specified sending key or sender domain was not found.
- `422`: "Email receiver unsubscribed from this API key mails" or "Email receiver unavailable" or "Email receiver doesn't exist" or "Email receiver complained from this API key mails"
- `429`: Too many requests. Please retry later.
- `503`: Service unavailable

---

[API](https://skmtc.dev/rusender/apis/public-api.md) · [All operations](https://skmtc.dev/rusender/apis/public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/rusender/apis/public-api/revisions/8e86bca789ea?raw)
