Send orders from a server
Report completed orders to the agent with one HTTP request per order, from your server or order system. The contract of the public orders endpoint, how to send the conversation key, what it ignores and what it never tells you.
You can send the agent each completed order yourself: one POST per order, from your server or your order system. This page is the contract of that endpoint.
Sending from the browser? Use the tag
On Shopify, the pixel posts each completed order to this endpoint. On another platform, the transaction command does it from your confirmation page in one line and sends the conversation key for you. A sender of your own is for orders the browser does not see, or that a script blocker must not stop.
Send an order
curl -X POST "https://iadvize.ai/api/public/sites/pk_site_YOUR_PUBLIC_KEY/orders" \
-H "Content-Type: application/json" \
-d '{
"type": "purchase",
"orderRef": "order-10432",
"amount": "129.90",
"currency": "EUR",
"occurredAt": "2026-10-23T09:15:00Z",
"attributionId": "atr_01kvnwmagvf27rc9cze5rm9e1r"
}'The answer is 204 No Content with an empty body. That says nothing about whether the order was recorded, see What you get back.
Authentication
The URL is the only credential. pk_site_… is the site's public key, the same one as in your install snippet. It is not secret and ships in page source, so anyone who reads it can post an order for your site. A forged order only changes your own organization's figures. Do not treat a recorded order as proof that a sale happened.
There is no API key, no session and no origin check.
The body
JSON, at most 32,768 bytes.
| Field | Required | What it is |
|---|---|---|
type | yes | Always "purchase". Any other value writes nothing. |
orderRef | yes | Your own order id, 1 to 200 characters after trimming. The agent treats it as opaque and deduplicates on it. |
amount | yes | The order total in the currency's major units, as a number or a string ("129.90", 129.9). Not negative. A string is digits with an optional decimal part, 32 characters at most. |
currency | yes | A three-letter ISO 4217 code, case does not matter (eur is stored as EUR). A code the platform's currency data does not know writes nothing. |
occurredAt | no | When the order was placed, as a date string. If it is missing, does not parse, is in the future or is more than 24 hours old, the agent uses the time it received the request. |
sessionId | no | The tag's session key, 1 to 200 characters, if your sender can read it. It authorizes nothing. |
attributionId | no | The conversation key (atr_…) of the shopper's browser or cart. See Link an order to a conversation. |
objected | no | A boolean. true writes nothing. See Shoppers who objected. |
A body that does not match this table (a missing field, a wrong type, a string where objected expects a boolean, an unknown type) writes nothing. Extra fields are ignored. The Shopify pixel and the tag's commands also send sender (and the pixel senderVersion) to say which of them sent the order; it is kept with the order, nothing displays it, and a server has no reason to send it. pixelVersion, sent by Shopify pixels before version 4, is no longer read. The Shopify pixel also sends the order's lines as items (see The order's lines); the agent ignores that field for now too, so do not expect lines sent here to show anywhere.
Amounts
You send major units. The agent converts to minor units with the currency's own number of decimals: 129.90 in EUR is stored as 12990, 1500 in JPY as 1500. A converted amount that does not fit in a 32-bit signed integer is refused.
Content type and CORS
The agent reads the body as text and parses it as JSON whatever Content-Type says. Send text/plain from a browser and no CORS preflight happens. The endpoint answers every origin (Access-Control-Allow-Origin: *) and also answers an OPTIONS preflight with 204, so a sender that sets application/json works too.
What you get back
Always 204 with an empty body, for every POST. A recorded order, a malformed body, an unknown key, a refused amount and a rate-limited request look the same. This is deliberate: the response never reveals whether a key exists, whether a site has counting switched off, or whether a shopper objected.
The work happens after the response is sent. To check that orders arrive, look at your reports, not at the status code. Or read lastStorefrontOrderAt from Get a site's storefront activity (or the MCP tool get_storefront_activity): the time the agent received the latest order through this endpoint, null before the first. A request that stored nothing, a repeated orderRef included, leaves it unchanged.
What writes nothing
The request still gets its 204, and the agent stores no order, when:
- the body is empty, over 32,768 bytes (a
Content-Lengthover the cap is refused without reading the body), not JSON, or does not match the table above; objectedistrue;- the key in the URL matches no site;
- order recording is switched off for the site: Record orders from your store, in Site settings > Site access, on by default (see The two switches). Count add-to-carts on your pages has no effect here;
amountis negative, malformed or too large once converted, orcurrencyis not a known code;- the request is over a rate limit.
Idempotence
An order sent here is unique by orderRef within a site. Two sites of your organization can each send an order with the same orderRef, and both are stored. Sending the same orderRef again for the same site changes nothing, so a retry is safe. The first one received wins: a later request for that site with the same reference is dropped, including when its amount or key differs. The Shopify pixel and the transaction command post to this same endpoint, so a reference either already sent counts as received. A reference that differs (the pixel sends gid://shopify/Order/<id>) is a different order.
Link an order to a conversation
Send attributionId when you have it. An order with no attributionId, or one that does not have the shape of a conversation key (atr_ followed by 26 lowercase letters or digits), is stored with no key. It is read as not assisted, never inferred. The agent does not check that the key exists when it receives the order. The order read joins only on an exact match with a conversation key of the same organization, so a key from another organization credits nothing.
The key comes from the shopper's browser. After a conversation on your site, the tag keeps it in the first-party cookie iadvize_atr_<site key>, on your site's domain, for the site's attribution window (see Where the key goes). The browser sends that cookie with the requests it makes to your domain, so your server can read it from the Cookie header of the request that completes the order, or of the confirmation page, and pass it on as attributionId. Keep it with the order if you send the order later from a back office.
- Read the cookie named after the site key in your install snippet. Send its value only when it has the shape above, and nothing otherwise.
- The cookie is
SameSite=Lax. A browser sends it on a top-level navigation to your site, including a redirect back from a payment page, but not on a cross-sitePOST(some payment providers return the shopper that way). See MDN, SameSite. In that case, read it on a later request of the same shopper, such as the confirmation page. - No cookie means no conversation in this browser within the window, an objection, or a browser the tag never ran in. Send the order with no
attributionId.
On Shopify, the key is also carried by the store's cart as the iadvize_attribution attribute (see How an order gets its key on Shopify).
Shoppers who objected
If the shopper objected to measurement, your sender must not send anything for that order. Sending it with objected: true is not the way to comply: the endpoint drops that request, but the order should never leave your system in the first place.
The agent checks the flag too, and drops a request that says objected: true before it even looks up the site. It is a second safety net, not a replacement for your sender's own check. There is no way to say a shopper consented: the flag can only lower what the agent writes.
Rate limits
Two limits apply, shared with the add-to-cart endpoint, so both draw from the same budget:
| Limit | Window | Requests |
|---|---|---|
| Per IP address | 10 seconds | 20 |
| Per organization | 60 seconds | 1200 |
The IP limit is checked first. A request over a limit is dropped, still with a 204. If the limiter itself fails, the request goes through. Counters are per region, so the effective ceiling can be higher.
⚠ These two values were copied from another endpoint and have not been calibrated on real traffic of this one. They can change. Send one request per order and do not batch retries in a tight loop.
Limits to know
- Source and lines. An order recorded here has the source
pixel, no order lines, no test flag and no sales channel. It cannot tell a test order from a real one, so do not send test orders. - Device. The agent derives it from the request's
User-Agent, so a server-side sender's device type is whatever that header says. - No refunds or cancellations.
purchaseis the only type, and the agent records no refund or cancellation from any source. An order refunded or cancelled later keeps counting at its full amount. - Your store's key is public. See Authentication.
The addToCart command
Report each product a shopper adds to the cart on your own pages with iadvize('addToCart', { item_id, quantity, price, currency }), on any platform. The fields, how the amount is computed, what is sent, how to check it worked, and its limits.
Install with Google Tag Manager
Install the agent's tag and report orders and add-to-carts from Google Tag Manager, on every platform except Shopify. Import the Main Tag and Sales templates, create the two tags, test them with Preview, publish, and fix what goes wrong.