Skip to content

API reference

Search

Search configured knowledge sources directly when you need retrieval without a generation step.

How it fits together

  1. 01Search the web with a search-engine model

Select an action to see its complete inputs, request, response, and status codes.

Search the web with a search-engine model

POST/v1/search
Production base URLhttps://api.mahvashai.ir
AuthenticationProject API key or user JWT
ResponseDirect OpenAI-style response
Content typeapplication/json

Parameters

The table shows the accepted inputs for this endpoint. Examples use placeholders and illustrate a safe integration pattern.

NameLocationTypeRequiredSupportDetails
Idempotency-KeyHeaderstringOptionalSupportedReplay key for an admitted run; a repeat returns the first result.
X-Request-IDHeaderstringOptionalMahvash extensionClient-supplied correlation ID. Echoed on every response; replaced when absent or malformed.
X-Mahvash-ProjectHeaderstringOptionalMahvash extensionProject slug or ID within the caller's organization. Narrows the request principal; it can never widen it.
countryBodystringOptionalMahvash extensionCountry to bias results toward, in the engine's format.
max_resultsBodyintegerOptionalMahvash extensionResults per query, 1-20.
modelBodystringRequiredMahvash extensionA web search model slug (the Web Search catalog). Search models are not listed by /v1/models.
queryBodystring | array<value>RequiredMahvash extensionOne 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_filterBodyarray<value>OptionalMahvash extensionRestrict 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

HTTPDetails
200Search the web with a search-engine model.
400The request is not valid.
401Authentication credentials are missing or invalid.
402The account cannot authorize the request cost.
403The principal is not allowed to perform this request.
404No such resource is visible to this principal.
409The requested transition conflicts with durable resource state.
429A quota or rate limit was exceeded.
500An internal error occurred.
502The selected provider returned an invalid or failed response.
503A dependency is temporarily unavailable.