- Method
GET- Path
/api/v1/search- Auth
- Token required (Authorization: Bearer, X-Api-Key or ?key=)
- Handler
ApiController::search()- Routing
- Reserved endpoint for $first === 'search' in dispatch()
- Description
- Cross-model keyword search
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 |
|---|---|---|---|---|---|
q |
string | yes ✓ |
''
|
Search keyword (required). Falls back to the keyword parameter when empty |
Request::str
fail(400, '…') |
keyword |
string | no |
''
|
Alias of q, used when q is empty | Request::str |
lang |
string | no |
zh
|
Language code (zh / en). Defaults to the site default language; a token language allow-list still applies | resolveLang() |
mode |
string | no |
and
|
Keyword matching: and requires every word (default), or accepts any. Invalid values fall back to and | Request::str |
page |
int | no |
1
|
Page number, starting at 1; values below 1 are clamped to 1 | pageParams() |
per_page |
int | no |
12
|
Items per page. When omitted (or <=0) the site list page size is used, capped by api_page_max | pageParams() [min(api_page_max=50, list page size)] |
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 |
Missing search keyword (q) | |
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/search'
| Placeholder | Value on this site |
|---|---|
{model} |
news |
{slug} |
heng-air-6-3-launch |
Common scenarios
- Cross-model site search: and semantics by default, so unrelated hits are not returned
/api/v1/search?q=keyword - Chatbots and fallback retrieval: pass mode=or to accept any keyword
/api/v1/search?q=keyword1 keyword2&mode=or