Skip to content

Send a survey email from your own events

Send a live email survey to one person now, or report an event to an existing API trigger, then read the send status.

Use POST /surveys/{survey_id}/send to email one live survey to one person now, for example after a booking or support ticket closes. The older POST /sends endpoint reports an order or custom event to surveys already configured to listen for it.

Before you start

  • Publish an email survey and leave its sending on.
  • Create an API key with surveys:write; see Authentication and scopes.
  • Get API sending approval for the account. GET /account, with account:read, shows email_account.bulk_send_approval. It must be approved; otherwise ask UserLoop.

Send one survey now

Find the survey’s id or public_id with GET /surveys. On the survey’s Trigger stage, the API tab also shows the endpoint, with Copy the endpoint, API keys and API reference.

The API source tab on the Trigger stage, showing Sent when your app asks, a covered development endpoint, API keys and API reference

Replace SURVEY_ID and the example key below. Use a stable external_id for this send and keep it the same when retrying.

curl https://app.userloop.io/api/v1/surveys/SURVEY_ID/send \
  -H "Authorization: Bearer ulk_live_…" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: booking-1042-survey" \
  -d '{
    "email": "jane@example.com",
    "first_name": "Jane",
    "external_id": "booking-1042"
  }'

A successful request returns 202 with status: "queued", a send_id, the survey ID, external_id and send_at. Read GET /sends/{send_id} to check what happened. Queued does not mean delivered: sending checks still run.

This endpoint works with any live email survey, whatever its configured trigger. It ignores the survey’s trigger, wait and audience rules. Suppressions, unsubscribes, the limit per customer, sending approval and the monthly allowance still apply. Choosing the API or Zapier tab makes this behaviour clear in the editor, but is not required to call the endpoint.

email is required. first_name and external_id are optional. An external ID is 1–200 printable characters without spaces; without one, each call gets a new ID. The same ID never queues this survey twice, even if you name a different recipient: use a different ID for each intended send. A repeat returns status: "duplicate" and the existing send_id.

Report an event to an existing trigger

POST /sends remains available for surveys already configured with an API order trigger or a named custom event. It uses their stored wait and rules. The current Trigger screen no longer offers API order triggers or an Event name field. Selecting the API or Zapier tab creates a send-on-request trigger; it does not configure an event name for POST /sends.

For an existing named custom trigger, the saved name still matches event. If you do not already have a matching trigger, use the direct send endpoint above.

moment Existing API trigger it matches Required reference
order_placed Order placed order.id
order_shipped Order shipped order.id
order_delivered Order delivered order.id
checkout_abandoned Checkout abandoned checkout_id, and customer.consent: "subscribed"
custom The saved custom event name event and event_id

Report a moment

  1. Send the moment

    Send one moment for one customer. This reports that an order was delivered:

    curl https://app.userloop.io/api/v1/sends \
      -H "Authorization: Bearer ulk_live_…" \
      -H "Content-Type: application/json" \
      -d '{
        "moment": "order_delivered",
        "occurred_at": "2026-11-11T09:12:00Z",
        "customer": {
          "email": "jane@example.com",
          "first_name": "Jane",
          "id": "cus_123",
          "consent": "subscribed"
        },
        "order": {
          "id": "84721",
          "name": "#1042",
          "placed_at": "2026-11-07T16:40:00Z",
          "total": 64.5,
          "currency": "GBP",
          "product_ids": ["sku_44"],
          "collection_ids": ["summer"],
          "shipping_country": "GB",
          "customer_type": "returning"
        }
      }'

    A sign-up, as a custom event:

    curl https://app.userloop.io/api/v1/sends \
      -H "Authorization: Bearer ulk_live_…" \
      -H "Content-Type: application/json" \
      -d '{
        "moment": "custom",
        "event": "signed_up",
        "event_id": "signup-55120",
        "customer": { "email": "jane@example.com", "first_name": "Jane" }
      }'
  2. Read the answer

    UserLoop answers 202 Accepted, with one result for each survey the moment reached:

    {
      "ignored": null,
      "results": [
        { "survey_id": "k17f3n8w2q9d0c6v4m1r5t7y3h2b8x0j", "result": "queued", "send_id": "j57a2c9x4m8q1w5r3t7y0n6v2b4h8k1d", "send_at": "2026-11-14T09:12:00.000Z" },
        { "survey_id": "k29b1d7m3x8q2w6r0c4v9n5t1y7h3j8f", "result": "no_match", "rule": "orderValue" }
      ]
    }

    Keep each send_id: it is how you read the email’s status later.

