Scrape API 概览
文档解析通过 POST /v2/scrape 完成:当 URL 指向受支持的文档类型(PDF/Word/Excel)时,Firecrawl 会自动识别文件类型并选择解析器,输出结构化结果(常用为 Markdown)。
- Endpoint:
POST https://api.firecrawl.dev/v2/scrape - Header:
Authorization: Bearer <token>、Content-Type: application/json
最小示例(Markdown)
Section titled “最小示例(Markdown)”import Firecrawl from '@mendable/firecrawl-js'
const firecrawl = new Firecrawl({ apiKey: 'fc-YOUR-API-KEY' })
const doc = await firecrawl.scrape('https://example.com/file.pdf', { formats: ['markdown'], onlyMainContent: true, parsers: [{ type: 'pdf' }],})