Endpoint
Authentication
Authenticate using theX-Api-Key header with a JWT token provided in the Scrunch AI dashboard when creating a site with the “API” platform.
To generate the X-Api-Key, add a new website on the Agent Traffic page and select API as your platform.
Path parameters
The
platform_id is always custom for this endpoint.
Request headers
Request body
The body can be either a single JSON object or NDJSON (newline-delimited JSON, one object per line).Fields
Example: single event (JSON)
Example: batch events (NDJSON)
Send multiple events in a single request using newline-delimited JSON. Each line is a complete JSON object.Responses
Success response (200)
Notes
- Batch size: For NDJSON batches, keep each request under ~1 MB uncompressed.
- Timestamp: Must be a Unix epoch in seconds. Both integers and floats are accepted. Invalid timestamps will fall back to the current server time.
- Bot detection: The
user_agentfield is used to automatically identify and classify the bot/AI agent. Pass the original User-Agent string from the incoming request. - Activation: After creating a site with the “API” platform in the dashboard, it starts in “pending” status. Once the first valid request is received, the site automatically transitions to “active” within 5 minutes.
Best practices
- Use NDJSON for batch uploads to reduce request overhead
- Keep batch sizes under 1 MB for optimal performance
- Always pass the original User-Agent string for accurate bot classification
- Monitor response status codes and implement retry logic for 429 and 500 errors
- Use the
response_timefield to track performance metrics alongside bot traffic