Quick start in 5 minutes
- Turn on API access. In the seller center open API and ask for access. Once your shop is approved, the page lets you make keys.
- Create a key. Choose only the scopes your system needs, an expiry and your server addresses, then copy the key. It is shown once.
- Make your first call. Send the key in the
Authorizationheader.GET /v1/shop/meanswers with your shop, the key’s scopes and its limits. - Receive webhooks. Add an https URL on a public host, pick the events, copy the
whsec_signing secret and press Send ping. Check the signature before you trust a request.
curl
curl https://api.odinmax.com/v1/shop/me \
-H "Authorization: Bearer $ODINMAX_API_KEY"Try everything on the sandbox first: https://demo-api.odinmax.com with test data (see Sandbox below).
Keys and scopes
Every request carries Authorization: Bearer odx_live_.... A key belongs to one shop and can never do more than the team member who made it: on every call we check both the key’s scope and that member’s current rights in the shop. If the member leaves the shop or loses the right, their keys stop working.
| Scope | Allows |
|---|---|
shop.read | Read the shop profile and who the key belongs to |
shop.write | Change the profile, opening hours and vacation |
listings.read | Read your listings and price suggestions |
listings.write | Create, edit, submit, copy and delete listings; upload images |
stock.read | Read delivery-code counts |
stock.write | Add and remove delivery codes |
orders.read | Read your orders (no buyer contact details) |
orders.fulfill | Deliver, cancel and answer cancel requests |
chat.read | Read order chats, buyer questions and quick replies |
chat.write | Reply in chats and keep quick replies |
reviews.read | Read reviews |
reviews.write | Reply to reviews |
disputes.read | Read reported problems |
disputes.write | Appeal and settle warranty claims |
promotions.read | Read bumps and featured spots |
promotions.write | Bump listings |
promotions.spend | Buy featured spots with shop credit (off until switched on for your shop) |
analytics.read | Read sales figures |
finance.read | Read balances and the statement |
finance.withdraw | Ask for a withdrawal that the owner confirms (off until switched on for your shop) |
team.read | Read the shop team |
webhooks.manage | Create webhooks, see deliveries and send them again |
- Expiry. Choose 30, 90 or 365 days. Only a key that can do nothing but read may have no expiry.
- Server addresses. List the IP addresses or CIDR ranges your servers call from; calls from anywhere else get
403 API_KEY_IP_DENIED. Required for keys withfinance.read,finance.withdraworpromotions.spend, and recommended for every key. - Scopes your shop can give. The scopes on offer grow with your shop rank.
finance.withdrawandpromotions.spendstay off until ODINMAX switches them on for your shop. - Keep keys on your server only: never in a browser, a mobile app or a public repository.
- Give each system its own key with the fewest scopes, so you can revoke one without stopping the others.
- If a key may have leaked, revoke it in the seller center at once and create a new one.
Rate limits
Each key starts at 120 requests a minute and gets more as your shop rank grows. All keys of one shop together get five times a key’s limit (at least 600 a minute), and one IP address gets 300 a minute. GET /v1/shop/me tells you your key’s limit. Over the limit you get 429 with code RATE_LIMITED. Wait and retry with growing delays and a little randomness.
Node.js
async function call(url, init, attempt = 0) {
const res = await fetch(url, init);
if ((res.status === 429 || res.status >= 500) && attempt < 5) {
const wait = Math.min(60_000, 1000 * 2 ** attempt) + Math.random() * 500;
await new Promise((r) => setTimeout(r, wait));
return call(url, init, attempt + 1);
}
return res;
}Every reply will carry RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset, so you can slow down before you hit the limit.
Safe retries
Every write to /v1/shop (POST, PUT, PATCH, DELETE) needs an Idempotency-Key header: any unique string of letters, digits and _ . : -, up to 255 characters. Use a new one for each change you mean to make, and the same one when you retry that change.
curl
curl -X PATCH https://api.odinmax.com/v1/shop/listings/AB12CD34 \
-H "Authorization: Bearer $ODINMAX_API_KEY" \
-H "Idempotency-Key: price-AB12CD34-2026-12-07" \
-H "Content-Type: application/json" \
--data '{"price":{"amount":"35500","currency":"THB"}}'- Within 24 hours, a repeat with the same key and the same request returns the first reply, with the header
Idempotent-Replayed: true, and the work is not done twice. - The same key with a different request gets
422 IDEMPOTENCY_KEY_REUSED. - If the first request is still running you get
409 IDEMPOTENCY_IN_PROGRESS: wait a moment and send it again. - Older
/v1/publicroutes accept the header too, but do not require it. - Webhook deliveries can arrive more than once: keep the
X-Odinmax-Deliveryid and skip repeats.
Lists and pages
Long lists come in pages: { "items": [...], "nextCursor": "..." }. Send nextCursor back as cursor for the next page; when it is null you have everything. limit is 1 to 100 (default 50). Orders come newest first.
Node.js
let cursor = null;
do {
const url = new URL('https://api.odinmax.com/v1/shop/orders');
url.searchParams.set('limit', '100');
if (cursor) url.searchParams.set('cursor', cursor);
const res = await fetch(url, { headers: { Authorization: `Bearer ${key}` } });
const { items, nextCursor } = await res.json();
for (const order of items) await save(order);
cursor = nextCursor;
} while (cursor);GET /v1/shop/ordersandGET /v1/shop/webhook-deliveriespage this way. A chat thread pages back in time withbefore(the id of the oldest message you have). Each route in the reference says how it pages.- Ignore fields you do not know: new fields can be added at any time without a new version.
Errors
Errors are JSON with a stable code, never a sentence. Decide in your system on the code; show your own text to your team.
HTTP
HTTP/1.1 404 Not Found
Content-Type: application/json
{ "code": "LISTING_NOT_FOUND" }| Status | Code | Meaning |
|---|---|---|
| 400 | VALIDATION_FAILED | The body or a parameter is not valid |
| 400 | IDEMPOTENCY_KEY_REQUIRED | A write without an Idempotency-Key |
| 401 | API_KEY_INVALID | The key is wrong or revoked |
| 401 | API_KEY_EXPIRED | The key passed its expiry date |
| 401 | API_KEY_WRONG_ENVIRONMENT | A sandbox key on production, or the reverse |
| 403 | API_KEY_IP_DENIED | The call came from an address the key does not allow |
| 403 | API_SCOPE_MISSING | The key lacks the scope this route needs |
| 403 | API_SCOPE_NOT_ALLOWED | Your shop can no longer give keys this scope |
| 403 | API_KEY_CREATOR_FORBIDDEN | The team member who made the key no longer has this right in the shop |
| 403 | API_ACCESS_NOT_APPROVED | API access for your shop is not approved yet |
| 403 | SHOP_API_SUSPENDED | API access for your shop is on hold |
| 403 | SHOP_RESTRICTED | The shop is closed or restricted |
| 403 | SHOP_PAUSED | The shop is paused: reading only |
| 404 | LISTING_NOT_FOUND | No such listing in your shop |
| 404 | ORDER_NOT_FOUND | No such order in your shop |
| 409 | IDEMPOTENCY_IN_PROGRESS | The first request with this key is still running |
| 409 | STOCK_NOT_AUTO | The listing does not deliver automatically |
| 422 | IDEMPOTENCY_KEY_REUSED | The same Idempotency-Key with a different request |
| 429 | RATE_LIMITED | Too many requests: wait and retry |
| 503 | API_READ_ONLY | Writes are paused for a short time: reads still work |
| 503 | API_DISABLED | The API is paused for a short time |
Retry 429 and 5xx with a delay. Do not retry other 4xx replies unchanged: fix the request first.
Money amounts
Every amount is an object with amount in the currency’s minor unit as a string and an ISO 4217 currency. {"amount":"35500","currency":"THB"} is 355.00 baht. Never turn amounts into floating-point numbers.
Node.js
// "35500" THB = 355.00 baht. Keep amounts as BigInt; never parse them as floats.
const amount = BigInt(order.subtotal.amount);
const total = amount * 2n;Python
from decimal import Decimal
amount = int(order["subtotal"]["amount"]) # 35500 (satang), exact
baht = Decimal(amount) / 100 # Decimal('355.00') for display onlyWithdrawals
With finance.withdraw your system can ask for a withdrawal, but it can never take money out on its own. The scope stays off until ODINMAX switches it on for your shop, and the key must list your server addresses.
POST /v1/shop/withdrawalswith the amount, currency and one of your saved payout accounts. The reply has statusPENDING_OWNER.- The shop owner gets an email with a code and confirms the withdrawal in the seller center within 24 hours.
- Once confirmed, the withdrawal goes through the same checks as one made in the seller center. If the owner declines or does nothing, it ends as
DECLINEDorEXPIRED.
Follow each request with GET /v1/shop/withdrawals, and the payout.paid and payout.failed events.
Webhooks and signatures
We send a POST with a JSON body to your URL when something happens. Make webhooks in the seller center or with POST /v1/shop/webhooks, and choose the events each one gets.
| Event | When |
|---|---|
order.created | A buyer placed an order (not paid yet) |
order.paid | The order is paid: deliver now |
order.delivered | The order was marked delivered |
order.completed | The buyer confirmed, or the order completed on its own |
order.cancelled | The order was cancelled |
order.refunded | The buyer got the money back |
dispute.opened | The buyer reported a problem |
dispute.updated | Something changed in a reported problem, such as an appeal |
dispute.resolved | A reported problem has a final outcome |
warranty.claimed | The buyer made a warranty claim |
chat.message | A new chat message for your shop |
review.created | A buyer left a review |
listing.approved | A listing passed review and is on sale |
listing.rejected | A listing did not pass review |
listing.out_of_stock | A listing sold out |
stock.low | Few delivery codes are left on a listing |
payout.paid | A withdrawal reached your account |
payout.failed | A withdrawal could not be sent |
shop.restricted | Your shop was restricted |
shop.reinstated | Your shop is open again |
api_key.revoked | One of your keys stopped working |
ping | The test you send yourself |
| Header | Meaning |
|---|---|
X-Odinmax-Signature | t=<unix seconds>,v1=<hex HMAC-SHA256> of the text t.body with your whsec_ secret |
X-Odinmax-Event | The event name, the same as type in the body |
X-Odinmax-Delivery | Unique per delivery: use it to skip repeats |
- Read the raw body before any JSON parsing.
- Compute HMAC-SHA256 of
t + "." + bodywith your secret and compare it withv1in constant time. - Reject the request if
tis more than 5 minutes away from your clock. - Reply
2xxwithin 10 seconds, then do the slow work in the background.
A delivery that fails is tried again up to 8 times over about two days (after 1 minute, 5 minutes, 30 minutes, then 2, 6, 12 and 24 hours). After 50 failures in a row the webhook is switched off and the shop owner is told; switch it back on with POST /v1/shop/webhooks/{id}/enable.
GET /v1/shop/webhook-deliverieslists the last 30 days of deliveries. Filter bywebhookId,status(PENDING,DELIVERED,FAILED) orevent.POST /v1/shop/webhook-deliveries/{id}/redeliversends one again with the same body and a fresh signature, for example after you fixed your server.POST /v1/shop/webhooks/{id}/testsends aping.
curl (send yourself a signed test)
# Send a signed test delivery to your own endpoint (bash + openssl)
SECRET="whsec_..."
BODY='{"id":"evt_test","type":"ping","createdAt":"2026-12-06T12:00:00.000Z","data":{}}'
T=$(date +%s)
SIG=$(printf '%s.%s' "$T" "$BODY" | openssl dgst -sha256 -hmac "$SECRET" -hex | sed 's/^.* //')
curl -X POST https://your-server.example/odinmax/webhook \
-H "Content-Type: application/json" \
-H "X-Odinmax-Event: ping" \
-H "X-Odinmax-Delivery: test-1" \
-H "X-Odinmax-Signature: t=$T,v1=$SIG" \
--data "$BODY"Node.js (Express)
import crypto from 'node:crypto';
import express from 'express';
const app = express();
const secret = process.env.ODINMAX_WEBHOOK_SECRET; // whsec_...
// Read the raw body: the signature covers the bytes exactly as sent.
app.post('/odinmax/webhook', express.raw({ type: 'application/json' }), (req, res) => {
const parts = Object.fromEntries(
(req.get('X-Odinmax-Signature') ?? '').split(',').map((p) => p.split('=')),
);
const body = req.body.toString('utf8');
const expected = crypto.createHmac('sha256', secret).update(`${parts.t}.${body}`).digest('hex');
const given = Buffer.from(parts.v1 ?? '', 'hex');
const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
const valid =
fresh && given.length === 32 && crypto.timingSafeEqual(given, Buffer.from(expected, 'hex'));
if (!valid) return res.status(400).end();
// Skip a delivery you have already handled (store the id in your database).
const deliveryId = req.get('X-Odinmax-Delivery');
handleOnce(deliveryId, JSON.parse(body));
res.status(200).end();
});Python (Flask)
import hashlib, hmac, os, time
from flask import Flask, request
app = Flask(__name__)
SECRET = os.environ["ODINMAX_WEBHOOK_SECRET"].encode() # whsec_...
@app.post("/odinmax/webhook")
def odinmax_webhook():
header = request.headers.get("X-Odinmax-Signature", "")
parts = dict(p.split("=", 1) for p in header.split(",") if "=" in p)
t = parts.get("t", "")
body = request.get_data() # raw bytes, exactly as received
expected = hmac.new(SECRET, t.encode() + b"." + body, hashlib.sha256).hexdigest()
fresh = t.isdigit() and abs(time.time() - int(t)) < 300
if not fresh or not hmac.compare_digest(expected, parts.get("v1", "")):
return "", 400
# Skip a delivery you have already handled (store the id in your database).
handle_once(request.headers["X-Odinmax-Delivery"], request.get_json())
return "", 200PHP
<?php
$secret = getenv('ODINMAX_WEBHOOK_SECRET'); // whsec_...
$body = file_get_contents('php://input'); // raw body, exactly as received
$parts = [];
foreach (explode(',', $_SERVER['HTTP_X_ODINMAX_SIGNATURE'] ?? '') as $p) {
[$k, $v] = array_pad(explode('=', $p, 2), 2, '');
$parts[$k] = $v;
}
$t = $parts['t'] ?? '';
$expected = hash_hmac('sha256', $t . '.' . $body, $secret);
$fresh = ctype_digit($t) && abs(time() - (int) $t) < 300;
if (!$fresh || !hash_equals($expected, $parts['v1'] ?? '')) {
http_response_code(400);
exit;
}
// Skip a delivery you have already handled (store the id in your database).
handle_once($_SERVER['HTTP_X_ODINMAX_DELIVERY'], json_decode($body, true));
http_response_code(200);Sandbox
The sandbox at https://demo-api.odinmax.com works like production with test data: no real money, no real buyers. Create sandbox keys in the sandbox seller center at https://demo.odinmax.com.
- Keys show where they work:
odx_live_for production andodx_test_for the sandbox. A key used in the wrong place gets401 API_KEY_WRONG_ENVIRONMENT. - Sandbox data can be reset at any time. Do not keep anything there you need.
- Point your webhook to a test URL so sandbox events never reach your live system.
Versions and changes
- The
/v1path stays stable. A breaking change gets a new path (/v2), and both run side by side for at least 6 months. - New fields and new events can appear at any time and are listed in the changelog.
- An endpoint that will be retired first sends
DeprecationandSunsetheaders.
Terms of use
Using the API means you accept the API terms of use: fair use of the limits, keeping keys secret, and handling order data only to run your shop.