REST API

Base URL and spec

https://api.threefold.eco

Authentication

curl https://api.threefold.eco/api/usage -H "Authorization: Bearer tf_live_your_key"
CredentialNotes
API key, tf_live_…Created in your workspace with scopes read, track, ingest, analysis, admin. Only a hash is stored; the key is shown once.
Sandbox key, tf_test_…Fixture data only, read-only, never charged, never calls a supplier
OAuth 2.1 access tokenFrom browser sign-in, as used by chat apps and npx threefold login
NoneKeyless library reads, capped per IP address per day (50 by default). Responses carry X-Threefold-Next: sign in for the monthly allowance.

GET routes need the read scope. Writes need the scope named on each route. See Accounts and keys.

Discover, describe, call

Every callable endpoint is in the registry with its task, inputs, coverage, provenance, limits and cost class:

curl "https://api.threefold.eco/api/discover?q=compare+meditation+apps+in+DE+and+JP"
curl https://api.threefold.eco/api/discover/compare_markets
curl "https://api.threefold.eco/api/compare?from=de&to=jp&niche=health-fitness"

/api/discover ranks endpoints for a plain-language task and lists valid market codes and niche slugs. /api/discover/<id> returns one endpoint's inputs with examples, coverage, provenance, limits and price.

Common routes

RouteWhat
GET /api/metaMarkets, niches, language variants, the library configuration, and when each source was last collected (freshness)
GET /api/chart?market&niche&storeTop apps in one market and niche, with localisation signals
GET /api/compare?from&to&niche&storeOne niche in two markets: shared, not crossed over, local only
GET /api/apps/:id?markets&storeOne app across storefronts, both stores side by side when linked
GET /api/apps/:id/brief?to&from&storeMarket brief for one app into one market
GET /api/search?q&limit&offset&storeTitle and developer search over both stores
GET /api/apps/:id/history?market&storeListing changes over time
GET /api/chart-history?app&market&niche&store&daysDaily chart ranks
GET /api/apps/:id/reviews, /reviews/summaryStore reviews and their language mix
GET /api/paid, /api/paid/summary, /api/organicCollected ads and posts (Paid and Organic need supplier connections; see Data and freshness)
GET /api/visuals/galleryScreenshot gallery
GET /api/market-glossary, POST /api/variant-lint, POST /api/listing-check, GET /api/price-points, GET /api/market-launch-checklistMarket resources
GET /api/i18n/rules, POST /api/i18n/reportsi18n check catalogue and stored reports
POST /api/watches, GET /api/watchesWatches
GET /api/usage, GET /api/mePlan, limits and usage

Markets are gb, us, es, mx, ar, br, de, fr, jp, kr. Niches are games, education, health-fitness, finance, productivity, lifestyle. store is ios (default) or play. The full list is in the API reference.

Response headers

HeaderMeaning
X-Threefold-Cost-Micro-UsdWhat this call cost (1,000,000 micro-USD is one US dollar)
X-Threefold-Balance-Micro-UsdWorkspace balance after the call, when there is one
X-Threefold-Idempotent-Replaytrue when the answer is a replay of an earlier call with the same Idempotency-Key
X-Threefold-NextA hint for keyless callers
Retry-AfterOn 429: seconds to wait

Send Idempotency-Key: <unique value> on a call you might retry. A settled call with the same key returns the earlier result without charging again; a call with that key still in flight gets 409.

Paging

List routes take limit and offset. /api/paid, /api/organic and /api/chart-history return page: { limit, offset, nextOffset }, where nextOffset is null on the last page. /api/search returns a plain array: a page shorter than limit (default 20, max 100) is the last one.

Intent inputs

Discovery and the heavier endpoints accept task_intent (what you are trying to do; logged hashed) and output_destination: code for compact JSON, doc for citations and links, chat for a summary sentence, or design_tool.

Async jobs and webhooks

Fresh pulls and backfills return a job id. Read it at GET /api/jobs/:id. Pass webhook_url to be called when it finishes; the body is signed with HMAC-SHA256 in X-Threefold-Signature (sha256=<hex>). Webhook URLs must be public addresses.

Asking for coverage

POST /api/coverage/request records a market, app or channel you needed and threefold did not have. It is free, and it is how missing coverage gets prioritised.

Errors

Every error has the same body: { error, code, whose_error, retryable, hint }. The codes are a closed set: see Errors.