Skip to main content
LogBrew API errors use one JSON envelope. Use code and next_action for program behavior. Show error and next as plain text. Do not match the wording of error or next.
Some responses add fields, such as limit, reset_at, or retry_after_seconds. The sections below name them.

Handle an error response

  1. Read the HTTP status.
  2. Make sure that the body is JSON before you read code.
  3. Use the status and code together to select the client branch.
  4. Show error and next as plain text. Do not render them as HTML or run them as commands.
  5. Use next_action for automatic recovery. If the client does not recognize the action, stop and show the error.
  6. Before you retry, use the retry rules.
If the response has no JSON envelope, keep the HTTP status and record the code as unavailable. Do not invent a LogBrew code. A proxy or network failure can produce this result. For logs, record the HTTP status and code. Do not log the full body, credentials, or recovery tokens.

Error codes

The same code can occur on more than one route. The next text and the next_action values can change by route. Use the returned values. An unknown ID and an ID that you cannot access can return the same response. Do not use error text to find which account owns an ID.

Retry rules

Use the code and the operation to decide on a retry. The status alone is not sufficient.
  • Do not retry validation_failed, invalid_json, unauthorized, ingest_key_invalid, forbidden, not_found, or method_not_allowed without a change. Correct the request or the credential first.
  • For rate_limited, wait for retry_after_seconds or the Retry-After header when present. Then use exponential backoff with jitter. Do not start parallel retries for one failed request.
  • For usage_limit_exceeded, stop ingestion until reset_at or until the plan changes. A fast retry loop cannot change an allowance.
  • For request_timeout and 5xx responses, you can send a read again with the same scope. A timeout does not prove that the result is empty.
A rate limit controls request frequency. A usage limit controls the account allowance for a period. Both use 429. Keep their fields separate. Read the current allowance from the account API.

Writes

A timeout, a 5xx response, or a network failure does not prove that a write failed. Before you send a write again:
  1. If the route supports an idempotency key, send the same key and the same body again. Use a new key only for new work.
  2. If the route has no idempotency key, read the resource first. Send the write again only if the change is not present.
  3. If you cannot find the result, stop automatic retries and tell the user.
idempotency_conflict means that the key belongs to a different request. Do not change the body of a retry that uses the original key.

Examples

These examples show the envelope shape. The error and next text can be different on each route.

Authentication failure

Do not use an ingest key in place of an account bearer. Do not use an account bearer in place of an ingest key.

Unsupported method

Rate limit

A usage_limit_exceeded response adds limit and reset_at. limit is events or bytes.

Account recovery available

This response adds deleted_at and a short-lived recovery_token. Keep the token in protected client state. Do not put it in logs, URLs, screenshots, support reports, or agent prompts.
An API response does not give permission for a purchase, a deletion, or another account change. Get the user’s approval before those actions. For endpoints, authentication, and filters, read the Telemetry API.