Firecrawl API Tutorial with Next.js: Scrape, Crawl, Deploy

Build a Next.js app on the Firecrawl API: keep the key server-side, scrape to markdown, extract typed JSON, cache, crawl in the background and deploy to Vercel.

Summarize this post with AI

A 39-minute read, or the key points in about 30 seconds, in the assistant you already use.

Opens in a new tab with the prompt filled in. Nothing passes through this site.

This Firecrawl API tutorial builds a small Next.js app the safe way. Put the key in the wrong file and it ships to every visitor's browser. Skip one crawl setting and Firecrawl refuses the job, because the default limit is 10,000 pages.

There's a quieter trap too. Pass a zod 4 schema to the SDK and it sends an empty schema, with no error at all.

Below are nine steps: scrape, JSON extraction, search, caching, background crawls, signed webhooks and the Vercel deploy, each with the code.

Every file below typechecks against firecrawl 4.44.0 and Next.js 16.4.0 (as of 7 October 2026), and the routes were run against a local mock of the API. They haven't been run against the live Firecrawl API for this post.

Some links here are affiliate links; they don't change your price.

Editorial cover showing a browser window linked by an amber arrow to a server with an amber padlock, which sends a glowing amber beam to a web page with highlighted text lines
Your Next.js server sits between the browser and Firecrawl, so the API key never leaves it.

What are you building, and what do you need?

You're building a small Next.js App Router feature with five server-side endpoints. Each one wraps one Firecrawl job with a credit cost you can predict, and the browser never sees your API key.

FileWhat it doesFirecrawl cost
app/api/scrape/route.tsTurns one URL into clean markdown, cached1 credit per page
app/api/extract/route.tsPulls typed JSON out of a pricing page with a zod schema5 credits per page
app/actions.tsA Server Action that searches the web2 credits per 10 results
app/api/crawl/route.ts and app/api/crawl/[id]/route.tsStarts a crawl in the background, then reports progress1 credit per crawled page
app/api/firecrawl-webhook/route.tsReceives crawl pages as they finish, with a signature checkFree to receive

Credit costs come from Firecrawl's billing docs, as of 7 October 2026.

Diagram of a Browser card linked to a Next.js server card holding an amber key, which links to a Firecrawl API card, with a crossed-out key above the first arrow
The browser only talks to your Next.js server. The key and every Firecrawl call stay on the server side.

What you need before you start:

  • Next.js 14 or newer with the App Router. The code targets Next.js 16.4.0 and TypeScript.
  • A Firecrawl API key. The Free plan gives you 1,000 credits a month, no card needed.
  • A Vercel account if you want to deploy at the end.
  • Node.js and npm.

If the word "endpoint" makes you pause, my explainer on how an API works covers the basics in a few minutes.

How do you build it, step by step?

Each step below adds one file and ends with something you can test with curl.

Step 1: Install the Firecrawl SDK and keep the key on the server

Install the SDK, zod for validation, and the server-only guard:

bash
npm install firecrawl zod server-only

Firecrawl's docs now use the package name firecrawl. You'll still see @mendable/firecrawl-js in older tutorials and on some doc pages. On 7 October 2026 both were at version 4.44.0, and a comparison of the installed files shows they're the same code. Pick one and stick with it.

Put your key in .env.local and never give it the NEXT_PUBLIC_ prefix:

bash
# .env.local
FIRECRAWL_API_KEY=fc-your-key-here
FIRECRAWL_WEBHOOK_SECRET=from-firecrawl-settings-advanced-tab
APP_URL=http://localhost:3000

Next.js inlines any variable that starts with NEXT_PUBLIC_ into the JavaScript it sends to the browser. Without the prefix, the variable exists only on the server. That one prefix is the difference between a private key and a public one.

Now create one shared client:

ts
// lib/firecrawl.ts
import "server-only";
import { Firecrawl } from "firecrawl";

let client: Firecrawl | null = null;

