Skip to main content

HTTP Status Codes

The Heirs E-Invoicing Middleware uses standard HTTP status codes. Every response also includes a success boolean and, on errors, a plain-English error message.


Success Codes

CodeStatusWhen returned
200OKRequest succeeded — GET, PATCH, PUT, DELETE actions
201CreatedResource successfully created — POST to create endpoints

Client Error Codes (4xx)

These indicate a problem with your request. Fix the issue before retrying.

CodeStatusCommon cause
400Bad RequestMalformed JSON, missing required fields, or invalid state transition
401UnauthorizedMissing or invalid x-api-key, x-admin-key, or JWT token
403ForbiddenValid credentials but insufficient permissions, or tenant is suspended
404Not FoundTenant, user, API key, or route ID does not exist
405Method Not AllowedWrong HTTP method for this endpoint
422Unprocessable EntityRequest is structurally valid but fails business rules or schema validation
429Too Many RequestsAPI rate limit exceeded for this tenant

Server Error Codes (5xx)

These indicate a problem on the platform side.

CodeStatusWhat to do
500Internal Server ErrorRetry once after a short delay. If it persists, contact support
502Bad GatewayTransient upstream error — retry with exponential backoff
503Service UnavailablePlatform is under maintenance

Rate Limits

Rate limits are configured per tenant:

SettingDefaultRange
apiRateLimitPlatform default10–10,000 requests per minute

When the limit is exceeded, the response is 429 with a Retry-After header (in seconds). Wait for the specified duration before retrying.

To increase your rate limit, contact your platform admin or update via PATCH /v1/tenants/{tenantId}:

{
"limits": {
"apiRateLimit": 1000
}
}

Response Envelope Reference

Every response (success or error) wraps the result:

// Success
{
"success": true,
"data": { ... },
"count": 25
}

// Error
{
"success": false,
"error": "Tenant not found",
"statusCode": 404
}

Always check success before consuming data.