Skip to main content

How It Works

The First Answer API enforces rate limits per project on a per-minute sliding window. All API keys within the same project share the same rate limit counter. The rate limit for your project is determined by your plan.

Rate Limit Headers

Every API response includes headers to help you track your usage:
HeaderDescription
X-RateLimit-LimitMaximum requests allowed per minute
X-RateLimit-RemainingRequests remaining in the current window
Retry-AfterSeconds to wait before making another request (only on 429 responses)

Exceeding the Limit

When you exceed your rate limit, the API returns a 429 Too Many Requests response:
429
{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Rate limit exceeded.",
    "retry_after_seconds": 23
  }
}
The retry_after_seconds field tells you exactly how many seconds to wait before retrying.

Handling Rate Limits

Retry with Backoff

The simplest approach is to respect the retry_after_seconds value:
import time
import requests

API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.firstanswer.ai/v1"

def api_request(endpoint):
    response = requests.get(
        f"{BASE_URL}{endpoint}",
        headers={"api-key": API_KEY},
    )

    if response.status_code == 429:
        retry_after = response.json()["error"]["retry_after_seconds"]
        print(f"Rate limited. Retrying in {retry_after}s...")
        time.sleep(retry_after)
        return api_request(endpoint)

    return response.json()

Spread Requests Over Time

If you need to make many requests, spread them evenly within your rate limit window instead of sending them in bursts:
import time
import requests

API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.firstanswer.ai/v1"
RATE_LIMIT = 10  # requests per minute
DELAY = 60 / RATE_LIMIT  # 6 seconds between requests

endpoints = [
    "/brands/",
    "/monitored-prompts/",
    "/cited-sources/",
    "/monitored-competitors/",
    "/dashboard/",
]

for endpoint in endpoints:
    response = requests.get(
        f"{BASE_URL}{endpoint}",
        headers={"api-key": API_KEY},
    )
    print(f"{endpoint}: {response.status_code}")
    time.sleep(DELAY)

Best Practices

Cache responses

Store API responses locally and reuse them when the data hasn’t changed. Most monitoring data updates on a daily or weekly basis.

Use pagination wisely

Each page returns up to 100 items by default. Use the page and per_page parameters to control page size and iterate through results efficiently.

Request only what you need

Target specific endpoints and resources rather than fetching everything on every sync.

Monitor your usage

Track 429 responses in your application logs to identify when you’re approaching your limits.

Need Higher Limits?

If your integration requires a higher rate limit, contact our team to discuss Enterprise plans with custom limits.