Skip to content

API docs

Transactional email and signup form APIs

Send transactional email from your server and connect custom signup forms to smartest.email.

This guide covers

Send app emails and check their delivery status

Public form configuration and signups from any website origin

Consent, validation, responses, and rate limits

Use the URL from your form.

Create a form in Signup forms, provide a required email field and a required consent checkbox, then publish it. The Install tab shows the exact URL for your form.

Base URL

https://api.smartest.email/api/v1/public/forms/{FORM_ID}

Use the URL shown on your form’s Install tab. Replace FORM_ID with your published form’s ID in the examples below.

1

Create

Set your fields and a clear consent label.

2

Publish

New forms start as drafts; public routes return 404 until published.

3

Integrate

Use the embed snippet or call the two public endpoints below.

Use your own HTML form.

Direct submission is supported. Create and publish a form in smartest.email to define its fields and consent wording, then use its form ID in your existing website form. You can choose the embedded form type without installing the widget.

Your website can submit with JavaScript fetch(), or your own server can forward the signup as JSON. The public endpoint needs no API key, access token, or smartest.email embed script.

POST
https://api.smartest.email/api/v1/public/forms/{FORM_ID}/submit

Replace FORM_ID with the UUID of your published form. Send Content-Type: application/json with the payload below.

JSON request · after the visitor gives consent
{
  "data": {
    "email": "visitor@example.com"
  },
  "consent": true
}

Set consent from the visitor’s explicit choice, and display the form’s consent wording and privacy notice. Keep consent at the top level; place configured contact fields inside data. Include every required field in your published form.

A plain HTML form action needs an adapter

The endpoint accepts JSON only. A normal <form method="post" action="…"> sends URL-encoded or multipart data and receives 415 JSON body required. Use the browser JavaScript example below, or post to your own server and have it send JSON to smartest.email.

Fetching the public configuration keeps your labels and validation aligned with the published form. It is not a prerequisite for each submission. Your integration handles its own success message or redirect; this endpoint always responds with JSON.

Render the fields you published.

This public endpoint needs no access token. Fetch it when displaying a form, then use the returned field names, consent label, and privacy URL in your custom UI.

GET
https://api.smartest.email/api/v1/public/forms/{FORM_ID}

Returns 200 with safe rendering data for an active form. Every successful fetch increments its view count; avoid polling.

GET
https://api.smartest.email/api/v1/public/forms/{FORM_ID}/embed.js

Ready-made inline or popup widget script. Use the exact script URL from Install if you do not need a custom UI.

GET
https://api.smartest.email/api/v1/public/forms/{FORM_ID}/landing

Hosted signup page for an active form.

GET /api/v1/public/forms/{FORM_ID} · example response
{
  "id": "FORM_ID",
  "name": "Newsletter",
  "organizationName": "Example Studio",
  "type": "embedded",
  "fields": [
    { "name": "email", "type": "email", "label": "Email address", "required": true },
    { "name": "consent", "type": "checkbox", "label": "I agree to receive email updates.", "required": true }
  ],
  "styling": {},
  "successAction": {},
  "privacyUrl": "https://example.com/privacy"
}

The response can include additional configured fields, choices, and validation rules. successAction describes behaviour for the ready-made widget; direct submission still returns the generic JSON response below. The script and hosted page return 404 for draft, unpublished, invalid, or unknown forms.

Send consent with the data.

Post JSON after the visitor explicitly chooses to receive marketing email. The consent flag belongs at the top level; do not put consent inside data.

POST
https://api.smartest.email/api/v1/public/forms/{FORM_ID}/submit

No access token. Send Content-Type: application/json and {data:{email:...},consent:true}. Returns the same generic success for new and existing addresses.

HTML + browser JavaScript · email and consent form
<form id="signup-form">
  <fieldset id="signup-fields" disabled>
    <legend>Subscribe to email updates</legend>
    <label id="email-label" for="signup-email">Email address</label>
    <input id="signup-email" type="email" autocomplete="email" required>
    <label for="signup-consent">
      <input id="signup-consent" type="checkbox" required>
      <span id="consent-label"></span>
    </label>
    <a id="privacy-link" href="/privacy">Privacy notice</a>
    <button id="signup-submit" type="submit">Subscribe</button>
  </fieldset>
  <p id="signup-status" role="status" aria-live="polite"></p>