export function getFirecrawl(): Firecrawl {
  const apiKey = process.env.FIRECRAWL_API_KEY;
  if (!apiKey) {
    throw new Error("FIRECRAWL_API_KEY is not set");
  }
  client ??= new Firecrawl({ apiKey });
  return client;
}

The server-only import makes the build fail if a Client Component ever imports this file. The getter reads the key on the first call instead of at import time, so next build doesn't crash on a machine without the key.

Step 2: Scrape a page to markdown in a Route Handler

The scrape method sends one request to POST /v2/scrape and gives you back the page as markdown, plus metadata such as the title and the HTTP status code.

ts
// app/api/scrape/route.ts (first version)
import { NextResponse } from "next/server";
import { z } from "zod";
import { getFirecrawl } from "@/lib/firecrawl";

export const maxDuration = 60;

const Body = z.object({ url: z.url() });

export async function POST(request: Request) {
  const parsed = Body.safeParse(await request.json().catch(() => null));
  if (!parsed.success) {
    return NextResponse.json({ error: "Send JSON like { \"url\": \"https://...\" }" }, { status: 400 });
  }

  const doc = await getFirecrawl().scrape(parsed.data.url, {
    formats: ["markdown"],
    onlyMainContent: true,
    timeout: 30_000,
  });

  return NextResponse.json({
    title: doc.metadata?.title ?? null,
    statusCode: doc.metadata?.statusCode ?? null,
    markdown: doc.markdown ?? "",
  });
}

Test it:

bash
curl -X POST http://localhost:3000/api/scrape \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com"}'

The SDK returns the inner data object, so you read doc.markdown directly. The raw API wraps the same thing as success plus data.

One field matters more than it looks: metadata.statusCode. Firecrawl charges 1 credit whenever it returns a document, and that includes a target page that answered 403 or 404. A green response from Firecrawl doesn't mean the page you wanted loaded.

Step 3: Handle errors, retries and rate limits

This route has no error handling yet. Here's what Firecrawl sends back when things go wrong, from its error reference:

  • 401 means the key is missing or revoked.
  • 402 means you're out of credits.
  • 408 means the page took longer than your timeout.
  • 429 means you hit the per-minute rate limit or your plan's concurrent browser limit.
  • 500 and 502 are server-side failures worth retrying.

Here's the catch. In the SDK's source for version 4.44.0, the built-in retry only covers 502. A 429 comes straight back to you as an error. Against a local mock, a 429 produced one request, then an SdkError with status 429.

So add your own small retry wrapper and one place that turns SDK errors into HTTP responses:

ts
// lib/firecrawl-errors.ts
import "server-only";
import { SdkError } from "firecrawl";

const RETRYABLE = new Set([408, 429, 500, 502, 503]);

export async function withRetry<T>(fn: () => Promise<T>, attempts = 3): Promise<T> {
  for (let attempt = 1; ; attempt++) {
    try {
      return await fn();
    } catch (err) {
      const status = statusOf(err);
      if (!status || !RETRYABLE.has(status) || attempt >= attempts) throw err;
      const delayMs = Math.min(2 ** attempt * 1000, 10_000) + Math.random() * 500;
      await new Promise((resolve) => setTimeout(resolve, delayMs));
    }
  }
}

function statusOf(err: unknown): number | undefined {
  if (err instanceof SdkError) return err.status;
  if (typeof err === "object" && err !== null && "status" in err && typeof err.status === "number") {
    return err.status;
  }
  return undefined;
}

export function toErrorResponse(err: unknown): { status: number; message: string } {
  const status = statusOf(err);
  if (status !== undefined) {
    switch (status) {
      case 401:
        return { status: 500, message: "Firecrawl rejected the API key" };
      case 402:
        return { status: 503, message: "Out of Firecrawl credits" };
      case 408:
        return { status: 504, message: "The page took too long to load" };
      case 429:
        return { status: 429, message: "Rate limited, try again shortly" };
      default:
        return { status: 502, message: `Firecrawl request failed (${status})` };
    }
  }
  return { status: 500, message: "Unexpected error" };
}

A 401 maps to a 500 on purpose. A bad key is your bug, not your visitor's, and you don't want to tell strangers anything about your credentials.

