MCPcopy
hub / github.com/firecrawl/firecrawl / scrapeStatusController

Function scrapeStatusController

apps/api/src/controllers/v2/scrape-status.ts:6–65  ·  view source on GitHub ↗
(req: any, res: any)

Source from the content-addressed store, hash-verified

4import { getScrapeZDR } from "../../lib/zdr-helpers";
5
6export async function scrapeStatusController(req: any, res: any) {
7 const uuidReg =
8 /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
9 if (!req.params.jobId || !uuidReg.test(req.params.jobId)) {
10 return res.status(400).json({
11 success: false,
12 error: "Invalid crawl ID",
13 });
14 }
15
16 const logger = _logger.child({
17 module: "scrape-status",
18 method: "scrapeStatusController",
19 teamId: req.auth.team_id,
20 jobId: req.params.jobId,
21 scrapeId: req.params.jobId,
22 zeroDataRetention: getScrapeZDR(req.acuc?.flags) === "forced",
23 });
24
25 if (getScrapeZDR(req.acuc?.flags) === "forced") {
26 return res.status(400).json({
27 success: false,
28 error:
29 "Your team has zero data retention enabled. This is not supported on scrape status. Please contact support@firecrawl.com to unblock this feature.",
30 });
31 }
32
33 const job = await supabaseGetScrapeByIdOnlyData(req.params.jobId, logger);
34
35 if (!job) {
36 return res.status(404).json({
37 success: false,
38 error: "Job not found.",
39 });
40 }
41
42 if (job?.team_id !== req.auth.team_id) {
43 return res.status(403).json({
44 success: false,
45 error: "You are not allowed to access this resource.",
46 });
47 }
48
49 const jobData = await getJob(req.params.jobId, logger);
50 const data = Array.isArray(jobData?.returnvalue)
51 ? jobData?.returnvalue[0]
52 : jobData?.returnvalue;
53
54 if (!data) {
55 return res.status(404).json({
56 success: false,
57 error: "Job not found.",
58 });
59 }
60
61 return res.status(200).json({
62 success: true,
63 data,

Callers

nothing calls this directly

Calls 5

getScrapeZDRFunction · 0.90
getJobFunction · 0.90
childMethod · 0.80
jsonMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…