Skip to main content

Partner API

The partner API lets another system (an ERP, a 3PL, middleware) read one workspace's orders with an API key instead of a user login. A key belongs to one workspace. It can reach only the /v1/public/* routes.

This page is the published contract

Unlike the console API, these routes are a contract with third parties. Field names, error codes and paging behaviour here must not change without a new version. The generated OpenAPI document for these routes only is served at /{doc.prefix}-partner (/docs-partner by default) on non-production deployments.

Getting a key​

A workspace member with team-management rights (USER:MANAGE) opens Settings → API Access and creates an API client for each integration:

  • Role — what the client may see. Any of the workspace's roles that include ORDER:READ, except OWNER and roles that can manage the team. If the role includes CUSTOMER:READ, customer phone numbers and emails are returned in full; otherwise they are masked.
  • Warehouse — optionally limit the client to one site.
  • Allowed IPs — optional addresses or CIDR ranges calls must come from.
  • Key lifetime — every key expires; the maximum is API_KEY_MAX_LIFETIME_DAYS (365 by default).

The key (pnxt_live_…) is shown once. PointNXT stores only an HMAC of it. A client can hold up to five active keys, so a key is rotated by issuing a new one, switching the integration over, then revoking the old one. Workspace owners are emailed when a key is created or revoked, and 14 days and 1 day before one expires.

Disabling a client stops all its keys immediately. Platform admins can see every tenant's clients and disable one under Administration → API Clients.

Authentication​

GET /v1/public/orders HTTP/1.1
Host: api.pointnxt.com
Authorization: Bearer pnxt_live_AbCdEfGhIjKl_…

Keys are accepted only in the Authorization header, never in the query string. A key is refused (401 invalid_api_key) when it is malformed, unknown, expired, revoked, or its client is disabled. These cases are deliberately indistinguishable. An address outside the client's allowlist gets 403 ip_not_allowed. After 20 failed key attempts in a minute from one IP, that IP gets 429 too_many_failed_attempts.

Keys work only on /v1/public/*. On any other route the API answers 404, whatever role the client holds. Login sessions (JWTs) are refused on /v1/public/* with 401 api_key_required.

Rate limits​

Each key may make API_RATE_LIMIT_PER_KEY requests a minute (120 by default), and a workspace API_RATE_LIMIT_PER_TENANT across all its keys (600). Every response carries:

HeaderMeaning
X-RateLimit-LimitRequests allowed per minute for this key
X-RateLimit-RemainingRequests left in the current minute
X-RateLimit-ResetSeconds until the minute resets
Retry-AfterOn 429 only: seconds to wait

Errors​

Every error has the same shape. Branch on code, not on message.

{
"error": {
"code": "order_not_found",
"message": "No order with that identifier was found.",
"request_id": "6f1c…",
"details": ["only on validation errors"]
}
}
Statuscode
400invalid_request, invalid_cursor
401invalid_api_key, api_key_required
403ip_not_allowed, insufficient_permissions
404order_not_found, not_found
429rate_limited, too_many_failed_attempts
500internal_error

request_id (also sent as X-Request-Id) identifies the call in PointNXT's logs. The workspace can see the client's recent calls under Settings → API Access → Activity.

List orders​

GET /v1/public/orders

ParameterDescription
created_from, created_toISO 8601. When the order entered PointNXT, not the channel order date.
statusOne status or a comma-separated list, e.g. CONFIRMED,FULFILLED.
channelChannel id or channel code.
order_numberPointNXT order number.
reference_noYour reference / ERP sales order number.
limit1–100, default 50.
cursornext_cursor from the previous page.

Orders come oldest first. Page until next_cursor is null:

{ "data": [ { "id": "…", "order_number": "ORD-10421", … } ], "next_cursor": "eyJ2IjoxLCJpZCI6…" }

Syncing new orders: store the last next_cursor you received, or the id of the last order, and start the next poll from it. Orders appear about 30 seconds after they enter PointNXT; that delay is what guarantees a stored cursor never skips an order whose transaction committed late. Treat id as the key and upsert.

Status changes are not in the list yet. The list returns new orders. To read an order's current status, fetch it by id (below). An updated_since filter is planned.

Get one order​

GET /v1/public/orders/{identifier}

By PointNXT order id, or add ?by=order_number or ?by=reference_no. Another workspace's order, or one outside the client's warehouse or channel limits, is 404.

{ "data": { "id": "…", "status": "FULFILLED", … } }

The order object​

FieldNotes
id, order_number, channel_order_number, reference_no, customer_po_noIdentifiers
status, payment_status, payment_mode, currencyEnums as strings
order_dateWhen placed on the channel
created_at, updated_at, confirmed_at, fulfilled_at, delivered_at, cancelled_at, cancel_reasonISO 8601 or null
channel{ id, code, name, type }
totalssubtotal, tax, shipping, discount, cod_fee, grand_total, paid, refunded
customer{ name, email, phone, gstin }; email and phone masked unless the role has CUSTOMER:READ
shipping_address, billing_addressAddress lines, city, state, postal code, country; phone and email masked as above
items[]sku, channel_sku, name, status, quantity_*, item_price, item_tax, tax_percent, discount, currency
shipments[]awb_number, courier_code, courier_name, status, tracking_url, picked_up_at, estimated_delivery_date, delivered_at, is_return

Money and quantities are decimal strings ("1130.0000"), never floats. Parse them with a decimal type.

How it is built​

  • Service accounts. Each API client owns a User with kind = SERVICE and a Membership with roles in the tenant. The key resolves to that user, so WarehouseGuard, the permission resolver, the tenancy extension and the audit trail treat it exactly like a person. Service accounts cannot log in, reset a password or be impersonated. They are kept off the team page, user lists and impersonation list, and their roles can be changed only through the API client endpoints, never through the team endpoints. Owner and team-admin roles are refused.
  • Key verification. src/common/auth/api-key: JwtAccessGuard sends any Bearer pnxt_… token to ApiKeyAuthenticatorService, which looks the key up by prefix (cached 60 s in Redis and cleared on revoke or disable). It then compares the HMAC (API_KEY_PEPPER) in constant time and checks expiry, client status, membership status and the IP allowlist. ApiAccessGuard confines keys to @ApiAccess() routes and applies the per-key and per-tenant limits. The global IP throttle skips key traffic.
  • Contract isolation. @ApiAccess() routes return their own body shape (@RawResponse, which skips the console envelope) and error shape (PublicApiExceptionFilter). The orders endpoint has its own module, repository and DTO (src/modules/commerce/public-order), so console changes cannot change it.
  • Scope. PublicOrderQueryService narrows rows to where the client's roles grant ORDER:READ (PermissionResolverService.listGrantScopes), whether tenant-wide or limited to warehouses, channels or sellers. Contact masking follows CUSTOMER:READ per order.
  • Paging. Order ids are UUIDv7, so the cursor and the created_* bounds are primary-key ranges; no extra index is needed.
  • Tables. ApiClient, ApiKey, and ApiRequestLog (range-partitioned monthly, kept about a month). Management endpoints live under /v1/identity/api-clients (tenant) and /v1/identity/admin/api-clients (platform admin).

Configuration​

VariableDefault
API_KEY_PEPPER—Required to issue or accept keys. 32+ random characters. Changing it invalidates every key.
API_RATE_LIMIT_PER_KEY120Requests per minute per key
API_RATE_LIMIT_PER_TENANT600Requests per minute per workspace
API_KEY_MAX_LIFETIME_DAYS365Longest key lifetime offered