Developer docs

Developers guide

The Naamaa API

Connect your own software, or an AI assistant, to your business on Naamaa.

Quick start

From nothing to your first call in three steps.

  1. 1

    Create a credential in the portal

  2. 2

    Call GET /me with it

  3. 3

    Read your products and orders

curl -s https://www.naamaa.in/api/v1/ext/naamaa/v1/me \
  -H "X-Api-Key: nmk_live_xxxxxxxx" \
  -H "X-Api-Secret: nms_xxxxxxxx"

curl -s "https://www.naamaa.in/api/v1/ext/naamaa/v1/products" \
  -H "X-Api-Key: nmk_live_xxxxxxxx" \
  -H "X-Api-Secret: nms_xxxxxxxx"
Video: the first calls, a refused scope, then an AI assistant listing its tools.

What the API is

The API gives your software access to one business: its products, stock and orders, and, with the right permissions, its storefront and customer bookings. A credential belongs to one business and can only ever see and change that business’s own data.

Every call follows the same rules as the enterprise portal: the same price checks, stock movements and order status rules. It is a paid add-on that the platform switches on per business type. If you cannot find API & MCP (AI) in your portal, ask the Naamaa team.

Switched on per business template, as a paid add-on.
Switched on per business template, as a paid add-on.

Get a credential

A credential is a pair: a key id and a secret. You need both on every call.

  1. Open the enterprise portal and choose API & MCP (AI).
  2. Create a credential: give it a name, choose live or sandbox, and tick only the scopes it needs.
  3. Copy the key id and the secret. The secret is shown once and nobody can read it back. If you lose it, rotate the credential.
  1. 1API & MCP (AI)Enterprise portal
  2. 2Create credentialName · live/sandbox · scopes
  3. 3Copy key + secretnmk_… / nms_… shown once
  4. 4Rotate or revoke1–72 h grace, or at once
A credential, from creation to rotation.
Video: create a credential and copy it once.
Name it, pick live or sandbox, tick only the scopes it needs.
Name it, pick live or sandbox, tick only the scopes it needs.
The secret is shown once. Copy it now.
The secret is shown once. Copy it now.
Platform admins: Configuration → API keys.
Platform admins: Configuration → API keys.

Authentication

Always use HTTPS. Send the key id and the secret in either of these two ways.

Base URL
https://www.naamaa.in/api/v1/ext/naamaa/v1
X-Api-Key: nmk_live_xxxxxxxx
X-Api-Secret: nms_xxxxxxxx

The key id starts with nmk_live_ or nmk_test_. The secret starts with nms_. Keep it on your server: never put it in a web page or a mobile app. If a credential lists allowed browser origins, calls from other origins are refused.

Live and sandbox

The prefix of the key id tells you which one you hold.

  • nmk_live_… works on your real business.
  • nmk_test_… works on a separate sample copy of your business. Every route behaves as live, writes included, but nothing real happens: no messages are sent, no real payment is taken and live data is never touched. A sandbox payment link opens a test page where you choose paid, failed or cancelled. Reset the sandbox any time from the portal.

Scopes

A scope is one permission. Give a credential the smallest set it needs.

Back office

ScopeWhat it allows
catalog:readRead products, services, prices and variants.
catalog:writeChange a product’s name, prices or visibility. Changes data.
inventory:readRead stock levels.
inventory:writeSet stock to an exact number. Changes data.
orders:readRead orders and their status.
orders:writeMove an order to a new status; the customer is told. Changes data.
orders:cancelCancel an order. Changes data.
customers:readShow customer phone, email and address on orders. Without it you get names only.
reports:readRead sales summaries for a date range.

Customer-facing agents

ScopeWhat it allows
storefront:readRead what a customer sees: live items, prices as charged, availability and delivery coverage.
bookings:createPlace an order or booking for a customer. Changes data.
payments:createCreate a payment link for an order you placed and read its payment status.

The platform decides which scopes your business type may grant. A credential gets only the scopes that both you and the platform allow; GET /me shows the ones in force.

Errors

Every error has the same shape, and the HTTP status tells you the class of problem.

Error body
{
  "success": false,
  "code": "SCOPE_MISSING",
  "message": "This credential does not hold the scope orders:write."
}
StatusCodeMeaning
401CREDENTIALS_INVALIDThe key or secret is wrong, revoked or expired. The answer is the same for all three, on purpose.
403API_NOT_ENABLEDThe API is not switched on for this business.
403SCOPE_MISSINGThe credential does not hold the scope this route needs.
403ORIGIN_NOT_ALLOWEDA browser call came from an origin the credential does not list.
404NOT_FOUNDIt does not exist, or it belongs to another business.
409PRICE_CHANGED, OUT_OF_STOCK …A business rule refused the request, for example the price changed or the item is out of stock.
429RATE_LIMITEDToo many calls. Wait the number of seconds in the Retry-After header, then try again.

