{"openapi":"3.1.0","info":{"title":"Abay CRM platform API","version":"1.0.0","description":"Push customers and orders from any platform, read them back, and receive webhooks. Guide: /developers"},"servers":[{"url":"https://api.abbaycrm.com/v1"}],"security":[{"apiKey":[]}],"tags":[{"name":"Customers","description":"Customer profiles, matched across platforms"},{"name":"Orders","description":"Order snapshots and their status"},{"name":"Leads","description":"Enquiries that are not orders yet"},{"name":"Keys","description":"The calling API key"}],"paths":{"/integrations/me":{"get":{"tags":["Keys"],"summary":"Describe the calling key","operationId":"getKey","responses":{"200":{"description":"The key","content":{"application/json":{"schema":{"type":"object","properties":{"platform":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"keyId":{"type":"string"}}}}}},"401":{"description":"Missing, invalid or revoked key, or a bad signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this endpoint needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; see the Retry-After header","headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/integrations/customers":{"post":{"tags":["Customers"],"summary":"Create or update a customer","operationId":"pushCustomer","description":"Scope customers.write. Matches by platform id, then phone, then email. Sent values replace stored ones; customFields merge.","parameters":[{"name":"x-timestamp","in":"header","required":false,"schema":{"type":"string","description":"Unix seconds; required when the key requires signed requests"}},{"name":"x-signature","in":"header","required":false,"schema":{"type":"string","description":"sha256=<hex HMAC-SHA256(secret, x-timestamp + \".\" + rawBody)>"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerPush"}}}},"responses":{"200":{"description":"Processed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerPushResult"}}}},"202":{"description":"Saved; finishing in the background","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Accepted"}}}},"401":{"description":"Missing, invalid or revoked key, or a bad signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this endpoint needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Invalid payload; do not retry unchanged","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; see the Retry-After header","headers":{"Retry-After":{"schema":{"type":"integer"}}}}}},"get":{"tags":["Customers"],"summary":"List or look up customers","operationId":"listCustomers","description":"Scope customers.read.","parameters":[{"name":"updatedSince","in":"query","schema":{"type":"string","format":"date-time"},"description":"Items changed at or after this instant"},{"name":"cursor","in":"query","schema":{"type":"string"},"description":"nextCursor from the previous page"},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"externalId","in":"query","schema":{"type":"string"},"description":"Customer id on a platform (the key's platform unless `platform` is set)"},{"name":"platform","in":"query","schema":{"type":"string"}},{"name":"email","in":"query","schema":{"type":"string","format":"email"}},{"name":"phone","in":"query","schema":{"type":"string"},"description":"Any format"}],"responses":{"200":{"description":"A page of customers","content":{"application/json":{"schema":{"type":"object","required":["data","hasMore","nextCursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}},"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"]}}}}}},"400":{"description":"Bad parameter","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked key, or a bad signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this endpoint needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; see the Retry-After header","headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/integrations/customers/{id}":{"get":{"tags":["Customers"],"summary":"Get a customer","operationId":"getCustomer","description":"Scope customers.read.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"CRM customer id"}}],"responses":{"200":{"description":"The customer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"401":{"description":"Missing, invalid or revoked key, or a bad signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this endpoint needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; see the Retry-After header","headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/integrations/orders":{"post":{"tags":["Orders"],"summary":"Create or update an order (full snapshot)","operationId":"pushOrder","description":"Scope orders.write. Idempotent by platform + externalId; snapshots not newer than the stored updatedAt are ignored (stale).","parameters":[{"name":"x-timestamp","in":"header","required":false,"schema":{"type":"string","description":"Unix seconds; required when the key requires signed requests"}},{"name":"x-signature","in":"header","required":false,"schema":{"type":"string","description":"sha256=<hex HMAC-SHA256(secret, x-timestamp + \".\" + rawBody)>"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderPush"}}}},"responses":{"200":{"description":"Processed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderPushResult"}}}},"202":{"description":"Saved; finishing in the background","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Accepted"}}}},"401":{"description":"Missing, invalid or revoked key, or a bad signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this endpoint needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Invalid payload; do not retry unchanged","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; see the Retry-After header","headers":{"Retry-After":{"schema":{"type":"integer"}}}}}},"get":{"tags":["Orders"],"summary":"List or look up orders","operationId":"listOrders","description":"Scope orders.read.","parameters":[{"name":"updatedSince","in":"query","schema":{"type":"string","format":"date-time"},"description":"Items changed at or after this instant"},{"name":"cursor","in":"query","schema":{"type":"string"},"description":"nextCursor from the previous page"},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"externalId","in":"query","schema":{"type":"string"},"description":"Order id on a platform (the key's platform unless `platform` is set)"},{"name":"platform","in":"query","schema":{"type":"string"},"description":"\"crm\" = entered by staff"},{"name":"customerId","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string","enum":["placed","confirmed","completed","cancelled"]}},{"name":"paymentStatus","in":"query","schema":{"type":"string","enum":["pending","partial","paid","failed","refunded"]}},{"name":"deliveryStatus","in":"query","schema":{"type":"string","enum":["pending","dispatched","delivered","returned"]}}],"responses":{"200":{"description":"A page of orders","content":{"application/json":{"schema":{"type":"object","required":["data","hasMore","nextCursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Order"}},"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"]}}}}}},"400":{"description":"Bad parameter","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked key, or a bad signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this endpoint needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; see the Retry-After header","headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/integrations/orders/{id}":{"get":{"tags":["Orders"],"summary":"Get an order","operationId":"getOrder","description":"Scope orders.read.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"CRM order id"}}],"responses":{"200":{"description":"The order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"401":{"description":"Missing, invalid or revoked key, or a bad signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this endpoint needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; see the Retry-After header","headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/integrations/customers/batch":{"post":{"tags":["Customers"],"summary":"Import up to 500 items (customers.write)","operationId":"pushCustomersBatch","description":"Scope customers.write. Each item has the single-endpoint shape and succeeds or fails on its own. Body limit 10 MB; counts as one request for rate limits.","parameters":[{"name":"x-timestamp","in":"header","required":false,"schema":{"type":"string","description":"Unix seconds; required when the key requires signed requests"}},{"name":"x-signature","in":"header","required":false,"schema":{"type":"string","description":"sha256=<hex HMAC-SHA256(secret, x-timestamp + \".\" + rawBody)>"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["items"],"properties":{"items":{"type":"array","minItems":1,"maxItems":500,"items":{"$ref":"#/components/schemas/CustomerPush"}}}}}}},"responses":{"200":{"description":"Per-item results, in request order","content":{"application/json":{"schema":{"type":"object","properties":{"summary":{"type":"object","properties":{"total":{"type":"integer"},"processed":{"type":"integer"},"accepted":{"type":"integer"},"failed":{"type":"integer"},"error":{"type":"integer"}}},"results":{"type":"array","items":{"type":"object","required":["index","status"],"properties":{"index":{"type":"integer"},"externalId":{"type":["string","null"]},"status":{"type":"string","enum":["processed","accepted","failed","error"]},"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"string"}}},"additionalProperties":true}}}}}}},"401":{"description":"Missing, invalid or revoked key, or a bad signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this endpoint needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Not an items array of 1–500","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; see the Retry-After header","headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/integrations/orders/batch":{"post":{"tags":["Orders"],"summary":"Import up to 500 items (orders.write)","operationId":"pushOrdersBatch","description":"Scope orders.write. Each item has the single-endpoint shape and succeeds or fails on its own. Body limit 10 MB; counts as one request for rate limits.","parameters":[{"name":"x-timestamp","in":"header","required":false,"schema":{"type":"string","description":"Unix seconds; required when the key requires signed requests"}},{"name":"x-signature","in":"header","required":false,"schema":{"type":"string","description":"sha256=<hex HMAC-SHA256(secret, x-timestamp + \".\" + rawBody)>"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["items"],"properties":{"items":{"type":"array","minItems":1,"maxItems":500,"items":{"$ref":"#/components/schemas/OrderPush"}}}}}}},"responses":{"200":{"description":"Per-item results, in request order","content":{"application/json":{"schema":{"type":"object","properties":{"summary":{"type":"object","properties":{"total":{"type":"integer"},"processed":{"type":"integer"},"accepted":{"type":"integer"},"failed":{"type":"integer"},"error":{"type":"integer"}}},"results":{"type":"array","items":{"type":"object","required":["index","status"],"properties":{"index":{"type":"integer"},"externalId":{"type":["string","null"]},"status":{"type":"string","enum":["processed","accepted","failed","error"]},"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"string"}}},"additionalProperties":true}}}}}}},"401":{"description":"Missing, invalid or revoked key, or a bad signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this endpoint needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Not an items array of 1–500","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; see the Retry-After header","headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/integrations/leads":{"post":{"tags":["Leads"],"summary":"Send a lead","operationId":"pushLead","description":"Scope leads.write. Processed in the background.","parameters":[{"name":"x-timestamp","in":"header","required":false,"schema":{"type":"string","description":"Unix seconds; required when the key requires signed requests"}},{"name":"x-signature","in":"header","required":false,"schema":{"type":"string","description":"sha256=<hex HMAC-SHA256(secret, x-timestamp + \".\" + rawBody)>"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadPush"}}}},"responses":{"202":{"description":"Accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Accepted"}}}},"401":{"description":"Missing, invalid or revoked key, or a bad signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this endpoint needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Invalid payload","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; see the Retry-After header","headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}}},"webhooks":{"customer.created":{"post":{"summary":"customer.created event","operationId":"onCustomerCreated","parameters":[{"name":"x-webhook-id","in":"header","schema":{"type":"string","description":"Event id; use it to drop duplicates"}},{"name":"x-webhook-event","in":"header","schema":{"type":"string","const":"customer.created"}},{"name":"x-webhook-timestamp","in":"header","schema":{"type":"string","description":"Unix seconds"}},{"name":"x-webhook-signature","in":"header","schema":{"type":"string","description":"sha256=<hex HMAC-SHA256(secret, timestamp + \".\" + rawBody)>"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","origin","data"],"properties":{"id":{"type":"string"},"type":{"type":"string","const":"customer.created"},"createdAt":{"type":"string","format":"date-time"},"origin":{"$ref":"#/components/schemas/EventOrigin"},"data":{"type":"object","properties":{"object":{"$ref":"#/components/schemas/Customer"}}}}}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds acknowledges the delivery"}}}},"customer.updated":{"post":{"summary":"customer.updated event","operationId":"onCustomerUpdated","parameters":[{"name":"x-webhook-id","in":"header","schema":{"type":"string","description":"Event id; use it to drop duplicates"}},{"name":"x-webhook-event","in":"header","schema":{"type":"string","const":"customer.updated"}},{"name":"x-webhook-timestamp","in":"header","schema":{"type":"string","description":"Unix seconds"}},{"name":"x-webhook-signature","in":"header","schema":{"type":"string","description":"sha256=<hex HMAC-SHA256(secret, timestamp + \".\" + rawBody)>"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","origin","data"],"properties":{"id":{"type":"string"},"type":{"type":"string","const":"customer.updated"},"createdAt":{"type":"string","format":"date-time"},"origin":{"$ref":"#/components/schemas/EventOrigin"},"data":{"type":"object","properties":{"object":{"$ref":"#/components/schemas/Customer"}}}}}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds acknowledges the delivery"}}}},"order.created":{"post":{"summary":"order.created event","operationId":"onOrderCreated","parameters":[{"name":"x-webhook-id","in":"header","schema":{"type":"string","description":"Event id; use it to drop duplicates"}},{"name":"x-webhook-event","in":"header","schema":{"type":"string","const":"order.created"}},{"name":"x-webhook-timestamp","in":"header","schema":{"type":"string","description":"Unix seconds"}},{"name":"x-webhook-signature","in":"header","schema":{"type":"string","description":"sha256=<hex HMAC-SHA256(secret, timestamp + \".\" + rawBody)>"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","origin","data"],"properties":{"id":{"type":"string"},"type":{"type":"string","const":"order.created"},"createdAt":{"type":"string","format":"date-time"},"origin":{"$ref":"#/components/schemas/EventOrigin"},"data":{"type":"object","properties":{"object":{"$ref":"#/components/schemas/Order"}}}}}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds acknowledges the delivery"}}}},"order.updated":{"post":{"summary":"order.updated event","operationId":"onOrderUpdated","parameters":[{"name":"x-webhook-id","in":"header","schema":{"type":"string","description":"Event id; use it to drop duplicates"}},{"name":"x-webhook-event","in":"header","schema":{"type":"string","const":"order.updated"}},{"name":"x-webhook-timestamp","in":"header","schema":{"type":"string","description":"Unix seconds"}},{"name":"x-webhook-signature","in":"header","schema":{"type":"string","description":"sha256=<hex HMAC-SHA256(secret, timestamp + \".\" + rawBody)>"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","origin","data"],"properties":{"id":{"type":"string"},"type":{"type":"string","const":"order.updated"},"createdAt":{"type":"string","format":"date-time"},"origin":{"$ref":"#/components/schemas/EventOrigin"},"data":{"type":"object","properties":{"object":{"$ref":"#/components/schemas/Order"}}}}}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds acknowledges the delivery"}}}}},"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"Error":{"type":"object","properties":{"statusCode":{"type":"integer"},"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"string"}},"path":{"type":"string"}}},"Accepted":{"type":"object","properties":{"status":{"type":"string","const":"accepted"},"eventId":{"type":"string"}}},"Address":{"type":"object","properties":{"line1":{"type":"string","maxLength":300},"line2":{"type":"string","maxLength":300},"city":{"type":"string","maxLength":100},"state":{"type":"string","description":"Region, state or province","maxLength":100},"postalCode":{"type":"string","maxLength":20},"country":{"type":"string","description":"ISO 3166-1 alpha-2","minLength":2,"maxLength":2}}},"Attribution":{"type":"object","properties":{"source":{"type":"string"},"medium":{"type":"string"},"campaignCode":{"type":"string"},"adRef":{"type":"string"},"term":{"type":"string"},"referralCode":{"type":"string"},"clickIds":{"type":"object","additionalProperties":{"type":["string","null"]}},"landingUrl":{"type":"string"},"referrer":{"type":"string"},"firstTouchAt":{"type":"string","format":"date-time"},"lastTouchAt":{"type":"string","format":"date-time"}}},"CustomerFields":{"type":"object","description":"Needs fullName (or firstName/lastName) and phone or email.","properties":{"externalId":{"type":"string","description":"Customer id on your platform","maxLength":100},"fullName":{"type":"string","maxLength":200},"firstName":{"type":"string","maxLength":100},"lastName":{"type":"string","maxLength":100},"phone":{"type":"string","description":"Any format; national numbers use address.country or the tenant default country","maxLength":40},"email":{"type":"string","format":"email","maxLength":200},"address":{"$ref":"#/components/schemas/Address"},"customFields":{"type":"object","description":"Your own fields","maxProperties":50,"additionalProperties":{"type":["string","number","boolean","null"]}}}},"CustomerPush":{"allOf":[{"$ref":"#/components/schemas/CustomerFields"},{"type":"object","required":["externalId"],"properties":{"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"attribution":{"$ref":"#/components/schemas/Attribution"}}}]},"CustomerPushResult":{"type":"object","properties":{"status":{"type":"string","enum":["processed"]},"eventId":{"type":"string"},"customerId":{"type":"string"},"created":{"type":"boolean"},"updated":{"type":"boolean"},"duplicate":{"type":"boolean"}}},"OrderItemPush":{"type":"object","required":["name","qty","unitPrice"],"properties":{"productExternalId":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string","maxLength":300},"category":{"type":"string"},"qty":{"type":"integer","minimum":1},"unitPrice":{"type":"number","minimum":0}}},"OrderPush":{"type":"object","required":["externalId","customer","total","placedAt"],"properties":{"externalId":{"type":"string","description":"Order id on your platform","maxLength":100},"customer":{"$ref":"#/components/schemas/CustomerFields"},"items":{"type":"array","maxItems":500,"items":{"$ref":"#/components/schemas/OrderItemPush"}},"total":{"type":"number","minimum":0},"currency":{"type":"string","description":"ISO 4217; defaults to the tenant currency","minLength":3,"maxLength":3},"paymentStatus":{"type":"string","enum":["pending","partial","paid","failed","refunded"],"default":"pending"},"deliveryStatus":{"type":"string","enum":["pending","dispatched","delivered","returned"],"default":"pending"},"status":{"type":"string","enum":["placed","confirmed","completed","cancelled"],"default":"placed"},"channel":{"type":"string","maxLength":40},"placedAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","description":"Decides which snapshot is newest; always send it","format":"date-time"},"metadata":{"type":"object","description":"Your own fields, returned as-is","maxProperties":50,"additionalProperties":{"type":["string","number","boolean","null"]}},"attribution":{"$ref":"#/components/schemas/Attribution"}}},"OrderPushResult":{"type":"object","properties":{"status":{"type":"string","enum":["processed"]},"eventId":{"type":"string"},"orderId":{"type":"string"},"customerId":{"type":"string"},"leadId":{"type":["string","null"]},"created":{"type":"boolean"},"stale":{"type":"boolean"},"duplicate":{"type":"boolean"}}},"LeadPush":{"type":"object","required":["externalId","name"],"properties":{"externalId":{"type":"string","description":"Unique per submission"},"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string","format":"email"},"city":{"type":"string"},"productInterest":{"type":"string"},"message":{"type":"string","maxLength":2000},"formKey":{"type":"string"},"channel":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"attribution":{"$ref":"#/components/schemas/Attribution"}}},"EventOrigin":{"type":"object","properties":{"via":{"type":"string","enum":["api","pull","form","user","system"]},"platform":{"type":["string","null"]}}},"Customer":{"type":"object","properties":{"object":{"type":"string","const":"customer"},"id":{"type":"string"},"fullName":{"type":"string"},"phone":{"type":["string","null"],"description":"E.164"},"phoneAlt":{"type":["string","null"]},"email":{"type":["string","null"]},"address":{"$ref":"#/components/schemas/Address"},"customFields":{"type":"object","description":"Custom fields","maxProperties":50,"additionalProperties":{"type":["string","number","boolean","null"]}},"segment":{"type":"string"},"originalSource":{"type":["string","null"]},"identities":{"type":"array","items":{"type":"object","properties":{"platform":{"type":"string"},"externalId":{"type":"string"}}}},"stats":{"type":"object","properties":{"totalOrders":{"type":"integer"},"totalRevenue":{"type":"number"},"firstPurchaseAt":{"type":["string","null"],"format":"date-time"},"lastPurchaseAt":{"type":["string","null"],"format":"date-time"}}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"Order":{"type":"object","properties":{"object":{"type":"string","const":"order"},"id":{"type":"string"},"platform":{"type":"string"},"externalId":{"type":"string"},"customerId":{"type":"string"},"status":{"type":"string","enum":["placed","confirmed","completed","cancelled"]},"paymentStatus":{"type":"string","enum":["pending","partial","paid","failed","refunded"]},"deliveryStatus":{"type":"string","enum":["pending","dispatched","delivered","returned"]},"total":{"type":"number"},"currency":{"type":"string"},"channel":{"type":["string","null"]},"items":{"type":"array","items":{"type":"object","properties":{"productExternalId":{"type":["string","null"]},"sku":{"type":["string","null"]},"name":{"type":"string"},"category":{"type":["string","null"]},"quantity":{"type":"integer"},"unitPrice":{"type":"number"},"lineTotal":{"type":"number"}}}},"attribution":{"type":"object","properties":{"source":{"type":["string","null"]},"campaignCode":{"type":["string","null"]},"referralCode":{"type":["string","null"]},"adRef":{"type":["string","null"]}}},"metadata":{"type":"object","description":"Platform fields","maxProperties":50,"additionalProperties":{"type":["string","number","boolean","null"]}},"placedAt":{"type":"string","format":"date-time"},"platformUpdatedAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}}}