Web Search
curl --request POST \
--url https://api.meshapi.ai/v1/web/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "latest James Webb telescope discoveries",
"model": "perplexity/sonar",
"max_results": 5,
"include_answer": true
}
'import requests
url = "https://api.meshapi.ai/v1/web/search"
payload = {
"query": "latest James Webb telescope discoveries",
"model": "perplexity/sonar",
"max_results": 5,
"include_answer": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: 'latest James Webb telescope discoveries',
model: 'perplexity/sonar',
max_results: 5,
include_answer: true
})
};
fetch('https://api.meshapi.ai/v1/web/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.meshapi.ai/v1/web/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => 'latest James Webb telescope discoveries',
'model' => 'perplexity/sonar',
'max_results' => 5,
'include_answer' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.meshapi.ai/v1/web/search"
payload := strings.NewReader("{\n \"query\": \"latest James Webb telescope discoveries\",\n \"model\": \"perplexity/sonar\",\n \"max_results\": 5,\n \"include_answer\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.meshapi.ai/v1/web/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"latest James Webb telescope discoveries\",\n \"model\": \"perplexity/sonar\",\n \"max_results\": 5,\n \"include_answer\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meshapi.ai/v1/web/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"latest James Webb telescope discoveries\",\n \"model\": \"perplexity/sonar\",\n \"max_results\": 5,\n \"include_answer\": true\n}"
response = http.request(request)
puts response.read_body{
"query": "latest James Webb telescope discoveries",
"answer": "Recent JWST observations include early-galaxy candidates and new exoplanet atmosphere measurements.",
"results": [
{
"title": "JWST spots an early galaxy candidate",
"url": "https://example.com/jwst",
"content": "Astronomers using JWST reported a distant galaxy candidate...",
"score": 0.93
}
],
"provider": "native",
"request_id": "req_01ARZ3NDEKTSV4RRFFQ69G5FAV"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Web Search
Web Search
POST
/
v1
/
web
/
search
Web Search
curl --request POST \
--url https://api.meshapi.ai/v1/web/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "latest James Webb telescope discoveries",
"model": "perplexity/sonar",
"max_results": 5,
"include_answer": true
}
'import requests
url = "https://api.meshapi.ai/v1/web/search"
payload = {
"query": "latest James Webb telescope discoveries",
"model": "perplexity/sonar",
"max_results": 5,
"include_answer": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: 'latest James Webb telescope discoveries',
model: 'perplexity/sonar',
max_results: 5,
include_answer: true
})
};
fetch('https://api.meshapi.ai/v1/web/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.meshapi.ai/v1/web/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => 'latest James Webb telescope discoveries',
'model' => 'perplexity/sonar',
'max_results' => 5,
'include_answer' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.meshapi.ai/v1/web/search"
payload := strings.NewReader("{\n \"query\": \"latest James Webb telescope discoveries\",\n \"model\": \"perplexity/sonar\",\n \"max_results\": 5,\n \"include_answer\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.meshapi.ai/v1/web/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"latest James Webb telescope discoveries\",\n \"model\": \"perplexity/sonar\",\n \"max_results\": 5,\n \"include_answer\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meshapi.ai/v1/web/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"latest James Webb telescope discoveries\",\n \"model\": \"perplexity/sonar\",\n \"max_results\": 5,\n \"include_answer\": true\n}"
response = http.request(request)
puts response.read_body{
"query": "latest James Webb telescope discoveries",
"answer": "Recent JWST observations include early-galaxy candidates and new exoplanet atmosphere measurements.",
"results": [
{
"title": "JWST spots an early galaxy candidate",
"url": "https://example.com/jwst",
"content": "Astronomers using JWST reported a distant galaxy candidate...",
"score": 0.93
}
],
"provider": "native",
"request_id": "req_01ARZ3NDEKTSV4RRFFQ69G5FAV"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Enter your MeshAPI key (rsk_...) — sent as Authorization: Bearer <key>.
Body
application/json
The search query.
Required string length:
1 - 2000Native engine model id. Defaults to the server's configured model.
Example:
"perplexity/sonar"
Pin a specific engine. Omit to use native-first with Tavily fallback.
Available options:
native, tavily Maximum results to return.
Required range:
1 <= x <= 20Tavily search depth; ignored by the native engine.
Available options:
basic, advanced Restrict results to these domains.
Drop results from these domains.
Ask the engine for a synthesized answer alongside results.
⌘I