Rate limits

Each credential has its own per-minute limit. The platform sets it per business type (typically 600 a minute live and 120 sandbox). Past it you get 429 RATE_LIMITED with a Retry-After header in seconds. Wait that long, then retry; do not retry at once in a loop.

Pagination

Orders come in pages: page (from 0) and size (up to 100). The response carries totalPages and hasNext; ask for the next page while hasNext is true. Products and stock come in one list.

curl
curl -s "https://www.naamaa.in/api/v1/ext/naamaa/v1/orders?page=0&size=50" \
  -H "Authorization: Bearer nmk_live_xxxxxxxx.nms_xxxxxxxx"

# { "content": [ … ], "currentPage": 0, "totalPages": 4, "hasNext": true }
curl -s "https://www.naamaa.in/api/v1/ext/naamaa/v1/orders?page=1&size=50" \
  -H "Authorization: Bearer nmk_live_xxxxxxxx.nms_xxxxxxxx"

Examples

Replace the key and the secret with yours. All three examples read the business and its first products.

curl -s https://www.naamaa.in/api/v1/ext/naamaa/v1/me \
  -H "X-Api-Key: nmk_live_xxxxxxxx" \
  -H "X-Api-Secret: nms_xxxxxxxx"

curl -s "https://www.naamaa.in/api/v1/ext/naamaa/v1/products" \
  -H "X-Api-Key: nmk_live_xxxxxxxx" \
  -H "X-Api-Secret: nms_xxxxxxxx"

Set stock to exactly 24 (needs inventory:write):

curl
curl -s -X PUT https://www.naamaa.in/api/v1/ext/naamaa/v1/inventory/<product id> \
  -H "Authorization: Bearer nmk_live_xxxxxxxx.nms_xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"availableQuantity": 24}'

Booking and payment for a customer

Credentials with storefront:read, bookings:create and payments:create let an app or an agent sell for the business, through the same checkout as the Naamaa storefront. The API never accepts, sees or stores card, UPI or bank details: the customer pays on a hosted payment page.

  1. 1POST /checkoutcustomer phone + items
  2. 2POST /orders/{id}/payment-linkhosted gateway page
  3. 3Customer paysconfirmed by the gateway
  4. 4GET /orders/{id}/paymentPAID · FAILED · EXPIRED
Booking for a customer, paid through a link.
  1. Read what the customer sees with GET /storefront/products, then /storefront/products/{id}/availability and /storefront/delivery-check where they apply.
  2. If the business confirms customers by one-time code (OTP first), call POST /customers/otp/send, then POST /customers/otp/verify with the code. You get a customerProof, valid for 10 minutes.
  3. Place the order with POST /checkout: the customer’s phone, the items and the expectedUnitPrice you showed. If the price moved you get 409 PRICE_CHANGED. On success the order is held, awaiting payment.
  4. Create the link with POST /orders/{id}/payment-link. It is sent to the customer’s phone and also returned (url, expiresAt).
  5. Read GET /orders/{id}/payment: AWAITING, PAID, FAILED or EXPIRED. Only the payment gateway confirms a payment, never you. An unpaid order is released after the hold time. After FAILED or EXPIRED, create a new link.

Two modes exist per business type. Pay to confirm (the default): the order is confirmed when the customer pays the link. OTP first: the customer must also confirm by code before an order can be placed. Cash on delivery works only if the business already offers it on its storefront.

Place an order (pay to confirm):

curl
curl -s -X POST https://www.naamaa.in/api/v1/ext/naamaa/v1/checkout \
  -H "Authorization: Bearer nmk_live_xxxxxxxx.nms_xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": { "phone": "9000000001", "name": "Asha" },
    "items": [{ "serviceId": "<service id>", "quantity": 1, "expectedUnitPrice": 450 }],
    "fulfillment": "PICKUP",
    "paymentMethod": "ONLINE"
  }'

# then, with the order id from the response:
curl -s -X POST https://www.naamaa.in/api/v1/ext/naamaa/v1/orders/<order id>/payment-link \
  -H "Authorization: Bearer nmk_live_xxxxxxxx.nms_xxxxxxxx"

curl -s https://www.naamaa.in/api/v1/ext/naamaa/v1/orders/<order id>/payment \
  -H "Authorization: Bearer nmk_live_xxxxxxxx.nms_xxxxxxxx"
The API reference: every route, with a request you can try.
The API reference: every route, with a request you can try.