Firecrawl's docs say to honour the Retry-After header on a 429. The SDK error doesn't expose response headers, so this wrapper uses exponential backoff with jitter instead. It stays under ten seconds, which fits inside a 60-second function.

How tight are the limits? As of 7 October 2026, the Free plan allows 10 scrape, map or search requests a minute and 2 crawl requests a minute. Hobby raises that to 100 and 20. The full table is on Firecrawl's rate limits page.

Step 4: Extract structured JSON with a zod schema

JSON mode asks Firecrawl to run an LLM over the page and return data in your shape. You pass a format object with type json, a schema and an optional prompt. It costs 5 credits per page: the base 1 plus 4 for the extraction.

Most people get this part wrong without knowing it.

Firecrawl's docs show passing a zod schema straight into the format, and the SDK converts it for you. But the SDK's converter is built for zod 3, and npm install zod installed zod 4.6.5 on 7 October 2026.

Capturing the request the SDK sends to a local mock shows the problem. With a zod 4 schema passed directly, the request carried an empty schema: only a $schema line, no properties.

There's no error. Firecrawl gets no shape to follow, and your typed result quietly stops matching.

The fix is one line. Convert the schema yourself with zod 4's built-in converter, then validate what comes back:

ts
// lib/schemas.ts
import { z } from "zod";

export const PricingPage = z.object({
  productName: z.string(),
  plans: z.array(
    z.object({
      name: z.string(),
      monthlyPrice: z.number().nullable(),
      features: z.array(z.string()),
    })
  ),
});

export type PricingPage = z.infer<typeof PricingPage>;

export const pricingJsonSchema = z.toJSONSchema(PricingPage, { target: "draft-7" });
ts
// app/api/extract/route.ts
import { NextResponse } from "next/server";
import { z } from "zod";
import { getFirecrawl } from "@/lib/firecrawl";
import { toErrorResponse, withRetry } from "@/lib/firecrawl-errors";
import { PricingPage, pricingJsonSchema } from "@/lib/schemas";

export const maxDuration = 60;

const Body = z.object({ url: z.url() });

export async function POST(request: Request) {
  const parsed = Body.safeParse(await request.json().catch(() => null));
  if (!parsed.success) {
    return NextResponse.json({ error: "A valid url is required" }, { status: 400 });
  }

  try {
    const doc = await withRetry(() =>
      getFirecrawl().scrape(parsed.data.url, {
        formats: [
          {
            type: "json",
            schema: pricingJsonSchema,
            prompt: "Extract the product name and every pricing plan on this page.",
          },
        ],
        timeout: 45_000,
        autoResume: false,
      })
    );

    const result = PricingPage.safeParse(doc.json);
    if (!result.success) {
      return NextResponse.json({ error: "Extraction did not match the schema" }, { status: 422 });
    }
    return NextResponse.json(result.data);
  } catch (err) {
    const { status, message } = toErrorResponse(err);
    return NextResponse.json({ error: message }, { status });
  }
}

With the converted schema, the captured request carried every property and every required field. The safeParse call is your second line of defence. An LLM can still return null for a field or skip a plan, and you'd rather send a 422 than store bad data.

If you're still on zod 3, passing the schema directly works, because that's the version the SDK's converter expects.

Step 5: Call Firecrawl from a Server Action

A Server Action is the shortest path from a form to Firecrawl. This one runs a web search and returns titles and URLs:

ts
// app/actions.ts
"use server";

import { getFirecrawl } from "@/lib/firecrawl";
import { toErrorResponse } from "@/lib/firecrawl-errors";

export type SearchState = {
  results: { url: string; title: string }[];
  error: string | null;
};

export async function searchAction(_prev: SearchState, formData: FormData): Promise<SearchState> {
  const query = String(formData.get("query") ?? "").trim();
  if (!query) return { results: [], error: "Type something to search for" };

  try {
    const data = await getFirecrawl().search(query, { limit: 5 });
    const results = (data.web ?? []).map((item) => ({
      url: "url" in item && item.url ? item.url : "",
      title: "title" in item && item.title ? item.title : "Untitled",
    }));
    return { results, error: null };
  } catch (err) {
    return { results: [], error: toErrorResponse(err).message };
  }
}
tsx
// app/page.tsx
"use client";