What to put in the body

Field Required What it is
moment Yes One of the five moments above.
customer.email Yes Who gets the email. Stored in lower case.
customer.first_name For the email’s greeting. Cut to 60 characters.
customer.id Your own ID for the customer, up to 200 characters.
customer.consent Marketing consent in your system: subscribed, not_subscribed, unsubscribed or unknown (the default).
order For order moments The order’s facts. order.id is required for the three order moments.
order.id For order moments Your order ID: 1 to 120 letters, digits, _, . or -.
order.name The order number as the customer knows it, for the email, up to 120 characters.
order.placed_at When the order was placed, ISO 8601 with a time zone.
order.total, order.currency The total, and its three-letter currency code in capitals (GBP).
order.product_ids, order.collection_ids Every product and collection ID in the order, up to 250 each.
order.shipping_country Two-letter country code in capitals (GB).
order.customer_type first_time or returning.
checkout_id For checkout_abandoned Your checkout ID, in the same characters as order.id.
event For custom The event name: up to 60 lower-case letters, digits, ., - or _, starting with a letter or digit. It must equal the survey’s saved custom event name.
event_id For custom Your ID for this occurrence of the event, in the same characters as order.id.
occurred_at When the moment happened, ISO 8601 with a time zone. Defaults to now. At most 24 hours old and at most five minutes ahead.
survey_id Only this survey (its id or public_id). Leave it out to reach every matching survey.

Unknown fields, and fields that don’t belong to the moment (checkout_id on an order, for example), are refused with 400 invalid_request. There is no field to choose the send time or to skip the survey’s rules.

The survey’s wait counts from occurred_at. A survey that waits 3 days after Order delivered sends 3 days after the delivery you report; if that time has already passed, the email is due straight away.

Send the facts the survey’s rules need

A survey’s rules (on products, collections, order value, customer type or country) are checked against the facts you send. A fact you leave out never matches a rule: a survey with an Order value rule gets no_match with "rule": "orderValue" when you send no order.total. Send every fact you have.

What the results mean

result Meaning
queued The email is scheduled. send_at is when it is due.
duplicate This survey already has an email for this moment and reference. send_id is the existing one; nothing new was scheduled.
no_match The survey’s rules said no. rule names the rule: products, collections, orderValue, customer or country.
not_sent The moment matched but policy stopped it. reason is no_marketing_consent (a checkout abandoned without consent: "subscribed") or recently_emailed (this survey emailed this address about an abandoned checkout in the last 30 days).

The API description lists three more values, held, rules_unchecked and not_accepted, which moments reported through the API don’t produce today. Treat any value you don’t know as “nothing was scheduled for this survey”.

ignored is null when at least one email was scheduled. Otherwise it says why nothing was:

ignored Meaning
no_surveys No live email survey listens to the API for this moment (for custom, with this event name). results is empty.
no_match Every survey that listens said no through its rules.
nothing_new Nothing new was scheduled, for example because every result is a duplicate.

All three still answer 202. Only when you name a survey with survey_id and it doesn’t listen for this moment is the answer 409 conflict.

A scheduled email still goes through every check when it comes due: the address’s suppressions and unsubscribes, your plan’s monthly email allowance, a pause on sending, and bulk sending approval. If one fails, the email is skipped; See what was sent, and why something wasn’t explains each reason.

Read a send’s status

