Skip to content

Correct the crawl pre-flight credit note in billing.mdx - #1378

Merged
hmishra2250 merged 2 commits into
mainfrom
fix/billing-crawl-credit-note
Sep 8, 2026
Merged

Correct the crawl pre-flight credit note in billing.mdx#1378
hmishra2250 merged 2 commits into
mainfrom
fix/billing-crawl-credit-note

Conversation

@hmishra2250

Copy link
Copy Markdown
Contributor

Summary

Rewrites the crawl pre-flight credit <Note> in billing.mdx so it matches what the API does. The note described a hard 402 and a 10,000 credit prerequisite. The API clamps the limit instead.

Why

DI-2026-09-05-WEEKLY, path IP-D2. The note on origin/main reads:

Before a crawl job starts, Firecrawl verifies that your remaining credit balance can cover the full limit parameter you've requested. If your balance is lower than limit, the request returns a 402 even if the crawl would have discovered fewer pages. The default limit is 10,000, so omitting it requires 10,000 credits available up front.

Both claims are wrong against firecrawl origin/main.

apps/api/src/routes/shared.ts:166-202 computes clampedLimit = Math.min(requestedLimit, remainingCredits), re-checks that clamped value against Autumn, and on success sets (req.body as any).limit = clampedLimit and calls next(). The log line is "Adjusting limit to remaining credits". The 402 at shared.ts:222 is reached only when the clamp does not produce a positive limit, or when the re-check of the clamped value is itself denied, which is the per-API-key spend limit case called out in the comment at shared.ts:187-190.

apps/api/src/controllers/v2/crawl.ts:168-174 names that middleware the source of truth: "checkCreditsMiddleware (always runs before this controller) is the source of truth: Infinity when Autumn allows the request, the real remaining when it clamps a low-credit crawl." The controller then clamps again at crawl.ts:269, finalCrawlerOptions.limit = Math.min(remainingCredits, finalCrawlerOptions.limit), which is what handles the omitted-limit case: the prefault(10000) default in apps/api/src/controllers/v2/types.ts:1274 is lowered to fit the balance rather than required up front.

Changes

  • billing.mdx: one <Note> rewritten. It now says the effective limit is lowered to fit the balance, states the two conditions that do return a 402, and says the omitted-limit default is lowered the same way. The 10,000 default is kept because it is in the code. No other number is introduced.

Verification

  • mintlify broken-links and mintlify validate on Node 22.23.2, run on this branch and on a detached worktree at the base commit 73103de7. Identical on both: 208 broken-link entries across 95 files, and validate failing with 17 warnings. This change adds no new link or validation finding.
  • git diff --name-only origin/main...HEAD returns billing.mdx only.

Notes for review

PR #1370 also edits billing.mdx, at lines 38-63. This change is at lines 54-56 of the base file, outside #1370's hunks, so the two do not overlap. Whichever merges second may need a trivial context rebase.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SL5chNkWnr4Gy6uuB8PeKS

The note said that a crawl whose `limit` exceeds the remaining credit
balance returns a 402, and that omitting `limit` therefore requires
10,000 credits up front. Neither is what the API does.

`apps/api/src/routes/shared.ts:166-202` clamps the requested limit to the
remaining balance and re-checks the clamped value, then lets the request
through with the lowered limit. `apps/api/src/controllers/v2/crawl.ts:168-174`
names that middleware the source of truth and clamps the normalized limit
again at line 269, so the 10,000 default is lowered to fit the balance
instead of being required in advance. A 402 is returned only when the
clamped limit is not positive or when a per-API-key spend limit denies the
lowered request as well.

Rewrites the note to describe the clamp, keeps the code-verified 10,000
default, and adds no numbers that are not in the code.

Finding: DI-2026-09-05-WEEKLY IP-D2, reconciled plan item 8.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SL5chNkWnr4Gy6uuB8PeKS
@mintlify

mintlify Bot commented Sep 7, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
firecrawl 🟢 Ready View Preview Sep 7, 2026, 8:31 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@hmishra2250
hmishra2250 merged commit ebeb2bc into main Sep 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant