MIRQAM MARKETING / DEVELOPERSManage API keys ↗
CUSTOM STORE API · VERSION 1

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.

BASE URLhttps://marketing.mirqam.sa/api/v1
Store-scopedIndependent keys & permissions
Versioned updatesSafe retries without duplicates
Server to serverHTTPS + Bearer authentication
01 / GET CONNECTED

Quick start

  1. Create your store

    Sign in to Mirqam, open Custom store · API, and add your store name, HTTPS URL and optional logo URL.

  2. Generate a scoped key

    Select only the permissions your integration needs. Save the key in a secret environment variable on your server.

  3. 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.

Subscription per store

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.

02 / SECURE ACCESS

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/json

Keys 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.

03 / REFERENCE

Endpoints

Method & pathPermissionPurpose
GET /storeAny valid keyStore details and key scopes
PATCH /storestore:writeUpdate name, URL or logo
PUT /ordersorders:writeCreate or update orders and refunds
PUT /productsproducts:writeStore product catalog records
PUT /customerscustomers:writeStore customer analytics attributes
04 / FIRST REQUEST

Send an order

Set MIRQAM_API_KEY in your server environment, then send a complete order snapshot.

cURL · PUT /orders
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"}
  }]}'
200 · Response
{"results":[{"id":"order-1001","status":"accepted"}]}
Use meaningful data

Examples are illustrative. Data sent to your store enters its actual reports. Version 1 does not include a separate sandbox environment.

Order fields

FieldRequirementFormat
idRequiredStable external ID, 1–100 characters: letters, digits, _ . : -
versionRequiredPositive safe integer; increase with every change
createdAt, updatedAtRequiredISO 8601 timestamp with timezone
statusRequiredOne of the order states below
currencyRequiredThree uppercase letters, for example SAR
totalRequiredNon-negative amount before refunds
refundedOptional; defaults to 0Cumulative refunded amount, no greater than total
tax, shipping, discountOptionalNon-negative monetary amounts
itemsOptionalUp to 100 items; each requires id, name, quantity and total. SKU is optional.
customerOptionalRequires id when supplied; gender, country and city are optional
source, paymentMethod, paymentStatusOptionalRecorded source and payment attributes
attributionOptionalRecorded 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.

PUT /products · products:write
{"records":[{
  "id":"product-8","version":1,"name":"Example product",
  "sku":"SKU-8","price":115,"currency":"SAR"
}]}
PUT /customers · customers:write
{"records":[{
  "id":"customer-42","version":1,"gender":"unknown",
  "country":"SA","city":"Riyadh"
}]}
PATCH /store · store:write
{
  "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

50 recordsMaximum per batch
100 KBMaximum request body
120 / minuteRequests per API key

The shared IP limit is 180 requests per minute. On HTTP 429, honor Retry-After and use increasing retry delays.

StatusMeaningNext step
400Invalid dataFix the request using the error message
401Invalid or revoked keyCheck the Bearer token
402Store access expiredContact Mirqam to renew access
403Missing scope, suspended access or browser requestCheck permissions, account status and request origin
429Rate limit exceededWait for Retry-After before retrying
500Temporary server errorRetry 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.