curl https://app.userloop.io/api/v1/sends/j57a2c9x4m8q1w5r3t7y0n6v2b4h8k1d \
  -H "Authorization: Bearer ulk_live_…"
{
  "send_id": "j57a2c9x4m8q1w5r3t7y0n6v2b4h8k1d",
  "survey_id": "k17f3n8w2q9d0c6v4m1r5t7y3h2b8x0j",
  "moment": "order_delivered",
  "status": "sent",
  "reason": null,
  "send_at": "2026-11-14T09:12:00.000Z",
  "sent_at": "2026-11-14T09:12:41.000Z"
}

status is queued (waiting for send_at), sent, skipped or cancelled; awaiting_fulfilment and awaiting_delivery belong to Shopify orders. For skipped and cancelled, reason is a short code such as bulk_not_approved or order_refunded. The answer never includes the recipient. It needs the surveys:write scope, like the other sends endpoints.

Cancel when an order is refunded

UserLoop doesn’t hear about refunds or cancellations in your system. Report them with POST /sends/cancel, naming the same reference you sent:

curl https://app.userloop.io/api/v1/sends/cancel \
  -H "Authorization: Bearer ulk_live_…" \
  -H "Content-Type: application/json" \
  -d '{ "moment": "order_placed", "order_id": "84721", "reason": "order_refunded" }'
{ "cancelled": 2 }

This cancels pending event-triggered emails for that reference, across all surveys and all moments, and returns how many. It does not cancel sends requested through POST /surveys/{survey_id}/send. Emails already sent are not recalled; "cancelled": 0 means nothing was waiting.

moment Reference reason
order_placed, order_shipped, order_delivered order_id order_cancelled or order_refunded
checkout_abandoned checkout_id checkout_completed
custom event_id withdrawn

Send only the reference for the moment, and a reason that matches it; anything else is 400 invalid_request. Because a cancel matches the reference whatever the moment, keep your order, checkout and event IDs distinct from one another (prefix them, for example order-84721 and signup-55120).

Retry safely

UserLoop remembers each survey, moment and reference it has scheduled. Report the same moment again (after a timeout, for instance) and the survey answers duplicate with the first send_id: the customer never gets a second email for it. You can retry POST /sends without any extra header.

The sends endpoints also take an Idempotency-Key header like every write, which replays the first answer for 24 hours. See Rate limits and safe retries.

Check it worked

The answer has a queued result for the survey you expected. In the dashboard, the email appears on the Email activity page with its due time.

What can go wrong

You see What to do
403 sending_paused UserLoop is reviewing the account; nothing was queued. Check the dashboard banner and contact UserLoop. GET /account exposes email_account.quarantined and quarantine_kind (delivery, review, or null). paused_reason is always null.
403 sending_not_approved, “API sending needs bulk sending approval. Request approval on the email account page.” Bulk sending isn’t approved for the account. Check email_account.bulk_send_approval in GET /account and ask UserLoop.
202 with "ignored": "no_surveys" No live email survey listens to the API for this moment. Check the survey’s Trigger stage, that it is published, and for custom that event equals its saved custom event name exactly.
409 conflict, “That survey is not a live email survey listening to API moments of this kind.” The survey_id you named isn’t live, has sending paused, listens to another source, or listens for another moment.
400 invalid_request about occurred_at The moment is more than 24 hours old or more than five minutes in the future. Report moments as they happen.
400 invalid_request naming order.id, checkout_id, event_id or event The reference the moment needs is missing, or a field belongs to another moment. See the first table.
no_match for every survey A rule needs a fact you didn’t send, or the order doesn’t meet it. rule names which.
402 plan_required The organisation’s plan doesn’t include the API or email surveys.
403 insufficient_scope, required_scope: "surveys:write" Create a key with the surveys:write scope.
A queued email shows as skipped later A send-time check stopped it. Read reason with GET /sends/{send_id}.

Type to search…

↑↓ navigate↵ selectEsc close