API guide

External record sync

Send changes to records from your own system to Ziqme as signed events.

Who this is for

For developers whose own system, such as a store, an ERP or a CRM you run, sends record changes to Ziqme. There is no ready-made adapter for any CRM or store: your code builds each event, signs it and sends it.

Each mapping receives one record kind: customer, sale, order, product, inventory or loyalty.

Set it up

A workspace admin does this once for each record kind, in “Tenant Admin” → “Integrations” → “External record mappings”.

  1. Create the mapping

    Choose the “Connector” and an “Approved capability”, enter the “Source system”, choose the “SmartDesk reference kind” and select “Add mapping”. Only a connector with an enabled tool that has an approved capability is offered.

  2. Record governance

    Under “Governance and publication readiness”, fill in “Processing region code”, “Retention days”, “DPA approval reference”, “Provider policy reference (optional)” and “Approved at”, then select “Save governance”. Enter approval identifiers only, never contract text or credentials.

  3. Set the webhook secret

    Under “Inbound webhook secret”, enter a “New webhook secret” of at least 32 bytes in UTF-8, for example 32 ASCII characters, and select “Replace secret”. Ziqme never shows the secret again, so keep it in your own system, which signs every event with it.

  4. Turn on inbound sync

    Tick “Allow inbound sync” and “Mapping enabled”, then select “Save”. A mapping can be enabled only when its capability, governance and secret are in place.

Each mapping card in “Tenant Admin” → “Integrations” shows its “Event address”, the full URL your system posts signed events to, with a “Copy” button. It already holds your workspace’s tenant id and the mapping id.

Send an event

Send each change as a JSON POST to the mapping’s address. There is no bearer token: the signature made with the mapping’s secret is the authentication, and an OAuth2 API client token is refused on this route.

Endpoint
POST https://api.ziqme.com/api/v1/integrations/external-sync/tenants/{tenantId}/mappings/{mappingId}/events

Headers

X-SmartDesk-TimestampThe time you signed the request, in Unix seconds.
X-SmartDesk-Signaturesha256= followed by the hexadecimal HMAC-SHA256 of the timestamp, a dot and the raw body, keyed with the mapping’s secret.
Content-TypeAlways application/json.

Body

A JSON object with camelCase names, at most 64 KB. A field that is not listed here is refused.

FieldTypeDescription
providerEventIdRequiredstringYour id for this event, up to 200 characters. It must be unique across every mapping on the same connector, not only this one. Resending the same id with the same body is a safe resend. Reusing an id with a different body is refused with 409, and the first event’s receipt is flagged as a conflict for review.
externalIdRequiredstringThe record’s id in your system, up to 200 characters.
sourceVersionRequiredstringThe record’s version in your system, up to 100 characters.
sourceSequenceRequiredintegerA number, 0 or more, that grows with every change to the record. A higher number is newer.
sourceOccurredAtUtcRequiredstring (ISO 8601)When the change happened in your system, as an ISO 8601 date and time.
subjectReferenceOptionalstringLinks the record to an existing Ziqme record, written as customer:<id> or opportunity:<id>, where <id> is a GUID. A bare GUID is read as a customer for Customer and Loyalty mappings and as an opportunity for Sale and Order mappings. Product and Inventory mappings need the prefix. Any other value is accepted but held as a conflict for review. Leave it out to keep the record unlinked. Up to 200 characters.
safeSummaryOptionalstringA short summary with no personal or secret data, up to 1,000 characters.
operationOptional"Upsert" | "Tombstone"Upsert, the default, creates or updates Ziqme’s external reference for the record: its id, version and summary, linked to the subjectReference. It does not create a Ziqme customer. Tombstone marks the external record deleted and keeps its history.
commercialOutcomeVerifiedOptionalbooleantrue when the event confirms the outcome of a sale or order. Only a Sale or Order mapping with “May verify commercial outcomes” turned on may send it. The default is false.
Sign and send (Node.js 18 or later)
import { createHmac } from 'node:crypto'

// The mapping's webhook secret, kept on your server only.
const secret = process.env.ZIQME_SYNC_SECRET
const url = 'https://api.ziqme.com/api/v1/integrations/external-sync'
  + '/tenants/YOUR_TENANT_ID/mappings/YOUR_MAPPING_ID/events'

const body = JSON.stringify({
  providerEventId: 'evt_10492',
  externalId: 'cust_8812',
  sourceVersion: '17',
  sourceSequence: 17,
  sourceOccurredAtUtc: '2026-11-27T09:30:00Z',
  operation: 'Upsert',
})
const timestamp = Math.floor(Date.now() / 1000).toString()
const signature = createHmac('sha256', secret)
  .update(`${timestamp}.${body}`)
  .digest('hex')

const response = await fetch(url, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-SmartDesk-Timestamp': timestamp,
    'X-SmartDesk-Signature': `sha256=${signature}`,
  },
  body,
})
// A 413 or 429 can arrive with an empty or non-JSON body, so parse only a JSON one.
const text = await response.text()
const isJson = response.headers.get('content-type')?.includes('json')
console.log(response.status, text && isJson ? JSON.parse(text) : text)

Responses

202Accepted. The answer carries receiptId, status, replayed and errorCode. Resending an event already received answers again, with replayed: true.
400The body is empty, larger than 64 KB or not valid JSON, has a field not listed above, or names an unknown operation.
401The signature does not match or its timestamp is too far from Ziqme’s clock, or the mapping is unknown, has inbound sync turned off or has no secret.
403The mapping may not accept this event, for example commercialOutcomeVerified: true without permission.
409This event id was already received with different content, or another event for the same record (externalId) has the same sourceSequence with different content.
413The body is over 64 KB. It can be refused before Ziqme reads it. When the declared Content-Length is over the limit, the answer is 400 instead.
429The Gateway’s rate limit. The body may be empty. Wait, then send the same event again: resending is safe.

Before you go live

  • Resending is safe

    After a timeout or a 5xx answer, send the same body with the same providerEventId again. Ziqme keeps the event once and answers replayed: true.

  • Order

    An event whose sourceSequence is lower than the latest one received for the record is kept, marked out of order, and not applied. Reuse a sequence number only with the same content.

  • Size

    Each request carries one event of at most 64 KB.

  • Clock

    By default, a timestamp more than 300 seconds from Ziqme’s clock is refused. Keep your server’s clock synchronized and sign each request just before sending it.

  • Secret

    Keep the secret on your server, never in a browser page or a mobile app. To rotate it, replace it under “Inbound webhook secret” and update your system at the same time: events signed with the old secret are refused from then on.

When something needs a person

In the Customer app, “External records” lists each linked record and whether it is in sync. “Review” on a record opens its receipt, where you choose “Queue replay” or “Resolve without replay”. Merged customer records whose external ids collide wait under “Post-merge identity review” in “Tenant Admin” → “Integrations”.