Search and optionally scrape search results
curl --request POST \
--url https://api.firecrawl.dev/v1/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"limit": 5,
"tbs": "<string>",
"lang": "en",
"country": "us",
"location": "<string>",
"timeout": 60000,
"scrapeOptions": {}
}
'import requests
url = "https://api.firecrawl.dev/v1/search"
payload = {
"query": "<string>",
"limit": 5,
"tbs": "<string>",
"lang": "en",
"country": "us",
"location": "<string>",
"timeout": 60000,
"scrapeOptions": {}
}
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: '<string>',
limit: 5,
tbs: '<string>',
lang: 'en',
country: 'us',
location: '<string>',
timeout: 60000,
scrapeOptions: {}
})
};
fetch('https://api.firecrawl.dev/v1/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.firecrawl.dev/v1/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' => '<string>',
'limit' => 5,
'tbs' => '<string>',
'lang' => 'en',
'country' => 'us',
'location' => '<string>',
'timeout' => 60000,
'scrapeOptions' => [
]
]),
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.firecrawl.dev/v1/search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"limit\": 5,\n \"tbs\": \"<string>\",\n \"lang\": \"en\",\n \"country\": \"us\",\n \"location\": \"<string>\",\n \"timeout\": 60000,\n \"scrapeOptions\": {}\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.firecrawl.dev/v1/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"limit\": 5,\n \"tbs\": \"<string>\",\n \"lang\": \"en\",\n \"country\": \"us\",\n \"location\": \"<string>\",\n \"timeout\": 60000,\n \"scrapeOptions\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firecrawl.dev/v1/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\": \"<string>\",\n \"limit\": 5,\n \"tbs\": \"<string>\",\n \"lang\": \"en\",\n \"country\": \"us\",\n \"location\": \"<string>\",\n \"timeout\": 60000,\n \"scrapeOptions\": {}\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": [
{
"title": "<string>",
"description": "<string>",
"url": "<string>",
"markdown": "<string>",
"html": "<string>",
"rawHtml": "<string>",
"links": [
"<string>"
],
"screenshot": "<string>",
"metadata": {
"title": "<string>",
"description": "<string>",
"sourceURL": "<string>",
"statusCode": 123,
"error": "<string>"
}
}
],
"warning": "<string>"
}{
"success": false,
"error": "Request timed out"
}{
"success": false,
"error": "An unexpected error occurred on the server."
}搜索接口
搜索
POST
/
search
Search and optionally scrape search results
curl --request POST \
--url https://api.firecrawl.dev/v1/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"limit": 5,
"tbs": "<string>",
"lang": "en",
"country": "us",
"location": "<string>",
"timeout": 60000,
"scrapeOptions": {}
}
'import requests
url = "https://api.firecrawl.dev/v1/search"
payload = {
"query": "<string>",
"limit": 5,
"tbs": "<string>",
"lang": "en",
"country": "us",
"location": "<string>",
"timeout": 60000,
"scrapeOptions": {}
}
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: '<string>',
limit: 5,
tbs: '<string>',
lang: 'en',
country: 'us',
location: '<string>',
timeout: 60000,
scrapeOptions: {}
})
};
fetch('https://api.firecrawl.dev/v1/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.firecrawl.dev/v1/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' => '<string>',
'limit' => 5,
'tbs' => '<string>',
'lang' => 'en',
'country' => 'us',
'location' => '<string>',
'timeout' => 60000,
'scrapeOptions' => [
]
]),
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.firecrawl.dev/v1/search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"limit\": 5,\n \"tbs\": \"<string>\",\n \"lang\": \"en\",\n \"country\": \"us\",\n \"location\": \"<string>\",\n \"timeout\": 60000,\n \"scrapeOptions\": {}\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.firecrawl.dev/v1/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"limit\": 5,\n \"tbs\": \"<string>\",\n \"lang\": \"en\",\n \"country\": \"us\",\n \"location\": \"<string>\",\n \"timeout\": 60000,\n \"scrapeOptions\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firecrawl.dev/v1/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\": \"<string>\",\n \"limit\": 5,\n \"tbs\": \"<string>\",\n \"lang\": \"en\",\n \"country\": \"us\",\n \"location\": \"<string>\",\n \"timeout\": 60000,\n \"scrapeOptions\": {}\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": [
{
"title": "<string>",
"description": "<string>",
"url": "<string>",
"markdown": "<string>",
"html": "<string>",
"rawHtml": "<string>",
"links": [
"<string>"
],
"screenshot": "<string>",
"metadata": {
"title": "<string>",
"description": "<string>",
"sourceURL": "<string>",
"statusCode": 123,
"error": "<string>"
}
}
],
"warning": "<string>"
}{
"success": false,
"error": "Request timed out"
}{
"success": false,
"error": "An unexpected error occurred on the server."
}搜索端点将网页搜索(SERP)与Firecrawl的抓取能力相结合,以返回任何查询的完整页面内容。
请在
scrapeOptions 中包含 formats: ["markdown"] 来获取每个搜索结果的完整Markdown内容,否则你将默认获得SERP结果(url、标题、描述)。Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
The search query
Maximum number of results to return
Required range:
1 <= x <= 10Time-based search parameter
Language code for search results
Country code for search results
Location parameter for search results
Timeout in milliseconds
Options for scraping search results
Show child attributes
Show child attributes
⌘I