API reference
Search
Search configured knowledge sources directly when you need retrieval without a generation step.
How it fits together
Select an action to see its complete inputs, request, response, and status codes.
Search the web with a search-engine model
POST
/v1/searchProduction base URL
https://api.mahvashai.irAuthenticationProject API key or user JWT
ResponseDirect OpenAI-style response
Content type
application/jsonParameters
The table shows the accepted inputs for this endpoint. Examples use placeholders and illustrate a safe integration pattern.
| Name | Location | Type | Required | Support | Details |
|---|---|---|---|---|---|
Idempotency-Key | Header | string | Optional | Supported | Replay key for an admitted run; a repeat returns the first result. |
X-Request-ID | Header | string | Optional | Mahvash extension | Client-supplied correlation ID. Echoed on every response; replaced when absent or malformed. |
X-Mahvash-Project | Header | string | Optional | Mahvash extension | Project slug or ID within the caller's organization. Narrows the request principal; it can never widen it. |
country | Body | string | Optional | Mahvash extension | Country to bias results toward, in the engine's format. |
max_results | Body | integer | Optional | Mahvash extension | Results per query, 1-20. |
model | Body | string | Required | Mahvash extension | A web search model slug (the Web Search catalog). Search models are not listed by /v1/models. |
query | Body | string | array<value> | Required | Mahvash extension | One query, or a list of queries. Each query is one paid search; the count and each query's length are bounded by service configuration. |
search_domain_filter | Body | array<value> | Optional | Mahvash extension | Restrict results to these domains (up to 20). |
Request
curl -X POST 'https://api.mahvashai.ir/v1/search' \
-H "Authorization: Bearer $MAHVASH_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: <unique-request-id>" \
-d '{
"model": "perplexity-search",
"query": "probe"
}'Response
{
"object": "<value>",
"model": "<value>",
"results": [
{
"query_index": 0,
"title": "<value>",
"url": "<value>",
"snippet": "<value>",
"date": "<value>"
}
],
"usage": {
"queries": 0
}
}Illustrative response shape; actual fields depend on the operation and model.
Status codes
| HTTP | Details |
|---|---|
| 200 | Search the web with a search-engine model. |
| 400 | The request is not valid. |
| 401 | Authentication credentials are missing or invalid. |
| 402 | The account cannot authorize the request cost. |
| 403 | The principal is not allowed to perform this request. |
| 404 | No such resource is visible to this principal. |
| 409 | The requested transition conflicts with durable resource state. |
| 429 | A quota or rate limit was exceeded. |
| 500 | An internal error occurred. |
| 502 | The selected provider returned an invalid or failed response. |
| 503 | A dependency is temporarily unavailable. |