Errors
Errors use a consistent JSON shape:
{ "error": { "code": "error_code", "message": "Human readable error", "requestId": "request_id" }}Common status codes
Section titled “Common status codes”401means the API key is missing, malformed, revoked, or invalid.402means an active subscription or available credits are required.403means the key is valid, but the account cannot use the requested AfterLib API action.404means the resource is missing or inaccessible.422means validation failed after route matching.429means the request cannot be served because usage credits or limits are exhausted.500means the API failed unexpectedly.
Every response also includes X-Afterlib-Request-Id. Error responses repeat that value as error.requestId. Include the request ID when asking support to investigate a request.
Examples
Section titled “Examples”Missing or invalid key:
{ "error": { "code": "unauthorized", "message": "Missing API key", "requestId": "req_unauthorized" }}Subscription or credits required:
{ "error": { "code": "credits_exhausted", "message": "Active subscription required", "requestId": "req_payment_required" }}Access unavailable:
{ "error": { "code": "forbidden", "message": "AfterLib API access is not available for this account", "requestId": "req_forbidden" }}Validation failure:
{ "error": { "code": "validation_error", "message": "Invalid request", "requestId": "req_validation" }}Usage limit reached:
{ "error": { "code": "usage_limit_exceeded", "message": "Usage limit reached", "requestId": "req_limited" }}