Orders

Push an order when it is created and again every time it changes: payment, delivery, cancellation or edited items. Each push is the full order as it is now (a snapshot). The CRM updates the same record every time and keeps the customer's totals current.

Push an order#

POST /v1/integrations/orders. This needs the orders.write scope.

{
  "externalId": "1001",
  "customer": {
    "externalId": "C-42",
    "fullName": "Selam Bekele",
    "phone": "+251911234567",
    "email": "selam@example.com",
    "address": { "city": "Addis Ababa", "country": "ET" }
  },
  "items": [
    { "productExternalId": "P-7", "sku": "LAMP-BLK", "name": "Desk lamp", "category": "Lighting", "qty": 2, "unitPrice": 1200 }
  ],
  "total": 2400,
  "currency": "ETB",
  "paymentStatus": "paid",
  "deliveryStatus": "pending",
  "status": "confirmed",
  "channel": "website",
  "placedAt": "2026-10-06T09:30:00Z",
  "updatedAt": "2026-10-06T09:31:00Z",
  "metadata": { "shippingMethod": "express", "couponCode": "WELCOME10" },
  "attribution": { "source": "facebook", "medium": "paid", "campaignCode": "OCT-LAUNCH", "adRef": "video-a" }
}

Fields#

FieldTypeRequiredNotes
externalIdstring ≤ 100yesYour order number or id. Unique within your platform.
customerobjectyesSame fields as a customer push, but externalId is optional here. Needs a name and a phone or email.
items[]array ≤ 500Defaults to [].
items[].namestring ≤ 300yes
items[].qtyinteger ≥ 1yes
items[].unitPricenumber ≥ 0yesMajor units (1200.50).
items[].productExternalId, items[].sku, items[].categorystringProducts are added to the CRM catalogue the first time they appear.
totalnumber ≥ 0yesWhat the customer pays, after discounts, tax and shipping.
currencyISO 4217e.g. KES. Defaults to the tenant's currency.
paymentStatusenumpending (default), partial, paid, failed, refunded
deliveryStatusenumpending (default), dispatched, delivered, returned
statusenumplaced (default), confirmed, completed, cancelled
channelstring ≤ 40Where it was placed: website, android, ios, app, showroom, phone, telegram, whatsapp… Also the fallback marketing source.
placedAtISO 8601yesWhen the customer placed the order.
updatedAtISO 8601strongly recommendedWhen the order last changed on your side; decides which snapshot is newest.
metadataobjectUp to 50 flat keys (strings, numbers, booleans, null) for your own data. Returned as-is.
attributionobjectSee Attribution.

Response#

{ "status": "processed", "eventId": "clx…", "orderId": "clx…", "customerId": "clx…", "leadId": "clx…", "created": true, "stale": false }
FieldMeaning
createdtrue the first time this order was seen
staletrue when this snapshot was not newer than the stored one, so nothing changed
duplicatepresent and true when this exact delivery was already processed; the original result is returned
leadIdthe open sales lead the order was linked to, if there was one

Orders are processed straight away and answer 200. If the CRM has a temporary problem, it may answer 202 {"status":"accepted"}. It has then kept the order and will finish it in the background, so you do not need to resend.

Snapshots and ordering#

  • Send everything, every time. A push replaces the stored items, total and statuses. Fields you leave out go back to their defaults, so always send the current statuses.
  • updatedAt decides. A snapshot whose updatedAt is not newer than the stored one is ignored (stale: true). A slow retry can therefore never move an order backwards, such as from delivered back to pending. Without updatedAt, placedAt is used, which means only the first push counts. Always send updatedAt.
  • Retries are safe. The same order with the same updatedAt is recognised as a duplicate.
  • The customer is fixed at creation. Later snapshots can fill blanks on that customer's profile, but they cannot move the order to a different customer.

Statuses and the sales pipeline#

When an order arrives for a customer with an open sales lead in the CRM, the lead moves forward on its own:

Order stateLead moves to
any new orderOrder placed
paymentStatus: "paid"Paid
deliveryStatus: "delivered" or status: "completed"Delivered (closes the lead)
status: "cancelled"no change

Customer totals use non-cancelled orders. Revenue counts only paid orders.

Attribution#

Optional. It tells the CRM which campaign or channel brought the order in. Send what you captured when the visitor arrived (UTM parameters, click ids):

FieldExampleNotes
sourcefacebook, tiktok, google, newsletterUnknown values are kept as other until an admin maps them. direct / none mean no source.
mediumpaid, social, email
campaignCodeOCT-LAUNCHMatches a campaign code set up in the CRM
adRefvideo-aAd or creative within the campaign
termdesk lampSearch term
referralCodeSELAM10Influencer, affiliate or salesperson code
clickIds{ "fbclid": "…", "gclid": "…", "ttclid": "…" }
landingUrl, referrerURLs
firstTouchAt, lastTouchAtISO 8601

The CRM decides the source by checking the referral code first, then the campaign code, the source value, the click ids and finally channel. A customer's original source is set by their first contact and is never overwritten by later orders.

Read orders#

These need the orders.read scope. Responses are paged the same way as customers.

# By your own order id (your key's platform is assumed)
curl "https://api.abbaycrm.com/v1/integrations/orders?externalId=1001" -H "x-api-key: am_…"

# One order by CRM id
curl https://api.abbaycrm.com/v1/integrations/orders/clx… -H "x-api-key: am_…"

# A customer's orders, or everything that changed since a time
curl "https://api.abbaycrm.com/v1/integrations/orders?customerId=clx2…" -H "x-api-key: am_…"
curl "https://api.abbaycrm.com/v1/integrations/orders?updatedSince=2026-10-01T00:00:00Z&paymentStatus=paid" -H "x-api-key: am_…"

Filters: externalId (with optional platform), platform (crm = entered by staff in the CRM), customerId, status, paymentStatus, deliveryStatus, updatedSince, cursor, limit (1–200, default 50).

The order object#

{
  "object": "order",
  "id": "clx…",
  "platform": "shopify",
  "externalId": "1001",
  "customerId": "clx2…",
  "status": "confirmed",
  "paymentStatus": "paid",
  "deliveryStatus": "pending",
  "total": 2400,
  "currency": "ETB",
  "channel": "website",
  "items": [
    { "productExternalId": "P-7", "sku": "LAMP-BLK", "name": "Desk lamp", "category": "Lighting", "quantity": 2, "unitPrice": 1200, "lineTotal": 2400 }
  ],
  "attribution": { "source": "facebook", "campaignCode": "OCT-LAUNCH", "referralCode": null, "adRef": "video-a" },
  "metadata": { "shippingMethod": "express", "couponCode": "WELCOME10" },
  "placedAt": "2026-10-06T09:30:00.000Z",
  "platformUpdatedAt": "2026-10-06T09:31:00.000Z",
  "createdAt": "2026-10-06T09:31:01.020Z",
  "updatedAt": "2026-10-06T09:31:01.020Z"
}

Orders entered by staff in the CRM have platform: "crm" and an externalId like M-20261006-4F2A. Subscribe to webhooks to hear about them.