AgentShieldAgentShield/Documentation
Get API Key

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/intercept

Headers

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 blocked
  • safe: Boolean indicating if it is safe to proceed
  • reason: String explaining why it was blocked (null if clean)
  • output: The original AI response (when clean)
  • violationType: Category such as credential-leak, pii, or keyword

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.