Errors
The error contract of the Identify API: status codes, error values, the version header and the different 404 responses.
After this page you will be able to interpret every error the Identify API returns and decide whether to retry.
Prerequisites: you have made at least one call to the API (Quickstart). The snippets are TypeScript (Node.js 20 or later, or a browser); drop the types for plain JavaScript.
Every error produced by the Identify API is a JSON object with a single error string:
{ "error": "unauthorized" }Branch on the HTTP status and on error. Apart from the validation messages of POST /identify, error is one of a fixed set of codes.
const res = await fetch(url, init);
if (!res.ok) {
const body = (await res.json().catch(() => ({}))) as { error?: string };
console.error(res.status, body.error);
}Read the body defensively (.catch), because a 429 or a gateway-level answer is not guaranteed to be JSON.
Status codes and error values
| Status | error | Endpoints | Meaning |
|---|---|---|---|
400 | invalid_json | POST /identify | The request body is not valid JSON. |
400 | free-text message, for example shopId is required | POST /identify | The body failed validation. See the table below. |
401 | unauthorized | all authenticated endpoints | Credential missing, malformed, unknown, expired or revoked. |
404 | not_found | any | Unknown path or method, or the missing app (/app) or merchant (/customer). See "The different 404s". |
404 | unsupported_version | any /api/{version}/... | The version in the path does not exist. Includes supportedVersions. |
429 | n/a | any | Rate limiting in front of the service. Not part of the error contract. |
503 | unavailable | versioned endpoints | The service failed to process the request. |
Validation messages of POST /identify
These 400 messages are human-readable text rather than fixed codes. Match on the status, not on the exact wording.
error | Cause |
|---|---|
invalid body | The body is valid JSON but not an object (null, a number, a string, a boolean). |
shopId is required | shopId is missing, empty or not a string. |
<field> must be a string | myshopifyDomain, name, email, country, industry, shopifyPlan, shopDescription or domain is not a string (null is not accepted). |
contacts must be an array | contacts is not an array. |
401 unauthorized
| Endpoint | Typical causes |
|---|---|
POST /identify | The Authorization header is missing or is not Bearer <api key> (case-sensitive, one space); the API key is malformed, unknown or revoked. A revoked key is rejected on the very next request. |
GET /app, GET /customer | The customer token is missing, malformed, expired or not issued by POST /identify; the Authorization header does not start with Bearer (case-sensitive); on /customer only, the token was revoked by Nortly. |
On the read endpoints the fix is always the same: call POST /identify for a new token.
The different 404s
A 404 can mean four different things. Tell them apart by error, the endpoint and the headers.
| Situation | Body | Where | X-Identify-API-Version |
|---|---|---|---|
Unknown path or HTTP method, for example GET /api/2026-07/identify, POST /api/2026-07/app or a trailing slash. Also any method other than GET on /. | { "error": "not_found" } | anywhere | no |
Unknown API version, for example /api/2025-01/app. | { "error": "unsupported_version", "supportedVersions": ["2026-07"] } | /api/{version}/{resource} | no (CORS headers are present) |
| The app of the token no longer exists. | { "error": "not_found" } | GET /app | yes |
The merchant is not known for your app yet, typically right after the first POST /identify because the merge is asynchronous. | { "error": "not_found" } | GET /customer | yes |
How to react:
- Unknown path or method / unknown version: a bug in the request. Check the method, the exact path and the version segment; use a value from
supportedVersions. GET /customerright after identify: expected. Retry a few times with a short backoff (for example 0.5 s, 1 s, 2 s).GET /app: the app was removed or the token is stale. Do not retry; contact support if your app should exist.
429 and 503
429comes from rate limiting in front of the service and can appear on any route, even though the service itself never returns it. Its body is not part of this contract. Wait and retry with exponential backoff.503 { "error": "unavailable" }is a temporary failure on the service side. Retry with exponential backoff. RetryingPOST /identifyis safe: repeating the same body leaves the stored data unchanged. Browsers do not expose503responses to JavaScript because they have no CORS headers; they show up as a failedfetch.
The version header
Every response produced by a versioned route carries X-Identify-API-Version with the version that served it, for example X-Identify-API-Version: 2026-07. This includes the 400, 401, 404 (missing app or merchant) and 503 answers, and the OPTIONS preflights. It is not sent on router-level 404 answers (not_found for an unknown path or method, unsupported_version), on 429, or on GET /. See Versioning.
Diagnostics
POST /identify returns an X-Request-Id header on success. Log it together with the response and include it when you contact support. Responses may also carry a Server-Timing header for diagnostics; do not parse it.
Handling errors in code
We recommend one small function that turns a status into an action, so every call site reacts the same way:
type Action = "fix-request" | "refresh-token" | "retry" | "give-up";
function actionFor(status: number, error?: string): Action {
if (status === 429 || status === 503) return "retry"; // exponential backoff
if (status === 404 && error === "not_found") return "retry"; // only for GET /customer right after identify
if (status === 401) return "refresh-token"; // read endpoints: get a new token; on POST /identify the API key is wrong or revoked
if (status === 400 || error === "unsupported_version") return "fix-request";
return "give-up";
}Retry a 404 not_found only on GET /customer and only a few times; on any other endpoint it is a bug in the request or a missing app. An unknown version answers 404 with supportedVersions:
const res = await fetch("https://id.nortly.app/api/2025-01/app", {
headers: { Authorization: `Bearer ${customerToken}` },
});
const body = await res.json();
// res.status === 404
// body: { error: "unsupported_version", supportedVersions: ["2026-07"] }
// res.headers.get("x-identify-api-version") === nullNext steps
- Versioning: the version header and
unsupported_versionin detail. - Authentication: fix
401answers. - Push merchant data: the validation rules behind the
400answers.
Updated 13 days ago