Skip to content

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.

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

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 Requests
retry-after: 1
content-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 Requests
retry-after: 16
content-type: application/json
{
"detail": "rate_limited"
}

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 json
import os
import sys
import time
import urllib.error
import urllib.parse
import 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")))

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:

Terminal window
for i in $(seq 1 20); do
curl -s -o /dev/null "$TAIGA_API/api/v1/accounts" -H "Authorization: Bearer taiga_pat_typo$i"
done
curl "$TAIGA_API/api/v1/accounts" -H "Authorization: Bearer $TAIGA_TOKEN"
HTTP/1.1 429 Too Many Requests
retry-after: 299
content-type: application/json
{
"detail": "rate_limited"
}

Stop on a 401 instead of retrying it, and the throttle never starts.

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 Allowed
allow: GET
content-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.

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.
  • 401 invalid_token. The token is not a live personal token, there is no Authorization header, or the token went in the query string. The API reads the token from Authorization: Bearer … only. Every 401 answers the same {"detail": "invalid_token"} with WWW-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 answers 403 until they review it. The token itself is not ended, and works again once they have.
  • 400 and 422. The request is malformed: bad_range (to before from), bad_cursor (a cursor this walk did not hand out, or one from another endpoint), bad_account_id (not an id from /accounts), bad_month (not YYYY-MM), range_too_wide, or a 422 list 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/ is 404, never a redirect. no_plan on /budget is a month with no plan.
  • 405. read_only is a method other than GET on a path that only reads; method_not_allowed is any other method a path does not serve. The Allow header names the methods it does. Change the method, not the path.
  • 429. Wait Retry-After seconds 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.

Terminal window
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.