curl --request POST \
--url https://api.firecrawl.dev/v2/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"categories": [
{
"type": "github"
}
],
"country": "US",
"enterprise": [],
"excludeDomains": [
"<string>"
],
"ignoreInvalidURLs": false,
"includeDomains": [
"<string>"
],
"limit": 10,
"location": "<string>",
"scrapeOptions": {},
"sources": [
"web"
],
"tbs": "<string>",
"threatProtection": {
"blacklist": [
"<string>"
],
"blockedTlds": [
"<string>"
],
"riskScoreThreshold": 75,
"whitelist": [
"<string>"
]
},
"timeout": 60000
}
'import requests
url = "https://api.firecrawl.dev/v2/search"
payload = {
"query": "<string>",
"categories": [{ "type": "github" }],
"country": "US",
"enterprise": [],
"excludeDomains": ["<string>"],
"ignoreInvalidURLs": False,
"includeDomains": ["<string>"],
"limit": 10,
"location": "<string>",
"scrapeOptions": {},
"sources": ["web"],
"tbs": "<string>",
"threatProtection": {
"blacklist": ["<string>"],
"blockedTlds": ["<string>"],
"riskScoreThreshold": 75,
"whitelist": ["<string>"]
},
"timeout": 60000
}
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>',
categories: [{type: 'github'}],
country: 'US',
enterprise: [],
excludeDomains: ['<string>'],
ignoreInvalidURLs: false,
includeDomains: ['<string>'],
limit: 10,
location: '<string>',
scrapeOptions: {},
sources: ['web'],
tbs: '<string>',
threatProtection: {
blacklist: ['<string>'],
blockedTlds: ['<string>'],
riskScoreThreshold: 75,
whitelist: ['<string>']
},
timeout: 60000
})
};
fetch('https://api.firecrawl.dev/v2/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/v2/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>',
'categories' => [
[
'type' => 'github'
]
],
'country' => 'US',
'enterprise' => [
],
'excludeDomains' => [
'<string>'
],
'ignoreInvalidURLs' => false,
'includeDomains' => [
'<string>'
],
'limit' => 10,
'location' => '<string>',
'scrapeOptions' => [
],
'sources' => [
'web'
],
'tbs' => '<string>',
'threatProtection' => [
'blacklist' => [
'<string>'
],
'blockedTlds' => [
'<string>'
],
'riskScoreThreshold' => 75,
'whitelist' => [
'<string>'
]
],
'timeout' => 60000
]),
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/v2/search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"categories\": [\n {\n \"type\": \"github\"\n }\n ],\n \"country\": \"US\",\n \"enterprise\": [],\n \"excludeDomains\": [\n \"<string>\"\n ],\n \"ignoreInvalidURLs\": false,\n \"includeDomains\": [\n \"<string>\"\n ],\n \"limit\": 10,\n \"location\": \"<string>\",\n \"scrapeOptions\": {},\n \"sources\": [\n \"web\"\n ],\n \"tbs\": \"<string>\",\n \"threatProtection\": {\n \"blacklist\": [\n \"<string>\"\n ],\n \"blockedTlds\": [\n \"<string>\"\n ],\n \"riskScoreThreshold\": 75,\n \"whitelist\": [\n \"<string>\"\n ]\n },\n \"timeout\": 60000\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/v2/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"categories\": [\n {\n \"type\": \"github\"\n }\n ],\n \"country\": \"US\",\n \"enterprise\": [],\n \"excludeDomains\": [\n \"<string>\"\n ],\n \"ignoreInvalidURLs\": false,\n \"includeDomains\": [\n \"<string>\"\n ],\n \"limit\": 10,\n \"location\": \"<string>\",\n \"scrapeOptions\": {},\n \"sources\": [\n \"web\"\n ],\n \"tbs\": \"<string>\",\n \"threatProtection\": {\n \"blacklist\": [\n \"<string>\"\n ],\n \"blockedTlds\": [\n \"<string>\"\n ],\n \"riskScoreThreshold\": 75,\n \"whitelist\": [\n \"<string>\"\n ]\n },\n \"timeout\": 60000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firecrawl.dev/v2/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 \"categories\": [\n {\n \"type\": \"github\"\n }\n ],\n \"country\": \"US\",\n \"enterprise\": [],\n \"excludeDomains\": [\n \"<string>\"\n ],\n \"ignoreInvalidURLs\": false,\n \"includeDomains\": [\n \"<string>\"\n ],\n \"limit\": 10,\n \"location\": \"<string>\",\n \"scrapeOptions\": {},\n \"sources\": [\n \"web\"\n ],\n \"tbs\": \"<string>\",\n \"threatProtection\": {\n \"blacklist\": [\n \"<string>\"\n ],\n \"blockedTlds\": [\n \"<string>\"\n ],\n \"riskScoreThreshold\": 75,\n \"whitelist\": [\n \"<string>\"\n ]\n },\n \"timeout\": 60000\n}"
response = http.request(request)
puts response.read_body{
"creditsUsed": 123,
"data": {
"images": [
{
"imageHeight": 123,
"imageUrl": "<string>",
"imageWidth": 123,
"position": 123,
"title": "<string>",
"url": "<string>"
}
],
"news": [
{
"audio": "<string>",
"date": "<string>",
"html": "<string>",
"imageUrl": "<string>",
"links": [
"<string>"
],
"markdown": "<string>",
"metadata": {
"description": "<string>",
"error": "<string>",
"numPages": 123,
"sourceURL": "<string>",
"statusCode": 123,
"title": "<string>",
"totalPages": 123,
"url": "<string>"
},
"position": 123,
"rawHtml": "<string>",
"screenshot": "<string>",
"snippet": "<string>",
"title": "<string>",
"url": "<string>",
"video": "<string>"
}
],
"web": [
{
"audio": "<string>",
"description": "<string>",
"html": "<string>",
"links": [
"<string>"
],
"markdown": "<string>",
"metadata": {
"description": "<string>",
"error": "<string>",
"numPages": 123,
"sourceURL": "<string>",
"statusCode": 123,
"title": "<string>",
"totalPages": 123,
"url": "<string>"
},
"rawHtml": "<string>",
"screenshot": "<string>",
"title": "<string>",
"url": "<string>",
"video": "<string>"
}
]
},
"id": "<string>",
"success": true,
"warning": "<string>"
}{
"error": "Request timed out",
"success": false
}{
"code": "UNKNOWN_ERROR",
"error": "An unexpected error occurred on the server.",
"success": false
}Search(搜索)
curl --request POST \
--url https://api.firecrawl.dev/v2/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"categories": [
{
"type": "github"
}
],
"country": "US",
"enterprise": [],
"excludeDomains": [
"<string>"
],
"ignoreInvalidURLs": false,
"includeDomains": [
"<string>"
],
"limit": 10,
"location": "<string>",
"scrapeOptions": {},
"sources": [
"web"
],
"tbs": "<string>",
"threatProtection": {
"blacklist": [
"<string>"
],
"blockedTlds": [
"<string>"
],
"riskScoreThreshold": 75,
"whitelist": [
"<string>"
]
},
"timeout": 60000
}
'import requests
url = "https://api.firecrawl.dev/v2/search"
payload = {
"query": "<string>",
"categories": [{ "type": "github" }],
"country": "US",
"enterprise": [],
"excludeDomains": ["<string>"],
"ignoreInvalidURLs": False,
"includeDomains": ["<string>"],
"limit": 10,
"location": "<string>",
"scrapeOptions": {},
"sources": ["web"],
"tbs": "<string>",
"threatProtection": {
"blacklist": ["<string>"],
"blockedTlds": ["<string>"],
"riskScoreThreshold": 75,
"whitelist": ["<string>"]
},
"timeout": 60000
}
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>',
categories: [{type: 'github'}],
country: 'US',
enterprise: [],
excludeDomains: ['<string>'],
ignoreInvalidURLs: false,
includeDomains: ['<string>'],
limit: 10,
location: '<string>',
scrapeOptions: {},
sources: ['web'],
tbs: '<string>',
threatProtection: {
blacklist: ['<string>'],
blockedTlds: ['<string>'],
riskScoreThreshold: 75,
whitelist: ['<string>']
},
timeout: 60000
})
};
fetch('https://api.firecrawl.dev/v2/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/v2/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>',
'categories' => [
[
'type' => 'github'
]
],
'country' => 'US',
'enterprise' => [
],
'excludeDomains' => [
'<string>'
],
'ignoreInvalidURLs' => false,
'includeDomains' => [
'<string>'
],
'limit' => 10,
'location' => '<string>',
'scrapeOptions' => [
],
'sources' => [
'web'
],
'tbs' => '<string>',
'threatProtection' => [
'blacklist' => [
'<string>'
],
'blockedTlds' => [
'<string>'
],
'riskScoreThreshold' => 75,
'whitelist' => [
'<string>'
]
],
'timeout' => 60000
]),
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/v2/search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"categories\": [\n {\n \"type\": \"github\"\n }\n ],\n \"country\": \"US\",\n \"enterprise\": [],\n \"excludeDomains\": [\n \"<string>\"\n ],\n \"ignoreInvalidURLs\": false,\n \"includeDomains\": [\n \"<string>\"\n ],\n \"limit\": 10,\n \"location\": \"<string>\",\n \"scrapeOptions\": {},\n \"sources\": [\n \"web\"\n ],\n \"tbs\": \"<string>\",\n \"threatProtection\": {\n \"blacklist\": [\n \"<string>\"\n ],\n \"blockedTlds\": [\n \"<string>\"\n ],\n \"riskScoreThreshold\": 75,\n \"whitelist\": [\n \"<string>\"\n ]\n },\n \"timeout\": 60000\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/v2/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"categories\": [\n {\n \"type\": \"github\"\n }\n ],\n \"country\": \"US\",\n \"enterprise\": [],\n \"excludeDomains\": [\n \"<string>\"\n ],\n \"ignoreInvalidURLs\": false,\n \"includeDomains\": [\n \"<string>\"\n ],\n \"limit\": 10,\n \"location\": \"<string>\",\n \"scrapeOptions\": {},\n \"sources\": [\n \"web\"\n ],\n \"tbs\": \"<string>\",\n \"threatProtection\": {\n \"blacklist\": [\n \"<string>\"\n ],\n \"blockedTlds\": [\n \"<string>\"\n ],\n \"riskScoreThreshold\": 75,\n \"whitelist\": [\n \"<string>\"\n ]\n },\n \"timeout\": 60000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firecrawl.dev/v2/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 \"categories\": [\n {\n \"type\": \"github\"\n }\n ],\n \"country\": \"US\",\n \"enterprise\": [],\n \"excludeDomains\": [\n \"<string>\"\n ],\n \"ignoreInvalidURLs\": false,\n \"includeDomains\": [\n \"<string>\"\n ],\n \"limit\": 10,\n \"location\": \"<string>\",\n \"scrapeOptions\": {},\n \"sources\": [\n \"web\"\n ],\n \"tbs\": \"<string>\",\n \"threatProtection\": {\n \"blacklist\": [\n \"<string>\"\n ],\n \"blockedTlds\": [\n \"<string>\"\n ],\n \"riskScoreThreshold\": 75,\n \"whitelist\": [\n \"<string>\"\n ]\n },\n \"timeout\": 60000\n}"
response = http.request(request)
puts response.read_body{
"creditsUsed": 123,
"data": {
"images": [
{
"imageHeight": 123,
"imageUrl": "<string>",
"imageWidth": 123,
"position": 123,
"title": "<string>",
"url": "<string>"
}
],
"news": [
{
"audio": "<string>",
"date": "<string>",
"html": "<string>",
"imageUrl": "<string>",
"links": [
"<string>"
],
"markdown": "<string>",
"metadata": {
"description": "<string>",
"error": "<string>",
"numPages": 123,
"sourceURL": "<string>",
"statusCode": 123,
"title": "<string>",
"totalPages": 123,
"url": "<string>"
},
"position": 123,
"rawHtml": "<string>",
"screenshot": "<string>",
"snippet": "<string>",
"title": "<string>",
"url": "<string>",
"video": "<string>"
}
],
"web": [
{
"audio": "<string>",
"description": "<string>",
"html": "<string>",
"links": [
"<string>"
],
"markdown": "<string>",
"metadata": {
"description": "<string>",
"error": "<string>",
"numPages": 123,
"sourceURL": "<string>",
"statusCode": 123,
"title": "<string>",
"totalPages": 123,
"url": "<string>"
},
"rawHtml": "<string>",
"screenshot": "<string>",
"title": "<string>",
"url": "<string>",
"video": "<string>"
}
]
},
"id": "<string>",
"success": true,
"warning": "<string>"
}{
"error": "Request timed out",
"success": false
}{
"code": "UNKNOWN_ERROR",
"error": "An unexpected error occurred on the server.",
"success": false
}search 端点将网页搜索与 Firecrawl 的抓取能力相结合,为任意查询返回完整页面内容。
在请求中包含 scrapeOptions,并设置 formats: [{"type": "markdown"}],即可为每条搜索结果获取完整的 markdown 内容;否则默认只返回结果(url、title、description)。你也可以使用其他 formats,例如 {"type": "summary"} 来获取精简内容。
支持的查询运算符
| 运算符 | 功能 | 示例 |
|---|---|---|
"" | 精确(非模糊)匹配一段文本 | "Firecrawl" |
- | 排除特定关键词或对其他运算符取反 | -bad, -site:firecrawl.dev |
site: | 仅返回来自指定网站的结果 | site:firecrawl.dev |
filetype: | 仅返回具有特定文件扩展名的结果 | filetype:pdf, -filetype:pdf |
inurl: | 仅返回在 URL 中包含某个词的结果 | inurl:firecrawl |
allinurl: | 仅返回在 URL 中包含多个词的结果 | allinurl:git firecrawl |
intitle: | 仅返回在页面标题中包含某个词的结果 | intitle:Firecrawl |
allintitle: | 仅返回在页面标题中包含多个词的结果 | allintitle:firecrawl playground |
related: | 仅返回与特定域相关的结果 | related:firecrawl.dev |
imagesize: | 仅返回尺寸完全匹配的图片 | imagesize:1920x1080 |
larger: | 仅返回大于指定尺寸的图片 | larger:1920x1080 |
location 参数
location 参数获取按地理位置定向的搜索结果。格式:“string”。示例:“Germany”、“San Francisco,California,United States”。
查看支持的位置完整列表,了解所有可用的国家和语言。
country 参数
country 参数以 ISO 国家/地区代码指定搜索结果所属国家/地区。默认值:“US”。
示例:“US”、“DE”、“FR”、“JP”、“UK”、“CA”。
{
"query": "餐厅",
"country": "DE"
}
categories 参数
categories 参数按特定类别过滤搜索结果:
github: 在 GitHub 仓库、代码、问题和文档中搜索research: 搜索学术和研究类网站(arXiv、Nature、IEEE、PubMed 等)pdf: 搜索 PDF
使用示例
{
"query": "机器学习",
"categories": ["github", "research"],
"limit": 10
}
域名过滤
includeDomains 可将结果限制在特定域名内,或使用 excludeDomains 将特定域名从搜索结果中排除。域名只能填写主机名,不包含协议或路径。
includeDomains 和 excludeDomains 不能同时使用。
包含域名示例
{
"query": "web scraping",
"includeDomains": ["firecrawl.dev", "docs.firecrawl.dev"],
"limit": 10
}
域名排除示例
{
"query": "web scraping tools",
"excludeDomains": ["example.com"],
"limit": 10
}
分类响应
category 字段,用于表示其来源:
{
"success": true,
"data": {
"web": [
{
"url": "https://github.com/example/ml-project",
"title": "Machine Learning Project",
"description": "Implementation of ML algorithms",
"category": "github"
},
{
"url": "https://arxiv.org/abs/2024.12345",
"title": "ML Research Paper",
"description": "Latest advances in machine learning",
"category": "research"
}
]
}
}
基于时间的搜索
tbs 参数按时间范围过滤搜索结果,包括自定义日期区间。详细示例及支持的 formats 请参见 Search Feature 文档。
你是需要 Firecrawl API 密钥的 AI 代理吗?如需自动化入门说明,请参见 firecrawl.dev/agent-onboarding/SKILL.md。
授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求体
搜索查询语句
500根据类别筛选结果。默认值为 [],表示结果不会按类别进行过滤。
- GitHub
- Research
- PDF
Show child attributes
Show child attributes
用于按地域定向搜索结果的 ISO 国家代码(例如 US)。为获得最佳效果,请同时设置此参数和 location 参数。
用于零数据保留(ZDR)的企业搜索选项。端到端 ZDR 使用 ["zdr"](10 额度 / 10 个结果),匿名化 ZDR 使用 ["anon"](2 额度 / 10 个结果)。必须为你的团队启用。
anon, zdr 排除来自指定域名的搜索结果。域名应仅填写主机名,不包含协议或路径。不能与 includeDomains 一起使用。
从搜索结果中排除对其他 Firecrawl 端点无效的 URL。这样在将搜索结果数据输送到其他 Firecrawl API 端点时,有助于减少错误。
将搜索结果限制在指定域名内。域名应仅填写主机名,不包含协议或路径。不能与 excludeDomains 一起使用。
返回结果的最大数量(使用多个来源时,按每种来源类型分别计算)
1 <= x <= 100用于搜索结果的位置参数(例如 San Francisco,California,United States)。为获得最佳效果,请同时设置该参数和 country 参数。
抓取搜索结果的选项
Show child attributes
Show child attributes
要搜索的数据源。将决定响应中可用的数组。默认为 ['web']。
- Web
- Images
- News
Show child attributes
Show child attributes
用于按时间过滤结果的搜索参数。支持预设时间范围(qdr:h、qdr:d、qdr:w、qdr:m、qdr:y)、自定义日期范围(cdr:1,cd_min:MM/DD/YYYY,cd_max:MM/DD/YYYY),以及按日期排序(sbd:1)。这些参数值可以组合使用,例如:sbd:1,qdr:w。
超时(毫秒)