import { useActionState } from "react";
import { searchAction, type SearchState } from "./actions";

const initial: SearchState = { results: [], error: null };

export default function Page() {
  const [state, formAction, pending] = useActionState(searchAction, initial);
  return (
    <form action={formAction}>
      <input name="query" placeholder="Search the web" />
      <button disabled={pending}>{pending ? "Searching..." : "Search"}</button>
      {state.error && <p>{state.error}</p>}
      <ul>
        {state.results.map((r) => (
          <li key={r.url}>
            <a href={r.url}>{r.title}</a>
          </li>
        ))}
      </ul>
    </form>
  );
}

Search costs 2 credits per 10 results, rounded up, plus 1 credit for every result you also ask it to scrape. Five results without scraping cost 2 credits.

Next.js's own security guide says a Server Action can be called with a direct POST request, not just from your form. Treat it like a public endpoint. Before this goes live, put it behind your login, or a stranger can spend your credits for you.

Step 6: Cache results so you don't pay twice

There are two caches here, and they save different things.

Diagram comparing a Firecrawl cache lane, where a request goes to a cloud database marked Faster but still costs a coin, with an App cache lane, where the request loops back from local storage marked Saves credits over a crossed-out coin
Firecrawl's cache saves time. Your own cache saves credits.

Firecrawl's maxAge option reuses a copy Firecrawl already holds. The default is two days. It makes the response faster, but billing docs say a cached result still costs 1 credit.

To stop paying for repeat requests, cache in your own app.

In Next.js 16, the docs say unstable_cache has been replaced by the use cache directive. On serverless hosts the default in-memory cache usually doesn't survive between requests, so this uses the remote variant. Next.js lists rate-limited APIs as one of the cases it's meant for.

Turn on Cache Components first:

ts
// next.config.ts
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  cacheComponents: true,
  partialPrefetching: true,
};

export default nextConfig;

Without partialPrefetching, next build 16.4.0 prints a warning asking you to set it. With it, the build is clean.

Then move the scrape into a cached function:

ts
// lib/scrape.ts
import "server-only";
import { cacheLife, cacheTag } from "next/cache";
import { getFirecrawl } from "./firecrawl";
import { toErrorResponse, withRetry } from "./firecrawl-errors";

export type PageResult =
  | { ok: true; markdown: string; title: string | null; statusCode: number | null }
  | { ok: false; status: number; message: string };

export async function getPageMarkdown(url: string): Promise<PageResult> {
  "use cache: remote";
  cacheTag(`scrape:${url}`);

  try {
    const doc = await withRetry(() =>
      getFirecrawl().scrape(url, {
        formats: ["markdown"],
        onlyMainContent: true,
        maxAge: 60 * 60 * 1000,
        timeout: 30_000,
        autoResume: false,
      })
    );
    cacheLife("hours");
    return {
      ok: true,
      markdown: doc.markdown ?? "",
      title: doc.metadata?.title ?? null,
      statusCode: doc.metadata?.statusCode ?? null,
    };
  } catch (err) {
    cacheLife("seconds");
    return { ok: false, ...toErrorResponse(err) };
  }
}
ts
// app/api/scrape/route.ts (final version)
import { NextResponse } from "next/server";
import { z } from "zod";
import { getPageMarkdown } from "@/lib/scrape";

export const maxDuration = 60;

const Body = z.object({ url: z.url() });

export async function POST(request: Request) {
  const parsed = Body.safeParse(await request.json().catch(() => null));
  if (!parsed.success) {
    return NextResponse.json({ error: "Send JSON like { \"url\": \"https://...\" }" }, { status: 400 });
  }

  const page = await getPageMarkdown(parsed.data.url);
  if (!page.ok) {
    return NextResponse.json({ error: page.message }, { status: page.status });
  }
  if (page.statusCode && page.statusCode >= 400) {
    return NextResponse.json({ error: `Target page returned ${page.statusCode}` }, { status: 422 });
  }
  return NextResponse.json(page);
}

