Skip to main content
Baato uses conventional HTTP status codes, and echoes the status into the response body alongside a human-readable message:
Branch on the HTTP status code, not on the status field in the body. A network failure or a gateway error never produces a parseable body at all, so a client that only reads status will throw on the cases that matter most.

Status codes

Empty results are not errors

Search terms with no match, and reverse lookups over unmapped ground, both return 200 with an empty data array. This is the most common source of “the API is broken” reports.

Rate limiting

When an account exhausts its monthly usage credit, requests fail until the credit resets. Retry with exponential backoff and a jitter, rather than a fixed interval — a fleet of clients retrying on the same schedule re-creates the spike that tripped the limit.
Do not retry 400, 401, 403 or 404 — the request is wrong, and repeating it only consumes credit.

Reducing avoidable failures

A request per keystroke is the fastest way to burn through your credit. Wait ~300 ms after the user stops typing, and cancel in-flight requests that have been superseded.
Place details for a fixed location are stable. Caching them within the limits set out in Pricing and limits cuts usage substantially.
A token embedded in a shipped app can be extracted and used by others, and their traffic counts against your credit. Restrict the token by domain, or proxy through your own backend. See Authentication.