Your store.
Connected insights.
Bring your custom-built store into Mirqam Marketing. Send orders from your server and explore sales, products, customer demographics and order sources in one dashboard.
https://marketing.mirqam.sa/api/v1Quick start
- Create your store
Sign in to Mirqam, open Custom store · API, and add your store name, HTTPS URL and optional logo URL.
- Generate a scoped key
Select only the permissions your integration needs. Save the key in a secret environment variable on your server.
- Send your data
Import historical orders in batches, then send every new order and subsequent update using the same external ID and an increasing version.
A 15-day trial starts when you create the store. Pricing is SAR 99 monthly or SAR 999 annually. Paid activation is currently handled by Mirqam administration; this API does not charge you automatically. Ingestion pauses when access expires.
Authentication
Send these headers with each request. Every key belongs to exactly one store and cannot sign in to the dashboard or access another store.
Authorization: Bearer YOUR_API_KEY
Content-Type: application/jsonKeys are shown once. Keep them on your server, never in browser JavaScript or a mobile app. Browser requests with an Origin header are rejected. To rotate a key, create its replacement, update your server, then revoke the old key in the dashboard.
Endpoints
| Method & path | Permission | Purpose |
|---|---|---|
GET /store | Any valid key | Store details and key scopes |
PATCH /store | store:write | Update name, URL or logo |
PUT /orders | orders:write | Create or update orders and refunds |
PUT /products | products:write | Store product catalog records |
PUT /customers | customers:write | Store customer analytics attributes |
Send an order
Set MIRQAM_API_KEY in your server environment, then send a complete order snapshot.
curl -X PUT https://marketing.mirqam.sa/api/v1/orders \
-H "Authorization: Bearer $MIRQAM_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"records":[{
"id":"order-1001","version":1,
"createdAt":"2026-10-09T12:00:00+03:00",
"updatedAt":"2026-10-09T12:00:00+03:00",
"status":"completed","currency":"SAR",
"total":115,"refunded":0,
"tax":15,"shipping":0,"discount":0,
"source":"web","paymentMethod":"mada","paymentStatus":"paid",
"customer":{
"id":"customer-42","gender":"unknown",
"country":"SA","city":"Riyadh"
},
"items":[{
"id":"product-8","name":"Example product","sku":"SKU-8",
"quantity":1,"total":115
}],
"attribution":{"source":"google","medium":"cpc","campaign":"summer"}
}]}'{"results":[{"id":"order-1001","status":"accepted"}]}Examples are illustrative. Data sent to your store enters its actual reports. Version 1 does not include a separate sandbox environment.
Order fields
| Field | Requirement | Format |
|---|---|---|
id | Required | Stable external ID, 1–100 characters: letters, digits, _ . : - |
version | Required | Positive safe integer; increase with every change |
createdAt, updatedAt | Required | ISO 8601 timestamp with timezone |
status | Required | One of the order states below |
currency | Required | Three uppercase letters, for example SAR |
total | Required | Non-negative amount before refunds |
refunded | Optional; defaults to 0 | Cumulative refunded amount, no greater than total |
tax, shipping, discount | Optional | Non-negative monetary amounts |
items | Optional | Up to 100 items; each requires id, name, quantity and total. SKU is optional. |
customer | Optional | Requires id when supplied; gender, country and city are optional |
source, paymentMethod, paymentStatus | Optional | Recorded source and payment attributes |
attribution | Optional | Recorded source, medium and campaign strings |
Order states & refunds
pending, processing, completed, cancelled, failed, refunded, partially_refunded, draft.
A fully refunded order requires refunded = total. A partial refund must be greater than zero and less than total. To cancel or correct an order, send the complete record with a higher version. There is no permanent-delete endpoint.
How the data becomes analytics
Top-product reports use order line items, not the separate catalog. Geographic reports use the order’s customer attributes. Repeat purchases use customer.id within each store; identities are not merged across stores. Currencies remain separate.
Customer gender accepts male, female or unknown. Missing attributes remain unavailable. Only send recorded attribution; do not infer gender from names or invent campaign sources. Do not send customer names, emails or phone numbers.
Products & customers
Use the same records envelope and version rules for both resources. Customer records do not retroactively rewrite customer snapshots inside earlier orders.
{"records":[{
"id":"product-8","version":1,"name":"Example product",
"sku":"SKU-8","price":115,"currency":"SAR"
}]}{"records":[{
"id":"customer-42","version":1,"gender":"unknown",
"country":"SA","city":"Riyadh"
}]}{
"name":"My store",
"url":"https://store.example",
"logo":"https://store.example/logo.png"
}Updates & safe retries
IDs are unique within a store and resource. A newer version returns accepted; repeating the same version or sending an older version returns unchanged. Each PUT replaces the full record, so include all fields you want to retain.
Do not repeat IDs within a batch. All records are validated before writing, but a database interruption may leave part of a batch saved. Resend the same records and versions safely after network errors or HTTP 5xx responses.
Errors & limits
The shared IP limit is 180 requests per minute. On HTTP 429, honor Retry-After and use increasing retry delays.
| Status | Meaning | Next step |
|---|---|---|
| 400 | Invalid data | Fix the request using the error message |
| 401 | Invalid or revoked key | Check the Bearer token |
| 402 | Store access expired | Contact Mirqam to renew access |
| 403 | Missing scope, suspended access or browser request | Check permissions, account status and request origin |
| 429 | Rate limit exceeded | Wait for Retry-After before retrying |
| 500 | Temporary server error | Retry with the same record versions |
{"error":"Invalid API key"}The dashboard shows the last 50 authenticated API requests per store, including time, resource, method and HTTP status. Diagnostic logs exclude API keys and request bodies.
Test and live keys
Create an API key in the dashboard and select Test or Live. Test keys begin with mm_test_; live keys begin with mm_live_. Both use the same endpoints and permission checks. Test writes validate the payload and return persisted: false without modifying store data, orders, products, customers or sales reports. Requests are logged. Live writes require an active store subscription or trial.
Switch to a separately generated live key after validation. Never place either key in client-side code.