---
title: "Create an email automation"
method: POST
path: "/email-automations"
tags: ["Email"]
---

# Create an email automation

`POST /email-automations`

## Request

- Base URL: `https://api.hypamoon.com/api/v1`
- URL: `https://api.hypamoon.com/api/v1/email-automations`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://app.hypamoon.com/oauth/authorize`, token URL `https://api.hypamoon.com/oauth/token`, scopes: `messages:write`)

When something happens, send a template (or start a sequence) to the person it happened to, or to a fixed address that appears in the project. Events: form.submitted (a form on one of the project's sites was sent; filter.collection for one form), booking.created (a form submission in the collection bookings, or the one in filter.collection), order.paid, order.payment_failed (the payment failed, expired or was canceled), app_user.created (someone became a user of an app; filter.app_id for one app), and for subscriptions on paid access subscription.payment_failed, subscription.past_due, subscription.chargeback, subscription.canceled, subscription.paused, subscription.resumed and subscription.recovered (to: contact is the buyer). The variables are the fields of the form, or order_id, order_number, total and currency, or for a subscription subscription_id, product, amount, currency, interval, status, paid_until, reason, pay_url (the buyer's signed link to pay or cancel), manage_url (the same link), order_id where it applies, plus email and name, plus email and name. delay_minutes waits, like 60 for an hour (at most 30 days). Every event sends at most once per automation, also when it is reported twice. The email follows all rules of POST /emails: category transactional (default) answers what the person did. A test project only simulates.

## Request body

- object
  - `event` 'form.submitted' | 'booking.created' | 'order.paid' | 'order.payment_failed' | 'app_user.created' | 'list.subscribed' | 'subscription.payment_failed' | 'subscription.past_due' | 'subscription.chargeback' | 'subscription.canceled' | 'subscription.paused' | 'subscription.resumed' | 'subscription.recovered', required: What happens.
  - `template_id` string, uuid: The template to send. Give template_id or sequence_id.
  - `sequence_id` string, uuid: Or: start this sequence for the person.
  - `to` string: contact (default): the person of the event (who sent the form, the buyer, the new app user). Or one fixed address that appears in the project, like the owner's, for a notice.
  - `from` string, required: The sender: an address on a verified sending domain of this project, optionally with a name, like "Acme <hello@acme.com>".
  - `reply_to` string: Optional. Where replies go, like the owner's own mailbox.
  - `category` 'transactional' | 'other': transactional (default): it answers what the person did. other: gets an unsubscribe link.
  - `delay_minutes` integer: Wait this long after the event, like 60 for one hour. 0 sends right away.
  - `filter` object
    - `collection` string: form.submitted and booking.created: only submissions to this collection (the form).
    - `app_id` string, uuid: app_user.created: only users of this app.
    - `list_id` string, uuid: list.subscribed: only this list.
  - `enabled` boolean

## Response `201`

The automation.

- object
  - `id` string, uuid, required
  - `event` 'form.submitted' | 'booking.created' | 'order.paid' | 'order.payment_failed' | 'app_user.created' | 'list.subscribed' | 'subscription.payment_failed' | 'subscription.past_due' | 'subscription.chargeback' | 'subscription.canceled' | 'subscription.paused' | 'subscription.resumed' | 'subscription.recovered', required
  - `template_id` string, uuid, nullable, required
  - `sequence_id` string, uuid, nullable, required
  - `to` string, required: contact (the person of the event) or a fixed address.
  - `from` string, required
  - `reply_to` string, nullable, required
  - `category` 'transactional' | 'other', required
  - `delay_minutes` integer, required
  - `filter` object, required
    - `collection` string
    - `app_id` string, uuid
    - `list_id` string, uuid
  - `enabled` boolean, required
  - `created_at` string, date-time, required

## Other responses

- `400`: Bad Request: invalid_json.
- `401`: Unauthorized: unauthorized, missing_api_key, invalid_api_key, api_key_revoked, project_deleted.
- `403`: Forbidden: project_not_enabled, key_mode_mismatch, missing_scope, verification_required, recipient_not_allowed.
- `404`: Not Found: not_found.
- `409`: Conflict: email_domain_not_verified, conflict.
- `422`: Unprocessable Content: validation_failed.
- `429`: Too Many Requests: rate_limited.
- `500`: Internal Server Error: internal_error.
- `503`: Service Unavailable: service_unavailable.

---

[API](https://skmtc.dev/hypamoon/apis/hypamoon-api.md) · [All operations](https://skmtc.dev/hypamoon/apis/hypamoon-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hypamoon/apis/hypamoon-api/revisions/9f0b90004c06?raw)
