The API.
Read the catalogue and pull the files from a build step, a pipeline or an editor plugin. It is a read-only JSON API over HTTPS, and it downloads what your account can: everything with a subscription or during the free launch, otherwise the month's free models.
Authentication
Every request carries your key as a bearer token. Keys are shown once when created and stored only as a hash, so if you lose one, revoke it and make another. Keep it on a server: a key in browser JavaScript is a published key, which is why this API sends no CORS header.
curl -H "Authorization: Bearer $TJB_KEY" \
https://www.threejsbank.com/api/v1/me
Endpoints
| Method | Path | What it returns |
|---|---|---|
| GET | /api/v1/me | Your account: its role, whether it is unlimited, and the free models left this month. |
| GET | /api/v1/models | The catalogue. Filters below. |
| GET | /api/v1/models/{slug} | One model, with its tags and collections. |
| GET | /api/v1/models/{slug}/download | The GLB itself. Counts against your allowance. Add ?colour= and a slug from the model's colours list to get that colourway; the atlas is baked in before the file is sent, so it arrives finished. An unknown slug returns the default rather than an error. |
| GET | /api/v1/collections | Every published collection that holds at least one model. |
| GET | /api/v1/tags | Every tag in use, with how many models carry it. |
Filtering the catalogue
The same parameters the website uses, so a URL you built by clicking around the library translates straight across. Tags are ANDed: every one you name must be on the model.
| Parameter | Meaning |
|---|---|
| q | Free text across titles, descriptions, tags and collection names. |
| tag[] | A tag slug. Repeat it to narrow further. |
| collection | A collection slug. |
| category | A category slug, e.g. food-drink. Every model also carries its category (or null). |
| limit | 1 to 100. Defaults to 24. |
| offset | Where the page starts. Pair it with total. |
# every low-poly building, two at a time
curl -H "Authorization: Bearer $TJB_KEY" \
"https://www.threejsbank.com/api/v1/models?tag[]=building&tag[]=low-poly&limit=2"
# fetch one file
curl -H "Authorization: Bearer $TJB_KEY" -OJ \
https://www.threejsbank.com/api/v1/models/airboat-bayou/download
Limits and errors
60 requests a minute per key. Over that you get 429 with a Retry-After header. Errors are always JSON with a stable code, so you can branch on it without reading the message.
| Status | Code | Meaning |
|---|---|---|
| 401 | unauthorized | Missing, wrong or revoked key. |
| 402 | subscription_required | The month's free models are used. Subscribe for unlimited downloads. |
| 404 | not_found | No such model, or no such endpoint. |
| 405 | method_not_allowed | The API is read-only. |
| 429 | rate_limited | Too many requests, or the daily download cap. |
Re-downloading a model you have already taken never costs a second slot, on the API exactly as on the site. A lost file or a repeated build must not burn your allowance.