Search for a keyword in Google, returns top page results with markdown content for each page
curl --request POST \
--url https://api.firecrawl.dev/v0/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"pageOptions": {
"onlyMainContent": false,
"fetchPageContent": true,
"includeHtml": false,
"includeRawHtml": false
},
"searchOptions": {
"limit": 123
}
}
'import requests
url = "https://api.firecrawl.dev/v0/search"
payload = {
"query": "<string>",
"pageOptions": {
"onlyMainContent": False,
"fetchPageContent": True,
"includeHtml": False,
"includeRawHtml": False
},
"searchOptions": { "limit": 123 }
}
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>',
pageOptions: {
onlyMainContent: false,
fetchPageContent: true,
includeHtml: false,
includeRawHtml: false
},
searchOptions: {limit: 123}
})
};
fetch('https://api.firecrawl.dev/v0/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/v0/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>',
'pageOptions' => [
'onlyMainContent' => false,
'fetchPageContent' => true,
'includeHtml' => false,
'includeRawHtml' => false
],
'searchOptions' => [
'limit' => 123
]
]),
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/v0/search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"pageOptions\": {\n \"onlyMainContent\": false,\n \"fetchPageContent\": true,\n \"includeHtml\": false,\n \"includeRawHtml\": false\n },\n \"searchOptions\": {\n \"limit\": 123\n }\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/v0/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"pageOptions\": {\n \"onlyMainContent\": false,\n \"fetchPageContent\": true,\n \"includeHtml\": false,\n \"includeRawHtml\": false\n },\n \"searchOptions\": {\n \"limit\": 123\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firecrawl.dev/v0/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 \"pageOptions\": {\n \"onlyMainContent\": false,\n \"fetchPageContent\": true,\n \"includeHtml\": false,\n \"includeRawHtml\": false\n },\n \"searchOptions\": {\n \"limit\": 123\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": [
{
"url": "<string>",
"markdown": "<string>",
"content": "<string>",
"metadata": {
"title": "<string>",
"description": "<string>",
"language": "<string>",
"sourceURL": "<string>"
}
}
]
}{
"error": "Payment required to access this resource."
}{
"error": "Request rate limit exceeded. Please wait and try again later."
}{
"error": "An unexpected error occurred on the server."
}接口
搜索(Beta 版)
POST
/
search
Search for a keyword in Google, returns top page results with markdown content for each page
curl --request POST \
--url https://api.firecrawl.dev/v0/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"pageOptions": {
"onlyMainContent": false,
"fetchPageContent": true,
"includeHtml": false,
"includeRawHtml": false
},
"searchOptions": {
"limit": 123
}
}
'import requests
url = "https://api.firecrawl.dev/v0/search"
payload = {
"query": "<string>",
"pageOptions": {
"onlyMainContent": False,
"fetchPageContent": True,
"includeHtml": False,
"includeRawHtml": False
},
"searchOptions": { "limit": 123 }
}
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>',
pageOptions: {
onlyMainContent: false,
fetchPageContent: true,
includeHtml: false,
includeRawHtml: false
},
searchOptions: {limit: 123}
})
};
fetch('https://api.firecrawl.dev/v0/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/v0/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>',
'pageOptions' => [
'onlyMainContent' => false,
'fetchPageContent' => true,
'includeHtml' => false,
'includeRawHtml' => false
],
'searchOptions' => [
'limit' => 123
]
]),
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/v0/search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"pageOptions\": {\n \"onlyMainContent\": false,\n \"fetchPageContent\": true,\n \"includeHtml\": false,\n \"includeRawHtml\": false\n },\n \"searchOptions\": {\n \"limit\": 123\n }\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/v0/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"pageOptions\": {\n \"onlyMainContent\": false,\n \"fetchPageContent\": true,\n \"includeHtml\": false,\n \"includeRawHtml\": false\n },\n \"searchOptions\": {\n \"limit\": 123\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firecrawl.dev/v0/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 \"pageOptions\": {\n \"onlyMainContent\": false,\n \"fetchPageContent\": true,\n \"includeHtml\": false,\n \"includeRawHtml\": false\n },\n \"searchOptions\": {\n \"limit\": 123\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": [
{
"url": "<string>",
"markdown": "<string>",
"content": "<string>",
"metadata": {
"title": "<string>",
"description": "<string>",
"language": "<string>",
"sourceURL": "<string>"
}
}
]
}{
"error": "Payment required to access this resource."
}{
"error": "Request rate limit exceeded. Please wait and try again later."
}{
"error": "An unexpected error occurred on the server."
}搜索端点结合了搜索 API 和 Firecrawl 的强大功能,为任何查询提供强大的搜索体验。
它会自动在网络中搜索查询内容,并以 Markdown 格式返回来自顶级页面的最相关结果。此端点的优势在于它实际上会抓取顶级结果中的每个网站,因此您始终可以获得完整的内容。
此端点目前处于 Beta 阶段,可能会有变动。
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
⌘I