- Method
GET- Path
/api/v1/categories- Auth
- Token required (Authorization: Bearer, X-Api-Key or ?key=)
- Handler
ApiController::categories()- Routing
- Reserved endpoint for $first === 'categories' in dispatch()
- Description
- Category tree, filterable by model and language
Parameters
The parameter set, types and defaults are scanned out of the endpoint source. A ✓ next to Required means the exact source line that rejects the missing value is still present in the method body, which the reconciler re-checks every run.
| Parameter | Type | Required | Default | Notes | Origin / evidence |
|---|---|---|---|---|---|
lang |
string | no |
zh
|
Language code (zh / en). Defaults to the site default language; a token language allow-list still applies | resolveLang() |
model |
string | no |
''
|
Only return categories of this model; omit for every visible category | Request::str |
Response sample
not captured yet Run php cli/build-manual.php --capture; the reconciler reports a missing sample as a failure.
Error codes
| Code | Meaning | Scope |
|---|---|---|
400 |
Unknown language | Parameter validation |
401 |
Invalid API token | |
403 |
This token may not access that model | Authorization |
403 |
This token may not access that language | Authorization |
404 |
Endpoint not found | |
404 |
Unknown content model | |
405 |
Read-only API: GET is the only supported method | |
429 |
Too many requests, please retry later | |
500 |
Internal server error | |
503 |
The open API is not enabled on this site |
Example call
The URL is built from the registry path plus real parameters from this site; replace the token with your own.
curl -sS \
-H 'Authorization: Bearer ' \
-H 'Accept: application/json' \
'https://www.genhikesports.com/api/v1/categories'
| Placeholder | Value on this site |
|---|---|
{model} |
news |
{slug} |
heng-air-6-3-launch |
Common scenarios
- Build a navigation or filter tree limited to one model
/api/v1/categories?model=doc - Multi-language sites pass lang=en to get the English category tree
/api/v1/categories?lang=en