Lucius API

Errors

HTTP status codes and error response format.

The API uses standard HTTP status codes and returns errors as JSON with an error field.

Error format

All errors follow this shape:

{
  "error": "Human-readable error message"
}

Some validation errors on usage submission include per-event details:

{
  "accepted": 0,
  "rejected": 1,
  "events": [
    {
      "event_id": "evt-001",
      "status": "rejected",
      "error": "Metric 'unknown_metric' not in pricing program"
    }
  ]
}

Status codes

CodeMeaningWhen
200SuccessRequest completed successfully
400Bad RequestInvalid request body or parameters
401UnauthorizedMissing, invalid, or expired API key
404Not FoundResource doesn't exist or doesn't belong to your account
500Internal Server ErrorSomething went wrong on our end

Common errors

Authentication errors (401)

ErrorCause
Missing API keyNo Authorization or X-Api-Key header
Invalid API keyKey doesn't match any active key
API key expiredKey has passed its expiration date

Usage submission errors

POST /v1/billing/usage validates events individually — a bad row never rejects the rest of the batch. Only an invalid batch envelope (empty events or >100 items) returns HTTP 400.

Per-event failures appear in the events array with status: "rejected" (if event_id itself is missing or invalid, event_id is reported as index:<position>):

ErrorCause
<field>: <validation error>Malformed event payload (e.g. invalid ISO timestamp, negative quantity/fee_amount, or missing required field)
Contract not found or has no customerThe external_contract_id doesn't match any active contract
No approved pricing programThe contract doesn't have an approved pricing program yet
Metric 'X' not in pricing programmetric is not on that contract. Use GET /v1/billing/contracts → metrics[], or apply the catalog / add a usage rule

Not found errors (404)

Returned when looking up a specific resource:

{
  "error": "Not found"
}

This means either the resource doesn't exist or it belongs to a different company.

Retry guidance

  • 401 — Don't retry. Fix your API key.
  • 404 — Don't retry. Check the resource ID.
  • 400 — Don't retry. Fix the request.
  • 500 — Safe to retry with exponential backoff. Usage submissions are idempotent via event_id.

On this page