Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix(api): carry the caller's external request id on v2 batch scrape charges (#4872)

Gergő Móricza1667ae426f7
diff --git a/apps/api/src/controllers/v2/batch-scrape.ts b/apps/api/src/controllers/v2/batch-scrape.ts
index a0ec17177..3ab5ba6c2 100644
--- a/apps/api/src/controllers/v2/batch-scrape.ts
+++ b/apps/api/src/controllers/v2/batch-scrape.ts
@@ -140,9 +140,12 @@ export async function batchScrapeController(
}
const id = req.body.appendToId ?? uuidv7();
- const billing: BillingMetadata = req.body.__agentInterop
- ? { endpoint: "agent" as const, jobId: id }
- : { endpoint: "batch_scrape" as const, jobId: id };
+ const billing: BillingMetadata = {
+ ...(req.body.__agentInterop
+ ? { endpoint: "agent" as const, jobId: id }
+ : { endpoint: "batch_scrape" as const, jobId: id }),
+ externalRequestId: externalRequestId(req),
+ };
const logger = _logger.child({
crawlId: id,
batchScrapeId: id,