Why return an error object instead of throwing? Because a version that throws breaks. In a local production build, the error lost its class and its status on the way out of the cached function, and every Firecrawl failure turned into a generic 500.

Returning a result fixes that. The conditional cacheLife call keeps failures for seconds and successes for hours. The Next.js docs allow one cacheLife call per run, in whichever branch runs.

In a local run, the second identical request never reached the Firecrawl mock. On Vercel, the Next.js docs say hosting providers "should typically" supply the remote cache handler. That hasn't been confirmed on a live Vercel deployment, so check your cache hits after you deploy.

Step 7: Start long crawls asynchronously and poll for status

A crawl follows links from a starting URL and scrapes every page it finds. That can take minutes, which is too long for one request. So the route starts the job with startCrawl and returns the job ID straight away:

ts
// app/api/crawl/route.ts
import { NextResponse } from "next/server";
import { z } from "zod";
import { getFirecrawl } from "@/lib/firecrawl";
import { toErrorResponse } from "@/lib/firecrawl-errors";

const Body = z.object({ url: z.url(), limit: z.number().int().min(1).max(100).default(25) });

export async function POST(request: Request) {
  const parsed = Body.safeParse(await request.json().catch(() => null));
  if (!parsed.success) {
    return NextResponse.json({ error: "A valid url is required" }, { status: 400 });
  }

  try {
    const job = await getFirecrawl().startCrawl(parsed.data.url, {
      limit: parsed.data.limit,
      scrapeOptions: { formats: ["markdown"], onlyMainContent: true },
      webhook: {
        url: `${process.env.APP_URL}/api/firecrawl-webhook`,
        events: ["page", "completed", "failed"],
        metadata: { requestedBy: "crawl-route" },
      },
    });
    return NextResponse.json({ id: job.id }, { status: 202 });
  } catch (err) {
    const { status, message } = toErrorResponse(err);
    return NextResponse.json({ error: message }, { status });
  }
}

The limit line is the most important one in this file. Firecrawl's default crawl limit is 10,000 pages.

Firecrawl's crawl docs say it checks whether your credits cover that limit before the crawl starts, and answers 402 if they don't. On a Free plan with 1,000 credits, a crawl with no limit can fail before it fetches a single page.

Two more scope rules from the crawl docs. By default it only follows child paths of your starting URL. And if you set includePaths, the starting URL has to match them too, or you may get zero pages back.

For polling, a second route reads the job status:

ts
// app/api/crawl/[id]/route.ts
import { NextResponse } from "next/server";
import { getFirecrawl } from "@/lib/firecrawl";
import { toErrorResponse } from "@/lib/firecrawl-errors";

export async function GET(_request: Request, { params }: { params: Promise<{ id: string }> }) {
  const { id } = await params;

  try {
    const job = await getFirecrawl().getCrawlStatus(id, { autoPaginate: false });
    return NextResponse.json({
      status: job.status,
      completed: job.completed,
      total: job.total,
      creditsUsed: job.creditsUsed ?? null,
      pages: job.data.map((doc) => ({
        url: doc.metadata?.sourceURL ?? null,
        title: doc.metadata?.title ?? null,
      })),
    });
  } catch (err) {
    const { status, message } = toErrorResponse(err);
    return NextResponse.json({ error: message }, { status });
  }
}

The status is one of scraping, completed, failed or cancelled, with total, completed and creditsUsed alongside. Polling doesn't cost credits.

The SDK follows every next page of results by default. Setting autoPaginate to false keeps each poll to one page, and the route returns URLs and titles instead of full markdown. Vercel caps a function response at 4.5 MB, and a big crawl's markdown blows past that.

Crawl results stay on Firecrawl for 24 hours. Store what you need before then.

Step 8: Receive crawl results with a signed webhook

