Send an email
POST /emails
Tilgang kun sending
Accepts one email for delivery (or for later delivery when scheduled_at is set) and
returns its id. The from domain must be a verified domain of your team.
At most 50 recipients across to, cc and bcc. Recipients on the team's suppression
list are dropped; if every recipient is suppressed the email is stored with status
failed and nothing is sent.
Permission: full_access or sending_access.
Parametere
- Idempotency-Key header · string Makes the request safe to retry: for 24 hours a repeated key with the same body returns the original response without sending again. Reusing a key with a different body answers
409 invalid_idempotent_request.
ForespørselsinnholdSendEmailRequest
An email. Either html or text (or both) is required.
- from string påkrevd
user@example.comorDisplay Name <user@example.com>. - to string | array of string påkrevd One address or a non-empty array of addresses.
- subject string påkrevd
- html string HTML body.
- text string Plain-text body.
- cc string | array of string One address or a non-empty array of addresses.
- bcc string | array of string One address or a non-empty array of addresses.
- reply_to string | array of string One address or a non-empty array of addresses.
- headers object Extra email headers.
- tags array of Tag
- scheduled_at string (date-time) Send later: an ISO 8601 timestamp with a UTC offset, in the future and at most 72 hours ahead. The email's status is
scheduleduntil then; it can be canceled.
Svar
- 200
- Email accepted.
- 400
- The body is not valid JSON (
validation_error). - 401
missing_api_key(no bearer token) orrestricted_api_key(asending_accesskey used for an operation that needsfull_access).- 403
invalid_api_key, orvalidation_errorfor an account-state refusal: the sender domain is not verified for this team, the key is limited to another domain, or sending is paused/suspended for the team.- 409
invalid_idempotent_requestorconcurrent_idempotent_requests.- 422
- The request is invalid (
validation_error).messagenames the offending field. - 429
rate_limit_exceeded(retry afterretry-afterseconds), or a quota refusal that must not be retried:daily_quota_exceeded(until the next UTC day) ormonthly_quota_exceeded(monthly allowance or spend limit reached).- 500
- Unexpected server error (
internal_server_error).
curl -X POST https://api.agdir.email/emails \
-H 'Authorization: Bearer re_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"from": "Acme <hello@acme.com>",
"to": [
"user@example.org"
],
"subject": "Welcome to Acme",
"html": "<p>Thanks for signing up!</p>"
}'