Errors

Explore the comprehensive error reference for the Lia API - HTTP status codes, error codes, and best practices for error handling.

Error Response Format

All error responses follow this structure:

{
  "code": "ERROR_CODE",
  "message": "Human-readable error message",
  "status": 400
}

Fields:

  • code: Machine-readable error code for programmatic handling

  • message: Human-readable description of the error

  • status: HTTP status code

HTTP Status Codes

The API uses standard HTTP status codes to indicate success or failure:

Code
Description
Common Causes

200

OK

Request succeeded

400

Bad Request

Invalid parameters, validation errors

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Resource doesn't exist

429

Too Many Requests

Rate limit exceeded

500

Internal Server Error

Server error (contact support)

503

Service Unavailable

Temporary downtime or maintenance

Error Codes

BAD_REQUEST

Invalid input parameters or validation errors.

Example:

Common causes:

  • Invalid parameter values

  • Missing required fields

  • Malformed JSON in request body

  • Invalid pagination parameters

Solution: Check the error message for details and verify your request parameters.

UNAUTHORIZED

Missing or invalid API key.

Example:

Common causes:

  • Missing x-api-key header

  • Invalid or expired API key

  • Revoked API key

Solution: Include a valid API key in the x-api-key header.

Authenticationchevron-right

FORBIDDEN

API key is valid but lacks permissions to access the resource.

Example:

Common causes:

  • Workspace doesn't have access to the requested feature

  • Resource belongs to a different workspace

  • Feature requires a higher plan

Solution: Verify your workspace has access to the feature. Contact support if needed.

NOT_FOUND

The requested resource doesn't exist.

Example:

Common causes:

  • Resource ID is incorrect

  • Resource has been deleted

  • Resource belongs to a different workspace

Solution: Verify the resource ID is correct and the resource exists.

TOO_MANY_REQUESTS

Too many requests in a given time period. Rate limited to 120 requests per 60 seconds per API key.

Example:

Response Headers:

  • X-RateLimit-Limit: Maximum requests per window

  • X-RateLimit-Remaining: Remaining requests

  • X-RateLimit-Reset: Unix timestamp when limit resets

  • Retry-After: Seconds to wait before retrying

Solution: Implement exponential backoff and respect rate limit headers. See the rate limiting guide for best practices.

https://github.com/acoladgroup/lia/blob/main/docs/product/developers/lia-api/rate-limiting.mdchevron-right

INTERNAL_ERROR

An unexpected error occurred on the server.

Example:

Solution: Retry the request. If the error persists, check the status pagearrow-up-right for ongoing incidents or contact support with the request ID from the X-Request-Id response header.

SERVICE_UNAVAILABLE

The API is temporarily unavailable.

Example:

Response Headers:

  • Retry-After: Seconds to wait before retrying

Solution: Retry the request after the specified delay. Check the status pagearrow-up-right for ongoing incidents.

Example Error Responses

Validation Error

Response:

Authentication Error

Response:

Not Found Error

Response:

Error Handling Best Practices

Check HTTP Status Codes

Always check the HTTP status code before processing the response:

Handle Specific Error Codes

Handle different error types appropriately:

Implement Retry Logic

Implement exponential backoff for retryable errors (rate limits, server errors):

Rate Limiting

When rate limited (429 status), respect the retry timing:

Last updated

Was this helpful?