Diagram of a Start crawl card that gets back a Job ID, a cloud sending a stream of page cards, a dashed amber arrow between the Job ID and a Webhook card, and a curved Poll status arrow
Start the crawl, return at once, and let the webhook or the polling route collect the pages.

Polling works, but a webhook is better for long crawls. Firecrawl calls your endpoint as each page finishes. The webhook object in Step 7 already asks for page, completed and failed events. The payloads come back typed as crawl.page, crawl.completed and crawl.failed.

New to webhooks? My webhook explainer shows the request flow in plain English.

Anyone can POST to a public URL, so check the signature first. Firecrawl signs every webhook with HMAC-SHA256 of the raw body, using a secret from the Advanced tab of your account settings. The result arrives in the X-Firecrawl-Signature header as sha256= followed by the hex digest.

ts
// app/api/firecrawl-webhook/route.ts
import { createHmac, timingSafeEqual } from "node:crypto";
import { after, NextResponse } from "next/server";

type FirecrawlWebhook = {
  success: boolean;
  type: string;
  id: string;
  data: Array<{ markdown?: string; metadata?: { sourceURL?: string; scrapeId?: string } }>;
  metadata?: Record<string, string>;
  error?: string;
};

function isValidSignature(rawBody: string, header: string | null, secret: string): boolean {
  if (!header?.startsWith("sha256=")) return false;
  const received = Buffer.from(header.slice("sha256=".length), "hex");
  const expected = createHmac("sha256", secret).update(rawBody).digest();
  return received.length === expected.length && timingSafeEqual(received, expected);
}

export async function POST(request: Request) {
  const secret = process.env.FIRECRAWL_WEBHOOK_SECRET;
  const rawBody = await request.text();

  if (!secret || !isValidSignature(rawBody, request.headers.get("x-firecrawl-signature"), secret)) {
    return NextResponse.json({ error: "Invalid signature" }, { status: 401 });
  }

  const event = JSON.parse(rawBody) as FirecrawlWebhook;

  after(async () => {
    if (event.type === "crawl.page") {
      for (const page of event.data) {
        console.log("page", event.id, page.metadata?.sourceURL);
      }
    } else if (event.type === "crawl.completed") {
      console.log("crawl finished", event.id);
    } else if (event.type === "crawl.failed") {
      console.error("crawl failed", event.id, event.error);
    }
  });

  return NextResponse.json({ received: true });
}

Three details in that file are easy to get wrong:

  • Read the body with request.text(), not request.json(). The signature covers the exact bytes Firecrawl sent, and re-serialised JSON won't match.
  • Check the lengths before timingSafeEqual. Node throws if the two buffers differ in length, and a junk header would otherwise crash the route.
  • Answer fast. Firecrawl wants a 2xx within 10 seconds. The after() function from next/server runs your processing once the response has gone out.

Firecrawl retries a failed delivery after 1, 5 and 15 minutes. That means the same page can arrive twice, so store pages by scrapeId or URL and ignore repeats.

In a local run with a payload signed by openssl, a correct signature got a 200. A wrong or missing one got a 401.

Step 9: Deploy to Vercel without hitting timeouts

Push the project to Git, import it in Vercel, then add FIRECRAWL_API_KEY, FIRECRAWL_WEBHOOK_SECRET and APP_URL under the project's environment variables. APP_URL is your production URL, because Firecrawl needs a public HTTPS address for webhooks. A localhost webhook URL won't work.

Then the timeouts. Firecrawl's own Vercel quickstart still says functions stop at 10 seconds on Hobby and 60 on Pro. Vercel's current limits page says otherwise:

Vercel planDefault durationMaximum duration
Hobby300 seconds300 seconds
Pro300 seconds800 seconds (1,800 in beta)
Enterprise300 seconds800 seconds (1,800 in beta)

Source: Vercel Functions limits, Node.js runtime with fluid compute, as of 7 October 2026. If a function runs past its limit, Vercel returns a 504.

Even 300 seconds isn't enough for a big crawl, which is why Step 7 never waits for one. Starting a crawl takes one quick request, and the webhook or the polling route picks up the rest.

