Skip to navigation

Responses and errors

Response envelopes, status codes, and error codes.
View as Markdown

All responses are JSON. Two envelopes are in use, so check which one an endpoint returns before you parse it.

Standard envelope

Domain endpoints such as containers, manifests, edge ingestion, notifications, and admin return success with either data or error:

{
"success": true,
"data": {
"containerId": "665f1c2e9b1e4a0012ab34cd",
"containerNumber": "MSCU1234566",
"isNewContainer": true,
"status": "IDENTIFIED"
}
}

Use error.code for program logic. The message is for people and may change.

Legacy auth envelope

Endpoints under /v1/user/auth/*, and the authentication and role checks in front of every JWT-protected endpoint, return the older status envelope:

{
"status": "error",
"message": "Unauthorized: Authentication required",
"data": {}
}

Successful auth calls return "status": "success" with the payload in data.

Status codes

CodeMeaning
200 / 201Success
400Validation failed, for example a missing field, a malformed ID, or an invalid container number
401Missing, invalid, or expired JWT, or a missing or wrong edge API key
403Authenticated but not allowed: wrong role, not the resource owner, or a cookie-authenticated write from an untrusted origin
404Resource or route not found
409Conflict, for example a container number already in use
429Rate limit exceeded; see Authentication
500Unexpected server error; details are never included in the response

Common error codes

CodeReturned when
VALIDATION_ERRORA required field is missing or malformed
INVALID_INPUTA value has the wrong type
INVALID_IDA path ID is not a valid record ID
INVALID_CONTAINER_NUMBERA container number fails ISO 6346 format or check-digit validation
CONTAINER_NOT_FOUNDNo container matches the ID or number
FORBIDDENThe caller cannot access the resource
MISSING_API_KEY / INVALID_API_KEYEdge authentication failed
TOO_MANY_REQUESTSA rate limit was exceeded
NOT_FOUNDNo route matches the method and path
INTERNAL_ERRORAn unexpected server error occurred

Pagination

Page-based list endpoints such as GET /v1/containers accept page (starting at 1) and limit query parameters and return a pagination object next to the items. A few admin listings use cursors instead; see each endpoint in the API reference.

{
"success": true,
"data": {
"containers": [],
"pagination": { "page": 1, "limit": 20, "total": 0, "pages": 0 }
}
}

GET /v1/containers defaults to 20 items per page and caps limit at 100.