</form>
<script type="module">
  const endpoint = "https://api.smartest.email/api/v1/public/forms/FORM_ID";
  const form = document.querySelector("#signup-form");
  const fields = document.querySelector("#signup-fields");
  const button = document.querySelector("#signup-submit");
  const status = document.querySelector("#signup-status");
  let ready = false;
  let submitting = false;

  form.addEventListener("submit", async event => {
    event.preventDefault();
    if (!ready || submitting || !form.reportValidity()) return;
    submitting = true;
    button.disabled = true;
    try {
      const response = await fetch(endpoint + "/submit", {
        method: "POST",
        credentials: "omit",
        headers: { "Content-Type": "application/json", "Accept": "application/json" },
        body: JSON.stringify({
          data: { email: document.querySelector("#signup-email").value.trim() },
          consent: document.querySelector("#signup-consent").checked
        })
      });
      const result = await response.json();
      status.textContent = result.message || "Please try again.";
      if (response.ok) form.reset();
    } catch {
      status.textContent = "Please try again.";
    } finally {
      submitting = false;
      button.disabled = false;
    }
  });

  try {
    const response = await fetch(endpoint, { credentials: "omit" });
    if (!response.ok) throw new Error("Signup form unavailable");
    const config = await response.json();
    document.querySelector("#email-label").textContent =
      config.fields.find(field => field.name === "email").label;
    document.querySelector("#consent-label").textContent =
      config.fields.find(field => field.name === "consent").label;
    if (config.privacyUrl) {
      document.querySelector("#privacy-link").href = config.privacyUrl;
    }
    ready = true;
    fields.disabled = false;
  } catch (error) {
    status.textContent = error.message;
  }
</script>

Replace FORM_ID with your form’s UUID, and set the fallback /privacy link to your own notice if the form has no configured privacyUrl. This example handles the two required fields; render and send any additional required fields from your published configuration.

Accepted response

JSON
{"success":true,"message":"Thank you for subscribing."}

The response intentionally does not say whether an address already exists. Existing subscribed and unsubscribed contacts keep their current state; only a new accepted address adds a subscriber and consent record.

Only send names present in the published fields array. Required fields must be supplied. For extra fields, send checkbox values as booleans, number values as numeric strings, dates as YYYY-MM-DD, and select or radio values exactly as listed in options. The API validates the data again on the server.

The optional top-level website property is a spam honeypot. Omit it or leave it empty for a normal submission. A nonempty value returns the generic success response without adding a contact; it is not a field for the visitor’s website URL.

Handle failures and traffic limits.

Public form endpoints allow cross-origin GET, POST, and OPTIONS requests from external websites with Content-Type and Accept headers. Use credentials: omit in browser requests; no account cookies, Authorization header, or API key is needed.

StatusMeaning
200Configuration or accepted submit; a duplicate address gets the same submit response.
400 / 415Malformed JSON / request is not application/json.
404Unknown, draft, unpublished, or invalid form.
409The account has reached its contact limit.
413 / 422Body exceeds 16 KiB / consent or field data is invalid.
429Rate limit reached; browser code can use retry_after in the JSON body. Server integrations can also read Retry-After.

Errors use {"error":true,"message":"..."}; rate-limit errors also include retry_after in seconds. Form requests allow up to 30 requests per IP per minute, including up to 10 submissions. Your website’s Content Security Policy must allow https://api.smartest.email in connect-src; the ready-made embed also needs it in script-src.

When your own server forwards submissions, they share that server’s outgoing IP for rate limiting.

Consent and delivery

A new accepted signup creates a subscribed contact and saves the form’s consent label, time, and supplied request origin. Your custom UI must display the form’s consent text and privacy notice before the visitor submits. The recorded request origin is not proof of identity. This endpoint uses single opt-in; it does not send a confirmation email or verify ownership of the address.

Transactional email API

Send password resets, receipts, and other application emails from your server.

Verify your sending domain

Publish the ownership and DKIM records shown in Settings → Sending domains, then verify the domain. Use a From address on that exact domain in the same workspace as your API key.

Sending domains

Create a transactional API key

Choose an expiry and enable Send emails (transactional:send). Enable Read message status (transactional:read) if your app will check message status.

Copy the key when it is shown and store it on your server as SMARTEST_EMAIL_API_KEY.

API keys

Your workspace needs an outbound delivery route for customer domains. If the API returns 503, check with your workspace administrator or contact support.

Send your first app email

Replace the sender with an address on your verified domain and the recipient with an inbox you control. Replace REQUEST_UUID with a unique ID for this email.

POST
https://api.smartest.email/api/v1/transactional/emails

Queue one email using a dedicated transactional API key.

Send HTML directly
curl --include https://api.smartest.email/api/v1/transactional/emails \
  -H "Authorization: Bearer $SMARTEST_EMAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: password-reset-REQUEST_UUID" \
  -d '{
  "from": "security@your-verified-domain.com",
  "fromName": "Example App",
  "to": "customer@example.com",
  "subject": "Reset your password",
  "html": "<p>Hello {{name}}</p><p><a href=\"{{reset_url}}\">Reset password</a></p>",
  "variables": {
    "name": "Alex",
    "reset_url": "https://your-app.example/reset?token=YOUR_SINGLE_USE_TOKEN"
  }
}'

