# How threefold works

> threefold collects how competing apps look, rank, price and advertise across 10 language markets, keeps historical snapshots, and publishes every endpoint in one registry. Your AI agent discovers the right tool over MCP or REST (the CLI and the SDKs are built and not published yet), reads its limits and provenance, and checks whether your app is ready before launch.

## Who is threefold built for?

- **App builders:** Indie developers and small teams expanding a consumer app into new language markets. Compare what top apps do differently, then run local readiness checks before you ship.
- **Their agents:** Claude Code, Codex, Cursor, Gemini CLI and chat apps call threefold as tools. Every endpoint declares its inputs, coverage, provenance and cost class so agents do not guess.
- **Agencies and teams:** Studios and product teams entering markets together with client briefs, saved evidence collections, competitor watches and hand-over reports.

Audience guides: [For developers](https://threefold.eco/for-developers.md) · [For e-commerce](https://threefold.eco/for-ecommerce.md) · [For businesses](https://threefold.eco/for-businesses.md) · [For agencies](https://threefold.eco/for-agencies.md).

## How does the library reach your agent?

Sources (App Store charts and listings, Google Play listings, store reviews, official ad libraries and creator platforms) feed one shared library keyed by market and language variant. One endpoint registry (`registry/endpoints.yaml`) generates the four MCP tools (`app`, `market`, `check`, `workspace`), HTTP routes, OpenAPI 3.1 spec, `/llms.txt` and typed SDKs.

## Data sources and freshness

- **Brand (live, no customer key needed):** App Store charts and listings, Google Play listings and charts, and store reviews across 10 markets (`gb`, `us`, `es`, `mx`, `ar`, `br`, `de`, `fr`, `jp`, `kr`) and 6 niches (`games`, `education`, `health-fitness`, `finance`, `productivity`, `lifestyle`). Check live collection timestamps at `GET https://api.threefold.eco/api/meta`.
- **Paid and Organic:** Collected only from official platform programmes where credentials and approvals are live; every other market or channel returns direct country-filtered platform links rather than fabricated data. See [Data and freshness](https://threefold.eco/docs/data.md).

## Metering, privacy and EU hosting

- **Metering and caps:** Every HTTP response returns `X-Threefold-Cost-Micro-Usd` and `X-Threefold-Balance-Micro-Usd` (and `_meta` in MCP). Keyless reads (50/IP/day) and `tf_test_…` sandbox keys cost nothing; workspaces and API keys enforce hard spend caps (`402`). See [Pricing](https://threefold.eco/pricing.md).
- **Privacy:** The hosted `check` tool returns rules and does not receive or scan your repository (the local `threefold check` is not publicly available yet). API keys, sign-in links, sessions and OAuth tokens are stored only as SHA-256 hashes.
- **EU hosting:** The API and worker run in `europe-west4` (Netherlands), and an EU region guard checks database and storage hosts at start-up.

## Questions

### How does threefold keep tool schemas, docs and `llms.txt` in sync?

Every public endpoint is defined once in `registry/endpoints.yaml`. The HTTP router, MCP tools, OpenAPI 3.1 document, `/llms.txt` index, typed SDKs and documentation are generated from that registry, and automated tests verify that routes, tools and registry match.

### Which data sources are live today and which are links only?

App Store and Google Play store pages and store reviews are live without customer credentials and refresh on a schedule. Official ad-library and creator-platform collectors run where approvals and credentials are active; every unsupported market or channel returns direct country-filtered links rather than invented numbers.

### How does threefold stop an autonomous agent from overspending?

Every HTTP response returns `X-Threefold-Cost-Micro-Usd` and `X-Threefold-Balance-Micro-Usd`, and MCP responses carry the same fields in `_meta`. Workspaces have monthly allowances and plan limits, individual API keys can carry their own monthly spend cap, and crossing any limit returns HTTP `402` immediately.

### Where is threefold hosted and is my source code uploaded?

The API and ingest worker run in the EU (`europe-west4`, Netherlands), and the server refuses to start when the EU data-region guard sees a non-EU database or storage host. The local i18n check reads your repository on your own machine and never uploads source code.
