Skip to the documentation
All documentation pages ↓

Errors, limits and retries

Status codes, the two rate limits, the retryable 503 and how to back off.

The shape of an error

Every failure is application/problem+json and carries a request_id, which is also in the X-Request-ID response header. Quote it if you ask us about a request.

Response
{
  "type": "about:blank",
  "title": "Forbidden",
  "status": 403,
  "detail": "This API key does not have the incidents:read scope",
  "request_id": "0f2b9c4e-…"
}

Status codes

What each status means here, and whether to retry
StatusMeaningRetry?
401No key, or one that is unknown, revoked or expired, or a suspended organisation — all answered identically. Also a refused signature, with WWW-Authenticate: X-Signature and a detail naming the check. Authentication runs before anything is looked up, so a 401 never tells you whether something exists.No — fix the key or the signature
403A valid key without the scope this route needs (the detail names it), or a key not issued for sending events.No
404No such record in your organisation. A record belonging to somebody else gives the same answer.No
413The request body is over 2 MB.No — send smaller batches
422The request failed validation: a parameter out of range, a malformed identifier, a cursor we did not issue, an event outside the accepted time window.No
429You went over your own allowance. Carries Retry-After: the seconds left in your window.Yes, after Retry-After
503The service is at capacity — "The service is at capacity. Retry this request." Nothing to do with your rate. Carries Retry-After: 1. Nothing was stored: a refused batch is stored in full or not at all.Yes, with backoff
500Something is broken. Quote the request_id rather than retrying in a loop.Not in a loop

Limits

Default limits per key. Your deployment may set others; /public/identity reports the read limit for your key.
What you callDefault limitCounted inWindow
The two sending endpoints6,000 a minuteevents — a 100-event batch costs 100fixed clock minute
The five reading endpoints120 a minuterequestsfixed clock minute

Reads also have a concurrency bound per organisation, a safety valve that refuses only when requests cannot drain within a second; it also answers 429 with Retry-After, and the remedy is the same.

The window is a fixed clock minute, not a rolling sixty seconds: the allowance resets at the top of each minute, and a burst either side of that boundary can put up to twice the limit into one sixty-second span. Pace against the limit rather than the clock.

Other bounds: 100 events per batch, 64 KB per payload, 2 MB per request body, limit 1–200 on lists.

Retrying

429 and 503 are both temporary and both worth retrying, but they mean opposite things. After a 429, slow down: you are over your own allowance. After a 503, back off and retry without lowering your steady rate: the service was briefly full.

  • Bounded attempts. Give up after a handful, keep the batch, and alert.
  • Exponential backoff with full jitter. Without jitter every client refused in the same second returns in the same second, and the retry is a second outage.
  • Honour Retry-After as the minimum wait.
  • Resend the same event_ids. Sending is idempotent, so a retry after a lost response duplicates nothing.
  • Bound your buffer. Hold unsent batches in a queue of fixed size and drop the oldest when it fills; an unbounded retry queue turns minutes of our unavailability into your outage.
Python (standard library)
import json, random, time, urllib.error, urllib.request

RETRYABLE = {429, 503}
MAX_ATTEMPTS = 5                        # bounded: give up and alert, never loop

def post_batch(body: dict, api_key: str) -> dict:
    data = json.dumps(body, separators=(",", ":")).encode()   # same event_ids every attempt
    for attempt in range(MAX_ATTEMPTS):
        request = urllib.request.Request(
            "https://securiteagi.com/api/v1/events/batch", data=data, method="POST",
            headers={"X-API-Key": api_key, "Content-Type": "application/json"},
        )
        try:
            with urllib.request.urlopen(request, timeout=10) as response:
                return json.load(response)
        except urllib.error.HTTPError as error:
            if error.code not in RETRYABLE:
                raise                   # 4xx or 500: repeating cannot help
            after = int(error.headers.get("Retry-After") or 0)
        except (urllib.error.URLError, TimeoutError):
            after = 0                   # no answer: it may have landed; resending is safe
        backoff = min(30.0, 0.5 * 2 ** attempt)
        time.sleep(max(after, random.uniform(0, backoff)))   # full jitter
    raise RuntimeError("still refused after 5 attempts; keep the batch and alert")

We use only the cookies needed to sign you in securely and to remember your language and display choices. No analytics, advertising or third-party cookies.

Cookie policy