Send one recipient per request. Include an Authorization bearer token, Content-Type: application/json, and an Idempotency-Key.

Use html, text, or both for a direct send. To use a template from your workspace, send templateId and any variables instead.

A 202 response means the message is queued. Save the id from the JSON response and use it as MESSAGE_ID in the status request.

Read message status

GET
https://api.smartest.email/api/v1/transactional/emails/{MESSAGE_ID}

Read message status using a key with transactional:read permission.

Read message status
curl https://api.smartest.email/api/v1/transactional/emails/MESSAGE_ID \
  -H "Authorization: Bearer $SMARTEST_EMAIL_API_KEY"
status
queued, sending, accepted, failed, suppressed, canceled, expired, uncertain

Accepted means the delivery service or relay accepted the handoff. When available, deliveryStatus and deliveredAt report whether and when the recipient’s mail server accepted the message.

Retry safely

After a timeout, retry with the same Idempotency-Key and request body. An identical request returns 200 with the same message ID and Idempotency-Replayed: true. A changed request using the same key returns 409.

An uncertain status means the outcome is unknown. A new key may cause a duplicate send.

On a rate limit, wait for the Retry-After interval when the header is present.

Send a styled template with your app’s values

Design the email once in Templates. Each API call supplies the saved template ID and the values to insert. The saved layout, fonts, colours, images and button styling are kept.

  1. 1. Design your email

    Open Templates, create a template, choose its language, and give it a name. Start from scratch and style the email, or customise a starter and remove newsletter-only footers.

  2. 2. Add placeholders

    Type “Hello {{first_name}},” in a text block. Set a button’s Destination URL to {{reset_url}}. Keep its label and styling in the template.

  3. 3. Save and copy the template ID

    Save the template, then copy its UUID from the editor URL: /templates/TEMPLATE_ID. The template and API key must belong to the same workspace.

  4. 4. Fill the keys when sending

    Send templateId and variables instead of html or text. Variable keys omit braces and match the template exactly. Your app supplies the subject, sender and recipient.

For the example below, the greeting becomes “Hello Alex,” and the styled button opens the reset_url supplied by your app. A later request can use the same template with different values.

Before running the example, set SMARTEST_EMAIL_API_KEY to the key created in Settings → API keys. Replace TEMPLATE_ID with your saved UUID and REQUEST_UUID with a unique value for this email.

Send a saved template with values
curl https://api.smartest.email/api/v1/transactional/emails \
  -H "Authorization: Bearer $SMARTEST_EMAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: password-reset-REQUEST_UUID" \
  -d '{
  "from": "security@your-verified-domain.com",
  "fromName": "Example App",
  "to": "alex@example.com",
  "subject": "Reset your password",
  "templateId": "TEMPLATE_ID",
  "variables": {
    "first_name": "Alex",
    "reset_url": "https://your-app.example/reset?token=YOUR_SINGLE_USE_TOKEN"
  }
}'

Use simple, case-sensitive keys such as first_name and reset_url. Every placeholder needs a string value, including placeholders in links and the subject. Contact and organisation values are not filled automatically; filters, defaults, conditions and loops are not supported here.

Type your keys directly. The contact placeholder menu inserts names such as {{contact.first_name}}, which this API does not resolve. Remove or rewrite starter content with dotted placeholders such as {{org.name}} and unsubscribe links such as {{unsubscribe_url}}.

Send to your own test inbox through the transactional API to check the filled result. The editor’s Preview and Test email tools do not supply these transactional variables and may show a marketing unsubscribe footer that is not added to transactional sends.

Your app creates and validates the reset token. Set expiresAt to a future ISO timestamp no later than that token’s expiry; otherwise the message expires after one hour. Keep the API key on your server.

Saved edits apply to new requests. Already queued messages keep the template version captured when they were queued. Reuse the same Idempotency-Key and body when retrying one send.

Templates

Set expiresAt to an ISO timestamp before your reset token expires. The default is one hour, with a maximum of 24 hours. Messages use your existing monthly email quota and branding policy.

Requests accept one recipient, up to 256 KiB of HTML, 128 KiB of text, and 50 variables. Hard bounces and complaints are suppressed. Transactional sends do not create contacts or add campaign tracking.

Errors: 400 invalid request, 401 invalid key, 403 missing permission, 404 unknown message, 409 idempotency conflict, 422 unverified sender or suppressed recipient, 429 rate or quota limit, 503 delivery unavailable.