Detection APIs transform manual analysis into automated pipelines. This module covers connecting to detection services, handling responses, and building production-grade integration workflows.
Detection API Landscape
Major detection services expose REST APIs that accept text input and return structured analysis results. Understanding their common patterns — authentication, rate limiting, response formats — lets you switch between providers or run them in parallel.
REST APIs
Most detection services use standard REST with JSON payloads. Send text via POST, receive scores and metadata in the response body. API keys authenticate each request.
Webhook Callbacks
For large batches, use async processing with webhooks. Submit content, receive a job ID, and get results pushed to your endpoint when analysis completes.
Building a Detection Pipeline
A production pipeline needs more than API calls. You need input validation, rate limit handling, retry logic, result caching, and error reporting. Here is a reference architecture:
Handling Rate Limits
Every detection API enforces rate limits. Exceeding them results in 429 responses and potentially suspended access. Implement token bucket or leaky bucket rate limiting on your side to stay within provider quotas.
| Provider Pattern | Typical Limit | Strategy |
|---|---|---|
| Per-second cap | 10-50 req/sec | Token bucket with queue |
| Daily quota | 1,000-50,000 req/day | Counter with graceful degradation |
| Concurrent limit | 5-20 parallel | Semaphore-based concurrency control |
Security Note
Never embed API keys directly in client-side code. Use environment variables and server-side proxies. Rotate keys periodically and monitor for unauthorized usage.
The API integration patterns here build on the batch processing concepts from Common Detection Errors — particularly around handling edge cases and interpreting scores correctly. For a comparison of available tools to integrate, see our AI Detection Tools Compared guide.