The single-page routes set maxDuration to 60 on purpose. A scrape that hangs for five minutes is worse than one that fails in one.

That's also why both scrapes set autoResume to false. By default, when a huge document times out on Firecrawl's side, the SDK sleeps and retries for up to 20 minutes. That's helpful in a script and a trap inside a 60-second function.

What usually goes wrong?

What you seeLikely causeFix
401 from FirecrawlKey missing in Vercel, or set only for PreviewAdd FIRECRAWL_API_KEY for the Production environment and redeploy
402 on a small crawlNo limit set, so the 10,000-page default exceeds your creditsAlways pass limit
429 under light trafficFree plan allows 2 crawl requests a minuteBack off, queue the requests or upgrade
JSON result is empty or ignores your fieldszod 4 schema passed straight to the SDKPass z.toJSONSchema(schema) instead
Crawl finishes with 0 pagesStarting URL doesn't match includePathsStart inside the matched path, or drop includePaths
504 FUNCTION_INVOCATION_TIMEOUTWaiting for a crawl inside a requestUse startCrawl plus webhook or polling
413 from VercelReturning full crawl markdown in one responseReturn URLs and fetch pages one at a time
Webhook always 401Parsing JSON before verifying, or the wrong secretVerify request.text() with the secret from Settings, Advanced
Every error becomes a 500Throwing from inside a use cache functionReturn a result object, as in Step 6

How many credits will this app use?

Here's the arithmetic, using Firecrawl's prices on 7 October 2026. The full plan breakdown is in my Firecrawl pricing guide.

ActionCreditsRuns on the Free plan's 1,000 credits
Scrape one page to markdown11,000 pages
Extract JSON from one page5200 pages
Search, 5 results, no scraping2500 searches
Crawl with a 25-page limitUp to 2540 crawls
Receive a webhook or poll status0Unlimited

Paid plans start with Hobby at $19 a month for 5,000 credits, or $16 a month billed yearly. The app-level cache in Step 6 is what keeps these numbers honest. Without it, every page view would cost credits again.

If you're still deciding whether Firecrawl is the right scraper, I compared it with Apify in Firecrawl vs Apify.

Frequently asked questions

Can I call the Firecrawl API from a Client Component in Next.js?▾
No. The call needs your API key, and anything in a Client Component ships to the browser. Call Firecrawl from a Route Handler, Server Action or Server Component, and keep the key in a variable without the NEXT_PUBLIC_ prefix.
Should I use firecrawl or @mendable/firecrawl-js?▾
Either works. On 7 October 2026 both npm packages were version 4.44.0 and shipped identical code. Firecrawl's docs now use firecrawl, so new projects should probably use that name.
Does Firecrawl's cache save credits?▾
No. Firecrawl's billing docs say a cached result still costs 1 credit. The maxAge cache makes responses faster. To avoid paying twice, cache results in your own app, as in Step 6.
How do I run a Firecrawl crawl that takes longer than the Vercel timeout?▾
Don't wait for it inside the request. Start it with startCrawl, return the job ID, and collect pages through a webhook or a polling route. Vercel's Hobby plan stops functions at 300 seconds, so waiting for a large crawl fails.
Why does my zod schema return empty JSON from Firecrawl?▾
You're probably on zod 4. The Firecrawl JS SDK converts zod schemas with a zod 3 converter, and in a local test against a mock, a zod 4 schema was sent as an empty schema. Pass z.toJSONSchema(yourSchema) instead and validate the result with safeParse.
Can I test Firecrawl in Next.js without an API key?▾
Partly. Firecrawl's docs say scrape, search and interact work without a key at a low per-IP rate limit. Crawl, map, batch scrape and monitoring need a key.

You now have scrape, extract, search, crawl and webhooks wired into Next.js with the key kept server-side. If you want more patterns, such as batch scraping, map, screenshots, change tracking and monitors, they're in my roundup of Firecrawl API examples.

Start on the Free plan. 1,000 credits is plenty to build and test everything in this tutorial.

Share