Skip to main content

Documentation Index

Fetch the complete documentation index at: https://dev.1st.app/llms.txt

Use this file to discover all available pages before exploring further.

HTTP status: 429 The 429 response includes a Retry-After header in seconds.

Message

Rate limit exceeded: 600 requests per 10 minutes per key. Wait Retry-After seconds and retry. For higher throughput, use the bulk export endpoint instead of looping per-sensor.

Common cause

  • Hot loop calling /readings per sensor with no delay (e.g. running a “pull every sensor” sync without batching).
  • Multiple processes sharing the same API key.

Fix

Two options:
  1. Use the bulk CSV endpoint. GET /v1/readings.csv streams a single CSV across many sensors in one request; massively cheaper on rate limit than walking per-sensor /readings.
  2. Throttle the loop. Sleep Retry-After seconds and retry — the response header tells you how long. If you hit 429 frequently, throttle to ~1 request per second.
If you need a higher limit for a sanctioned use case, contact support.

Code

def get_with_retry(url, max_retries=3):
    for _ in range(max_retries):
        resp = requests.get(url, headers={"Authorization": f"Bearer {KEY}"})
        if resp.status_code == 429:
            retry_after = int(resp.headers.get("Retry-After", "60"))
            time.sleep(retry_after)
            continue
        return resp
    raise RuntimeError("Rate-limited after retries")