Getting started
- Register your company as an integration partner using the form on the Partners page. Approval unlocks the partner Portal.
- In the partner Portal, open the test store: a store on the full version, with no time limit, just for your team to test.
- In the test store, under ERP integration, create the API key. It is shown only once; keep it like a password.
- Pair a tablet as an integrated tablet, or open the tablet in a computer browser to test.
- Send the first sale with the example below, or use the Simulator tab in the integration to see a ready-made sale on the tablet.
- When the integration is ready, let our team know: your system joins the list of systems that integrate and you download the seal in the partner Portal.
Integrate with the help of an AI
Whoever programs the ERP can build the integration with an AI assistant such as Claude Code, Cursor or Copilot. The AI kit is a file with instructions for the AI, the API summary and a sample program with the points to adjust marked CUSTOMIZE.
- Download the kit with the button below and save erp-integration-ai-kit.md in the ERP project folder.
- Open the AI assistant in that folder and paste the sentence below.
- The AI reads the ERP code and asks only what it cannot find out by itself: where the sale opens and closes, how the checkout is identified, how PIX is generated, what happens offline and other details of the system.
- With the answers, it writes the module, shows the points it adjusted and tests with the test store key before any real store.
Read erp-integration-ai-kit.md in this folder and follow its "Instructions for the AI assistant". Ask me the questions it lists before writing any code.The AI helps, but the developer is responsible for the code: review what it writes and test in the test store before turning it on in the stores.
API address
| API | https://api.smiloo.io |
|---|
Authentication
Authorization: Bearer smk_live_ab12cd34_xxxxxxxxxxxxxxxxxxxxxxxxEvery call carries the API key in the header. The store comes from the key, never from the URL. A missing, revoked or expired key returns 401 API_KEY_INVALID: show the error to the operator and do not retry in a loop.
Limits per key: 600 per minute when sending events and 120 per minute for queries. Above that, 429 RATE_LIMITED: wait a few seconds and send again.
Event envelope
Everything that happens at the checkout becomes an event. They all share the same envelope:
{
"eventId": "store1-pos2-000123-0005",
"type": "sale.item_added",
"occurredAt": "2026-11-04T14:03:21-03:00",
"deviceId": "0193a2b4-5c6d-7e8f-9a0b-1c2d3e4f5a6b",
"saleId": "000123",
"seq": 5,
"data": { }
}| Field | What it is |
|---|---|
eventId | Up to 100 characters, unique per store. It is the idempotency key. A good format is store + checkout + sale + seq. |
type | Event type (table below). |
occurredAt | When it happened at the checkout, ISO 8601 with time zone. |
deviceId | Integrated tablet that shows the sale (from the tablets query). |
saleId | Sale id in the ERP, up to 100 characters. |
seq | 1, 2, 3... per sale, in the order the events happened. |
data | Fields of the event type. |
- Money in whole cents (4590 = 45.90), in the store currency.
- Quantity with up to 3 decimals, never zero, negative on exchanges.
- Person (seller or cashier) = { erpCode, name }, with the same ERP code as the team member in the Portal.
- Item = { itemId, name, quantity, unit, unitPriceCents, totalCents }. Sending the same itemId again updates the line.
- Send one event per call or a batch { events: [...] } with up to 100 events, up to 2 MB.
The events
The fields of each type are in the OpenAPI contract.
| Event | When to send it and what the tablet shows |
|---|---|
sale.started | Sale opened. Shows the empty list with the customer greeting. If the store uses service types, send the type code in serviceType (optional). Always send the cashier in cashier and the full customer in customer (omit customer when the customer is not identified). |
sale.customer_changed | Customer changed during the sale. The greeting changes at once; the customer at the end of the sale counts. customer: null = not identified. |
sale.item_added | Item registered. The list scrolls to the item. |
sale.item_cancelled | Item cancelled. The item appears struck through. |
sale.totals_updated | Totals changed (a discount, for example). |
sale.snapshot | Snapshot of the whole sale: when switching screens at the checkout, when opening the ERP and after an outage. |
sale.totalized | Sale closed for payment. Shows the summary. With `ratingWaitSeconds`, the tablet goes back to the faces while the ERP waits for the rating. |
sale.back_to_items | Back to registering items. |
payment.method_selected | Payment method chosen. |
payment.pix_requested | Instant payment QR generated. Shows the QR full screen. |
payment.confirmed | Payment approved. |
payment.failed | Payment declined. Back to the summary. |
sale.finished | Sale finished. The tablet asks for the rating and says thanks. |
sale.cancelled | Sale abandoned, quote or return without purchase. No rating. |
staff.ask | Asks the customer "Who served you", even if it is off in the Portal. |
staff.confirm | Asks the customer whether the given seller served them. "Someone else" opens the list. |
sale.voided | Sale cancelled after it was finished. The rating leaves the indicators. |
register.opened | Register opened at the POS (no saleId or seq). The latest one counts. |
register.closed | Register closed at the POS or in the ERP (no saleId or seq). With no sale, the tablet shows "Checkout closed" or the ads. |
A complete sale
Sale with two items, one cancelled, paid with instant payment:
| seq | type | The customer sees on the tablet |
|---|---|---|
| 1 | sale.started | The greeting and the empty list |
| 2 | sale.item_added | The first item on the list |
| 3 | sale.item_added | The second item |
| 4 | sale.item_cancelled | The second item struck through |
| 5 | sale.totalized | The summary with the total |
| 6 | payment.method_selected | "Pay with instant payment" |
| 7 | payment.pix_requested | The payment QR |
| 8 | payment.confirmed | "Payment approved" |
| 9 | sale.finished | The service rating, then the thank you |
- If the customer gives up before the payment is approved, send sale.cancelled with the next seq.
- If the internet drops, keep the events in a local queue. When it is back, first send a sale.snapshot of the current sale and then the missing events.
- The checkout must never wait for the API: send events in the background, with a short timeout (2 to 5 s), and keep selling if it is down.
Response and errors
Sending returns 200 whenever the body is acceptable, even if some event in the batch is rejected. Each event is validated on its own.
{
"accepted": ["store1-pos2-000123-0001", "store1-pos2-000123-0002"],
"duplicates": ["store1-pos2-000123-0003"],
"rejected": [
{ "eventId": "store1-pos2-000123-0004", "error": "VALIDATION_ERROR", "path": "data.quantity" }
]
}| Where | Code | What to do |
|---|---|---|
rejected[].error | VALIDATION_ERROR | Invalid field, pointed out in path. Fix it and send again with the same eventId. |
rejected[].error | DEVICE_NOT_FOUND | The tablet is not integrated, paired and from this store. Update the checkout and tablet map with the tablets query. |
rejected[].error | SALE_NOT_FOUND | Only on sale.voided: the sale has not arrived yet. Send again later. |
HTTP 400 | VALIDATION_ERROR | The body is neither an event nor a batch. |
HTTP 400 | BATCH_TOO_LARGE | More than 100 events in the batch. Split it. |
HTTP 401 | API_KEY_INVALID | Wrong, revoked or expired key. Stop and tell the operator. |
HTTP 422 | PLAN_FEATURE_LOCKED | The store plan does not include the integrated tablet. Stop and tell the operator. |
HTTP 429 | RATE_LIMITED | Above the per-minute limit. Wait and send again. |
HTTP 5xx | Send the same batch again later, with increasing waits (2 s, 4 s, 8 s...). |
Idempotency and order
- Same eventId, same event: sending again is safe, it comes back in duplicates and changes nothing. When in doubt, send again.
- A rejected event is not stored: it can be fixed and sent with the same eventId.
- An event accepted and ignored (an item after the payment was approved, for example) also comes back in accepted.
- The next seq is applied right away. If one is missing, the following ones wait up to 5 s and are then applied in order. Never reuse a seq in the same sale.
Queries
GET /v1/erp/devices | Paired integrated tablets of the store. Keep, for each checkout, the id of the tablet next to it. |
|---|---|
GET /v1/erp/staff | Active team with the ERP code and the roles. |
GET /v1/erp/sales/{saleId}/rating | The rating of a sale, by the sale id in the ERP. |
PUT /v1/erp/users | All ERP users (code, name and login, if any). The list replaces the previous one, and the merchant links each team member by name. |
Example with curl
Use the test store key: it uses the same API address, so what you test is exactly what stores use. Read the key from a file or variable, never leave it in the code.
API=https://api.smiloo.io
KEY=smk_live_xxxxxxxx_xxxxxxxxxxxxxxxx
curl -s "$API/v1/erp/devices" -H "Authorization: Bearer $KEY"
curl -s "$API/v1/erp/events" \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{
"events": [
{ "eventId": "store1-pos2-000123-0001", "type": "sale.started",
"occurredAt": "2026-11-04T14:03:00-03:00",
"deviceId": "0193a2b4-5c6d-7e8f-9a0b-1c2d3e4f5a6b",
"saleId": "000123", "seq": 1, "data": {} },
{ "eventId": "store1-pos2-000123-0002", "type": "sale.item_added",
"occurredAt": "2026-11-04T14:03:21-03:00",
"deviceId": "0193a2b4-5c6d-7e8f-9a0b-1c2d3e4f5a6b",
"saleId": "000123", "seq": 2,
"data": { "itemId": "1", "name": "Coffee 500 g", "quantity": 2, "unit": "UN",
"unitPriceCents": 1795, "totalCents": 3590 } }
]
}'Ready for stores
Once the integration works in the test store, let our team know. Your system joins the list of systems that integrate and you download the "Works with Smiloo" seal in the partner Portal.