Process multiple URLs in parallel with optimized resource management. ## Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `Authorization` | string | Yes | Bearer token authentication | | `Content-Type` | string | Yes | Must be `application/json` | ## Request Body | Field | Type | Required | Description | | --- | --- | --- | --- | | `urls` | array | Yes | List of URLs to scrape (max 50) | | `schema` | object | Yes | JSON schema for data extraction | | `options` | object | No | Batch processing options | ### Batch Options | Field | Type | Default | Description | | --- | --- | --- | --- | | `max_items_per_url` | integer | 50 | Max items per URL (1-500) | | `max_total_items` | integer | 500 | Max total items across all URLs (1-5000) | | `parallel_jobs` | integer | 3 | Number of parallel jobs (1-10) | | `timeout_per_url` | integer | 30 | Timeout per URL in seconds (1-300) | | `date_filter` | object | null | Filter items by date | | `llm_mode` | string | "structured" | LLM processing mode | ## Response **Status**: `200 OK` | Field | Type | Description | | --- | --- | --- | | `batch_id` | string | Unique batch identifier | | `total_urls` | integer | Total number of URLs | | `jobs` | array | Array of job objects | | `progress` | object | Progress information | | `created_at` | string | Batch creation timestamp | ### Job Object | Field | Type | Description | | --- | --- | --- | | `job_id` | string | Unique job identifier | | `url` | string | Target URL | | `status` | string | Job status: "pending", "processing", "completed", "failed" | ### Progress Object | Field | Type | Description | | --- | --- | --- | | `completed` | integer | Number of completed jobs | | `failed` | integer | Number of failed jobs | | `pending` | integer | Number of pending jobs | | `total_items_extracted` | integer | Total items extracted so far | Basic Batch Request ```bash curl -X POST https://api.aitronos.com/api/v1/scrape/batch \ -H "X-API-Key: $FREDDY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "urls": [ "https://example.com/page1", "https://example.com/page2", "https://example.com/page3" ], "schema": { "type": "object", "properties": { "title": {"type": "string"}, "content": {"type": "string"} } }, "options": { "max_items_per_url": 50, "parallel_jobs": 3 } }' ``` ```python import os import requests api_key = os.environ["FREDDY_API_KEY"] response = requests.post( "https://api.aitronos.com/api/v1/scrape/batch", headers={"X-API-Key": api_key}, json={ "urls": [ "https://example.com/page1", "https://example.com/page2", "https://example.com/page3" ], "schema": { "type": "object", "properties": { "title": {"type": "string"}, "content": {"type": "string"} } }, "options": { "max_items_per_url": 50, "parallel_jobs": 3 } } ) data = response.json() print(f"Batch ID: {data['batch_id']}") print(f"Total URLs: {data['total_urls']}") ``` ```javascript const axios = require('axios'); const apiKey = process.env.FREDDY_API_KEY; axios.post('https://api.aitronos.com/api/v1/scrape/batch', { urls: [ 'https://example.com/page1', 'https://example.com/page2', 'https://example.com/page3' ], schema: { type: 'object', properties: { title: { type: 'string' }, content: { type: 'string' } } }, options: { max_items_per_url: 50, parallel_jobs: 3 } }, { headers: { 'X-API-Key': apiKey } }) .then(response => { const data = response.data; console.log(`Batch ID: ${data.batch_id}`); console.log(`Total URLs: ${data.total_urls}`); }); ``` **Response** `200 OK` ```json { "batch_id": "batch_xyz789", "total_urls": 3, "jobs": [ { "job_id": "job_abc123", "url": "https://example.com/page1", "status": "pending" }, { "job_id": "job_def456", "url": "https://example.com/page2", "status": "pending" }, { "job_id": "job_ghi789", "url": "https://example.com/page3", "status": "pending" } ], "progress": { "completed": 0, "failed": 0, "pending": 3, "total_items_extracted": 0 }, "created_at": "2024-12-16T10:30:00Z" } ```