Your data

Sending orders

Send your store's orders, keep them up to date, and see what YouSendIt records from them.

Send your store’s orders to YouSendIt so you can see revenue from your emails, count purchases as conversions, and use them in segments and flows. Your server sends each order to POST/orders when it is placed, and sends it again whenever it changes.

Before you start

  • Create an API key with Orders → Full access (orders:write) under Transactional → API keys. See Authentication and Permissions.
  • Call the API from your server, never from a web page: a request from a browser is refused.

1. Send an order when it is placed

The body is a JSON list of up to 25 orders. Amounts are decimals as strings ("24.00"), times are ISO 8601 with a time zone.

curl
curl -X POST https://yousendit.io/api/v1/orders \
  -H "Authorization: Bearer $YOUSENDIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[{
    "external_id": "1042",
    "name": "#1042",
    "email": "sam@example.com",
    "currency": "USD",
    "total": "29.00",
    "subtotal": "24.00",
    "shipping": "5.00",
    "placed_at": "2026-11-28T10:04:02Z",
    "updated_at": "2026-11-28T10:04:02Z",
    "items": [
      { "external_id": "1042-1", "product_external_id": "mug-1", "title": "Mug", "sku": "MUG-BLUE", "quantity": 2, "price": "12.00" }
    ]
  }]'

The order’s fields

FieldWhat it is
external_idRequiredYour id for the order. Send the same one to update it.
totalRequiredWhat the customer paid, as a decimal string. This is the order's value in reports and conversions.
placed_atRequiredWhen the order was placed.
emailThe buyer’s email. The order is matched to the contact with this address (or send profile_id).
profile_idThe contact’s id, when you have it (from Create or update profile). It wins over email.
currencyThree letters, like USD. Send it: amounts are never converted between currencies.
nameHow the order is shown, like #1042.
subtotal, tax, discounts, shippingParts of the total, as decimal strings.
itemsThe order’s lines (below). Send the complete list each time: a line left out is removed. Leave the field out to keep the lines as they are.
fulfilled_at, cancelled_atWhen the order shipped, or was cancelled.
refundsEvery refund so far: { "id": "r1", "amount": "12.00", "at": "…" }.
financial_status, fulfillment_statusYour own status words (paid, shipped), shown with the order.
updated_atWhen the order last changed in your system. Lets an older copy never overwrite a newer one (see below).

Each line in items:

FieldWhat it is
external_idRequiredYour id for the line. Keep it the same when you send the order again.
quantityHow many (default 1).
priceThe unit price, as a decimal string.
title, variant_title, skuWhat was bought. Used in emails and as filters ("Ordered Product where sku is MUG-BLUE").
product_external_id, variant_external_idYour product’s id, the same as in your product catalogue.

2. Read the answer

The answer is always 200, with one result per order in the same order as you sent them, so one bad order never fails the others:

Response
{
  "written": 1, "stale": 0, "failed": 0,
  "results": [
    { "index": 0, "status": "created", "id": "8c1f…", "profile_id": "2b7e…", "code": null, "param": null, "message": null }
  ]
}
  • created or updated: stored. profile_id is the contact it was matched to, or null when nobody has that email yet.
  • stale: a newer copy is already stored (by updated_at). Nothing changed.
  • failed: code, param and message say what to fix. See Errors and limits.

3. Send it again when it changes

Send the whole order again with the same external_id whenever something changes. Each change records its own activity once, however often you resend:

ActivityCounts whenValue
ShippedAdd fulfilled_at. Records Fulfilled Order.None
CancelledAdd cancelled_at. Records Cancelled Order.Order total
RefundedAdd the refund to refunds (keep the earlier ones). Records Refunded Order per refund.Refund amount
EditedChange the total or the lines. The order's activity is corrected, not counted again.New total
Always send updated_at (or never). With it, a copy that arrives late never replaces a newer one. A copy without updated_at never replaces one that has it.

What YouSendIt records

From each order, YouSendIt records the activity you can use in conversions, segments and flows. You never send these yourself, and they do not count against your monthly event allowance.

ActivityCounts whenValue
Placed OrderOnce per order, at placed_atOrder total
Ordered ProductOnce per line, at placed_atLine total
Fulfilled OrderWhen fulfilled_at is setNone
Cancelled OrderWhen cancelled_at is setOrder total
Refunded OrderOnce per refundRefund amount

Matching orders to contacts

  • An order goes to the contact with its profile_id, or else the contact with its email.
  • Orders never create contacts. If nobody has that email yet, the order is kept and matched when the contact is added (by a sign-up, an import, an event, or the profiles API); its activity is recorded then.
  • Having an order does not subscribe anyone to your emails.

Sending past orders

You can send your order history. Anything that happened more than 48 hours before you first sent the order is stored as past activity: it shows on the contact and in reports, but never starts a flow, and a conversion counts it only with Include past activity turned on.

Reading orders back

List orders (newest first, filter by contact or dates) and Retrieve order (with its lines) need orders:read.