Quickstart
Go from zero to a synced customer with an event on their timeline in about five minutes.
1. Create an API key
In the app, an administrator opens Settings → API keys and creates a key. Give it a name that says where it is used ("Webshop sync") and only the scopes it needs. For this guide: records:read, records:write and events:write.
The full key (it starts with cfk_) is shown once. Store it in your secret manager or environment:
export CRM_API_KEY="cfk_…"
2. Make your first request
List your contacts to check that the key works:
curl https://crm.codefab.dev/api/v1/objects/contact/records?limit=5 \-H "X-API-Key: $CRM_API_KEY"
You get a page of records and a nextCursor for the next page (or null at the end).
3. Upsert a customer
Upsert creates the record the first time and updates it after that, matched on your ID in externalId. That makes syncs safe to retry.
curl -X PUT https://crm.codefab.dev/api/v1/objects/contact/records:upsert \-H "X-API-Key: $CRM_API_KEY" \-H "Content-Type: application/json" \-d '{"externalId": "shop-10442","data": {"email": "anna.svensson@example.com","first_name": "Anna","last_name": "Svensson","locale": "sv"}}'
Field keys (email, first_name, …) come from your data model. Unknown fields or invalid values are rejected with a 400 that lists each problem; see Errors.
4. Send an event
Events must be registered first (the app does this under Settings → Events, or use the Event types API). With an order.placed event type in place:
curl -X POST https://crm.codefab.dev/api/v1/events \-H "X-API-Key: $CRM_API_KEY" \-H "Content-Type: application/json" \-d '{"eventType": "order.placed","subject": { "externalId": "shop-10442" },"payload": { "orderId": "SO-2291", "total": 1249, "currency": "SEK" }}'
The event appears on Anna's timeline in the app, and any automation triggered by order.placed picks her up.
Next steps
- Learn how records, objects and links fit together in Records & data model.
- React to changes in the CRM with Webhooks.
- Browse every endpoint in the API reference.