API Reference
Complete reference for the AgentShield REST API.
Intercept Endpoint
Scan AI output for safety violations before returning it to users.
POST https://agentshield-one.vercel.app/api/interceptHeaders
Required headers for authentication and content type:
{
"Content-Type": "application/json",
"x-api-key": "your_api_key_here"
}Request Body
JSON payload with the user input and AI output:
{
"input": "User's original message",
"output": "AI agent's response"
}Response Format
The API returns a JSON object with the following fields:
Success Response (Clean)
{
"blocked": false,
"safe": true,
"reason": null,
"output": "The original AI response"
}Blocked Response
{
"blocked": true,
"safe": false,
"reason": "Credential leak detected — password disclosure",
"violationType": "credential-leak"
}Error Response
{
"error": "Invalid API key"
}Response Fields
blocked: Boolean indicating if the response was blockedsafe: Boolean indicating if it is safe to proceedreason: String explaining why it was blocked (null if clean)output: The original AI response (when clean)violationType: Category such ascredential-leak,pii, orkeyword
Rate limits
Default 120 requests/minute per API key. Response headers: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset. HTTP 429 when exceeded.
Health
GET /api/health — no authentication required.