Admin API
Read and manage products, inventory, orders and customers of one business from an OAuth app, with scoped access tokens.
Rolling out gradually; it may not be active for your business yet
The Admin API and OAuth apps are enabled per business. If a call answers feature_disabled, the business does not have them yet.
What it is
The Admin API lets an OAuth app work on one business that installed it: list and edit products, adjust stock, read and fulfil orders, and manage customers. Everything lives under /api/v1/admin and speaks camelCase JSON.
Authentication
Send the access token you got from the install flow as a Bearer token. Access tokens start with nmat_, last 1 hour and are renewed with the refresh token.
curl "https://<your-nimlio-host>/api/v1/admin/products?limit=20" \
-H "Authorization: Bearer nmat_…"A missing or expired token answers 401 (missing_token or invalid_token). A token only ever reaches the business that installed the app.
Scopes
Each endpoint requires one scope. The effective scopes of a call are the scopes of the token intersected with the scopes of the installation, so a merchant who reduces an installation's scopes takes effect immediately. A missing scope answers 403 insufficient_scope with details.required. Write scopes do not imply read scopes.
| Scope | Allows |
|---|---|
products:read / products:write | List, read, create and update products |
inventory:read / inventory:write | Read stock levels; adjust or set stock |
orders:read / orders:write | List and read orders; edit tags and note; move fulfillment |
customers:read / customers:write | List, read, create and update customers |
customer_data:read | Include protected personal data (buyer and customer contact details) in order and customer responses |
checkout_rules:read / checkout_rules:write | List and read the app's own checkout rules; register, update and delete them |
Without customer_data:read, the personal fields of orders and customers are left out of the response. Request that scope only if your app needs them.
Conventions
- Bodies are strict. An unknown key in a write body is rejected with 400; it is never ignored silently.
- Pagination. Lists return
dataandmeta: { nextCursor, hasMore, limit }. Passlimit(1–100, default 50) andcursor(the previousnextCursor). A page can be short or empty whilehasMoreis true (a filtered order list also setsmeta.truncated: truethen): keep followingnextCursoruntilhasMoreis false. - Idempotency. Inventory writes and order fulfillment require an
Idempotency-Keyheader (1–128 characters). Retrying with the same key replays the original result instead of applying it twice. - Rate limits. Reads and writes have separate buckets per installation. Slow down when you are rate limited.
- Money is an integer in COP centavos.
{
"ok": false,
"error": {
"code": "insufficient_scope",
"message": "The access token lacks the scope this endpoint requires",
"details": { "required": "products:write" },
"requestId": "…"
}
}error can also carry reason and fieldErrors. Quote requestId when you contact support.
A write (any method other than GET, HEAD or OPTIONS) for a business whose subscription has lapsed answers 402 subscription_required and changes nothing. Reads keep working. The merchant subscribes again to restore writes. The check runs again inside the write's own transaction: if the subscription lapses while a write runs, the write still answers 402 and changes nothing. A renewal or plan change that keeps the business entitled never refuses a write.
Products
| Method and path | Scope | Notes |
|---|---|---|
GET /products | products:read | Query: limit, cursor, status (draft, active, archived) |
POST /products | products:write | Returns 201 with the new id. Body: name (required, 1–160), description, priceAmount, currency, sku, inventoryQuantity, status and more |
GET /products/:id | products:read | One product |
PATCH /products/:id | products:write | Send only the fields to change |
curl -X POST "https://<your-nimlio-host>/api/v1/admin/products" \
-H "Authorization: Bearer nmat_…" \
-H "Content-Type: application/json" \
-d '{"name":"Ceramic mug","priceAmount":4500000,"currency":"COP","status":"draft"}'Inventory
| Method and path | Scope | Notes |
|---|---|---|
GET /inventory?variantId=… | inventory:read | Stock of a variant, in total and per location |
POST /inventory/adjustments | inventory:write | Add or remove a delta. Body: productId, variantId?, delta, reason (manual, restock, correction), note?. Idempotency-Key required |
PUT /inventory/levels | inventory:write | Set the stock with compare-and-set. Body: variantId, expectedQuantity, quantity, reason?, note?. Idempotency-Key required |
PUT /inventory/levels only applies when the current quantity equals expectedQuantity; otherwise read the level again and retry, so two writers never overwrite each other.
Orders
| Method and path | Scope | Notes |
|---|---|---|
GET /orders | orders:read | Query: limit, cursor, order (asc, desc), status (pending, paid, failed, expired, refunded), fulfillmentStatus, from, to, updatedSince (ISO instants) |
GET /orders/:id | orders:read | One order |
PATCH /orders/:id | orders:write | Only tags (up to 10) and note (up to 2000 characters). Payment and fulfillment fields are not editable here. Sending tags requires expectedTags, the tag set you last read (breaking for integrations that send tags alone: they now get 400); if the order's tags differ at commit time nothing is written and the answer is 409 order_tags_conflict with details.current |
POST /orders/:id/fulfillment | orders:write | Moves fulfillment and may notify the buyer. Idempotency-Key required |
The fulfillment body takes status and expectedStatus (each one of unfulfilled, shipped, out_for_delivery, delivered, ready_for_pickup, fulfilled, cancelled), plus optional notify, trackingCourier, trackingNumber, trackingUrl (https) or trackingEntries. trackingEntries replaces every tracking entry and requires trackingRevision, the order's trackingRevision you read; if it is missing or the tracking changed since, the call fails with 409 tracking_conflict and nothing is replaced. The call fails if the order is no longer in expectedStatus.
Customers
| Method and path | Scope | Notes |
|---|---|---|
GET /customers | customers:read | Query: limit, cursor, search, tag |
POST /customers | customers:write | Returns 201. Body: name (required), phone, email, address, city |
GET /customers/:id | customers:read | One customer |
PATCH /customers/:id | customers:write | notes, tags, marketingOptOut, birthMonth, birthDay |
Checkout rules
| Method and path | Scope | Notes |
|---|---|---|
GET /checkout-rules | checkout_rules:read | The rules your installation registered, in the merchant's order |
POST /checkout-rules | checkout_rules:write | Returns 201. Body: document (the rule document; its kind and name become the rule's). New rules start disabled until the merchant enables them |
GET /checkout-rules/:id | checkout_rules:read | One rule |
PATCH /checkout-rules/:id | checkout_rules:write | Replace the document. Body: document, revision (compare-and-set; a stale revision answers 409 revision_conflict). The enabled switch is kept |
DELETE /checkout-rules/:id | checkout_rules:write | Remove the rule |
An invalid document answers 400 invalid_input with reason invalid_rule_document and details: { code, path, message }. A business holds at most 20 rules (409 limit_reached, reason rule_limit_reached). Rules of other installations answer 404. See Checkout rules for the document format.