Developer API
Limits and errors
The request limits on the read endpoints of the Developer API, what a 429 means and how to wait it out, and every error code a read answers with.
This page covers the limits on reading through the Developer API, the shape of an error, every code a read endpoint answers with, and what a script does with each status. The limits count per person: every token a person holds draws on the same allowance.
The limits and codes that apply only to writes are on Limits and errors for writes.
What are the limits?
Section titled “What are the limits?”| Limit | Value | Over it |
|---|---|---|
| Requests per person | 60 a minute, over a sliding window | 429 rate_limited |
| Requests in flight per person | 2 at once | 429 too_many_in_flight |
Page size (limit on /transactions and /balances) |
1 to 1000, default 100 | 422 validation list |
/cashflow range |
60 months, 40 quarters or 20 years | 400 range_too_wide |
| Failed tokens from one network (an IPv4 address or an IPv6 /64) | 20 in 5 minutes | 429 rate_limited on every request from that network |
What does a 429 look like?
Section titled “What does a 429 look like?”Every 429 carries Retry-After in whole seconds. A request over the in-flight limit is refused at once with Retry-After: 1. Here four large reads ran in parallel for one person; two were served and two refused like this:
HTTP/1.1 429 Too Many Requestsretry-after: 1content-type: application/json
{ "detail": "too_many_in_flight"}Over the per-minute limit, Retry-After is the number of seconds until the window has room. This refusal came on the 58th request in a loop, with earlier requests from the same minute already counted:
HTTP/1.1 429 Too Many Requestsretry-after: 16content-type: application/json
{ "detail": "rate_limited"}How should a script back off?
Section titled “How should a script back off?”Wait the number of seconds in Retry-After, then send the same request again. A script that keeps at most two requests open at once stays under the in-flight limit, and limit=1000 reads a long range in fewer requests. These are the request helpers from the year export recipe: each sleeps on a 429 and stops on any other error.
import jsonimport osimport sysimport timeimport urllib.errorimport urllib.parseimport urllib.request
API = os.environ["TAIGA_API"]TOKEN = os.environ["TAIGA_TOKEN"]
def get(path, **params): """GET a /api/v1 path; on 429 wait for Retry-After and try again.""" url = f"{API}/api/v1{path}?{urllib.parse.urlencode(params)}" req = urllib.request.Request(url, headers={"Authorization": f"Bearer {TOKEN}"}) while True: try: with urllib.request.urlopen(req) as resp: return json.load(resp) except urllib.error.HTTPError as e: if e.code != 429: sys.exit(f"HTTP {e.code}: {e.read().decode()}") time.sleep(int(e.headers.get("Retry-After", "1")))get() { # GET $1; on 429 sleep for Retry-After and try again local hdr status body; hdr=$(mktemp) while :; do body=$(curl -sS -D "$hdr" -H "Authorization: Bearer $TAIGA_TOKEN" "$1") status=$(awk 'NR==1{print $2}' "$hdr") if [ "$status" = 429 ]; then sleep "$(awk 'tolower($1)=="retry-after:"{print $2+0}' "$hdr")"; continue fi rm -f "$hdr" [ "$status" = 200 ] || { echo "HTTP $status: $body" >&2; exit 1; } printf '%s' "$body"; return done}Why is a valid token refused with 429?
Section titled “Why is a valid token refused with 429?”After 20 failed tokens from one network in 5 minutes, every request from that network is 429 rate_limited until the window drains, a valid token’s included. A script that retries a 401 in a loop, or a typo in a token, can lock out every script on the same address for minutes. This request carried a live token after 20 bad ones from the same address:
for i in $(seq 1 20); do curl -s -o /dev/null "$TAIGA_API/api/v1/accounts" -H "Authorization: Bearer taiga_pat_typo$i"donecurl "$TAIGA_API/api/v1/accounts" -H "Authorization: Bearer $TAIGA_TOKEN"HTTP/1.1 429 Too Many Requestsretry-after: 299content-type: application/json
{ "detail": "rate_limited"}Stop on a 401 instead of retrying it, and the throttle never starts.
What does an error look like?
Section titled “What does an error look like?”An error is JSON with one key, detail, holding a code:
{ "detail": "no_plan"}A query that fails validation, such as a missing from and to or a limit over 1000, is a 422 whose detail is a list, one entry per problem:
{ "detail": [ { "type": "missing", "loc": [ "query", "from" ], "msg": "Field required", "input": null }, { "type": "missing", "loc": [ "query", "to" ], "msg": "Field required", "input": null } ]}A 405 carries an Allow header naming the methods the path serves:
HTTP/1.1 405 Method Not Allowedallow: GETcontent-type: application/json
{ "detail": "read_only"}On the read endpoints, detail is the only key.
Some write refusals carry more keys beside detail; Limits and errors for writes lists them.
Which codes can a read return?
Section titled “Which codes can a read return?”| Status | Code | Endpoints | Description |
|---|---|---|---|
| 400 | bad_account_id |
GET /balances, GET /transactions |
account_id is not an account id (digits only, no leading zero) |
| 400 | bad_cursor |
GET /balances, GET /transactions |
cursor is not a next_cursor this endpoint gave. |
| 400 | bad_month |
GET /budget |
month is not a month written YYYY-MM. |
| 400 | bad_range |
GET /balances, GET /cashflow, GET /transactions |
to is before from, or the range reaches outside the years 1900 to 9998. |
| 400 | range_too_wide |
GET /cashflow |
The range touches more periods than one request serves: 60 months, 40 quarters or 20 years. |
| 401 | invalid_token |
All | No bearer, or not a live personal token. |
| 403 | notice_required |
All | Review a notice in the app first. |
| 404 | no_plan |
GET /budget |
The month has no plan. |
| 405 | method_not_allowed |
All | The path does not serve this method; Allow names those it does. |
| 405 | read_only |
All | The path only reads. |
| 422 | — | All except GET /accounts, GET /holdings, GET /recurring |
The body or a parameter failed schema validation; the answer is FastAPI’s validation list (detail, one entry per failure). |
| 429 | rate_limited |
All | Too many requests, or too many failed tokens from your network. |
| 429 | too_many_in_flight |
All | Too many requests at once. |
What should a script do with each status?
Section titled “What should a script do with each status?”- 401
invalid_token. The token is not a live personal token, there is noAuthorizationheader, or the token went in the query string. The API reads the token fromAuthorization: Bearer …only. Every401answers the same{"detail": "invalid_token"}withWWW-Authenticate: Bearer. Fix the header, or create a new token in Settings if this one has ended. Don’t retry. - 403
notice_required. The token’s owner has a notice to review in the app, such as updated Terms of Service. Every request answers403until they review it. The token itself is not ended, and works again once they have. - 400 and 422. The request is malformed:
bad_range(tobeforefrom),bad_cursor(a cursor this walk did not hand out, or one from another endpoint),bad_account_id(not anidfrom/accounts),bad_month(notYYYY-MM),range_too_wide, or a422list naming the parameter. Fix the request; sending it again unchanged answers the same. - 404.
{"detail": "Not Found"}is a path the API does not serve. A trailing slash is a different path, so/api/v1/accounts/is404, never a redirect.no_planon/budgetis a month with no plan. - 405.
read_onlyis a method other thanGETon a path that only reads;method_not_allowedis any other method a path does not serve. TheAllowheader names the methods it does. Change the method, not the path. - 429. Wait
Retry-Afterseconds and send the request again (above).
What can a lapsed household’s token read?
Section titled “What can a lapsed household’s token read?”Everything it read before. When the household’s subscription is not active, read requests are still served: this /accounts request from a canceled household answered 200 with all 15 accounts.
curl "$TAIGA_API/api/v1/accounts" \ -H "Authorization: Bearer $TAIGA_TOKEN"What a lapsed household’s write gets is on Limits and errors for writes.