Skip to main content
Workflow · Glossary

Batch processing

Submitting many detection requests in one API call for efficiency.

Batch processing is submitting many detection requests in a single API call rather than one at a time. It's available on the Pro and Enterprise plans of AI Detector API and is much more efficient when you're scanning a back catalog of content, processing a large dataset, or running scheduled audits.

The batch endpoint accepts up to 100 documents per call and returns results as an array. For very large workloads, combine batching with webhooks (see webhooks) so you don't have to keep a connection open while the work runs.

Two batch modes. The endpoint supports synchronous and asynchronous mode. Synchronous mode is best for small batches (under 20 documents): you wait for the response and get all results inline. Asynchronous mode is best for large batches: pass a webhook_url and the API returns 202 immediately with a job ID, then POSTs the results to your URL when done.

Synchronous example:

from aidetectorapi import AIDetector

client = AIDetector("YOUR_API_KEY")
texts = ["First document.", "Second.", "Third.", ...]  # up to 100
results = client.detect_batch(texts)

for original, result in zip(texts, results):
    print(f"{result.score:.0%} → {original[:40]}...")

Asynchronous example with webhook:

import requests
job = requests.post(
    "https://api.aidetectorapi.com/v1/batch/",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "texts": texts,
        "webhook_url": "https://example.com/webhooks/detection",
    },
).json()
# job["id"] is the batch identifier; results will POST to your webhook

Pricing. Each document in a batch counts as one request against your monthly quota. A batch of 100 documents costs 100 requests, not 1. The advantage is throughput and one round trip instead of 100, not pricing.

Common pattern: nightly audit. Schedule a cron job that pulls the last 24 hours of content, batches 100 at a time, posts the results to a webhook that writes to your warehouse, and surfaces anything above your threshold in a Slack channel the next morning.

Related terms

Move from definition to code

Free 1,000 requests/month, no credit card. Be detecting AI text in 5 minutes.