Skip to content

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

fix(api/batch/scrape): require at least 1 URL

Gergő Móricz31a4c7467468
diff --git a/apps/api/src/controllers/v1/types.ts b/apps/api/src/controllers/v1/types.ts
index 1f7d8a4da..4455e3b64 100644
--- a/apps/api/src/controllers/v1/types.ts
+++ b/apps/api/src/controllers/v1/types.ts
@@ -773,7 +773,7 @@ export type ScrapeRequestInput = z.input<typeof scrapeRequestSchema>;
export const batchScrapeRequestSchema = baseScrapeOptions
.extend({
- urls: url.array(),
+ urls: url.array().min(1),
origin: z.string().optional().default("api"),
integration: integrationSchema.optional().transform(val => val || null),
webhook: webhookSchema.optional(),
@@ -790,7 +790,7 @@ export const batchScrapeRequestSchema = baseScrapeOptions
export const batchScrapeRequestSchemaNoURLValidation = baseScrapeOptions
.extend({
- urls: z.string().array(),
+ urls: z.string().array().min(1),
origin: z.string().optional().default("api"),
integration: integrationSchema.optional().transform(val => val || null),
webhook: webhookSchema.optional(),
diff --git a/apps/api/src/controllers/v2/types.ts b/apps/api/src/controllers/v2/types.ts
index 184b5cd18..c9adb71ed 100644
--- a/apps/api/src/controllers/v2/types.ts
+++ b/apps/api/src/controllers/v2/types.ts
@@ -700,7 +700,7 @@ export type ScrapeRequestInput = z.input<typeof scrapeRequestSchema>;
export const batchScrapeRequestSchema = baseScrapeOptions
.extend({
- urls: URL.array(),
+ urls: URL.array().min(1),
origin: z.string().optional().default("api"),
integration: integrationSchema.optional().transform(val => val || null),
webhook: webhookSchema.optional(),
@@ -715,7 +715,7 @@ export const batchScrapeRequestSchema = baseScrapeOptions
export const batchScrapeRequestSchemaNoURLValidation = baseScrapeOptions
.extend({
- urls: z.string().array(),
+ urls: z.string().array().min(1),
origin: z.string().optional().default("api"),
integration: integrationSchema.optional().transform(val => val || null),
webhook: webhookSchema.optional(),