Category tree endpoint
https://api.scrapereviews.com/v1/categories1 creditThe categories endpoint returns the whole Trustpilot category tree in one response: the top-level categories (Animals & Pets, Money & Insurance, Shopping & Fashion and the others) and, nested under each one, its subcategories with their own subcategories.
Every node has an id and an English name. The id is what the category companies endpoint expects: bank, shoe_store, car_dealer, electronics_technology and so on. The tree changes rarely, so fetch it once, store it and refresh it every few weeks.
The endpoint takes no parameters. Use it to build a category picker, to map your own industry codes to Trustpilot categories, or to iterate over every subcategory of a sector when you rank companies.
Parameters
This endpoint takes no parameters.
Authenticate with your API key in the X-API-Key header or as Authorization: Bearer (see authentication).
Example request
curl "https://api.scrapereviews.com/v1/categories" \
-H "X-API-Key: sr_your_api_key"Response
{ "data": Category[], "meta": BaseMeta }{
"data": [
{
"id": "animals_pets",
"name": "Animals & Pets",
"subcategories": [
{ "id": "animal_health", "name": "Animal Health", "subcategories": [] },
{ "id": "pet_store", "name": "Pet Store", "subcategories": [] }
]
}
],
"meta": { "credits_used": 1, "cache_hit": true }
}Every field is described in the response models. Successful responses also carry the X-Credits-Used header.
Cost
The whole tree costs 1 credit, whatever its size. It is cached for 24 hours.
Only successful calls are billed: every error costs 0 credits. You get 100 free credits every month; see pricing for credit packs.
Errors
Errors come with an HTTP status and this JSON body: branch on detail.error, show detail.message to humans.
{
"detail": {
"error": "invalid_api_key",
"message": "Invalid or inactive API key."
}
}| HTTP | error | Meaning |
|---|---|---|
| 401 | missing_api_key | No API key in X-API-Key or Authorization: Bearer. |
| 401 | invalid_api_key | The key does not exist or has been revoked. |
| 402 | insufficient_credits | Your credit balance is 0. |
| 429 | rate_limit_exceeded | Too many requests per minute. |
| 429 | insufficient_credits_retry_later | The balance ran out on recent calls and the key is cooling down. |
| 502 | upstream_changed | Trustpilot changed its page format and the response could not be read. |
| 503 | upstream_blocked | Trustpilot is temporarily blocking requests. |
| 504 | upstream_timeout | Trustpilot did not answer in time. |
What to do for each code: error handling.
Use cases
- Build a category selector for a market research tool.
- Walk every subcategory of a sector (for example all of Money & Insurance) and rank its companies by country.
- Map Trustpilot categories to your own taxonomy once and store the ids.
Related endpoints
- Category companies GET /v1/categories/{category_id}/companies: The companies of a category in a country.
- Company search GET /v1/companies/search: Search companies by name or domain. An exact domain returns that company.
ScrapeReviews is an independent service and is not affiliated with or endorsed by Trustpilot.