Authentication
How to authenticate your requests to the AgentShield API.
API Key
All requests to the AgentShield API require an API key. You can create API keys from the dashboard.
Create an API Key
Navigate to the API Keys page in your dashboard to create a new key. Each key is unique to your workspace.
Using the API Key
Include your API key in the x-api-key header:
curl -X POST https://agentshield-one.vercel.app/api/intercept \
-H "Content-Type: application/json" \
-H "x-api-key: as_live_xxxxxxxxxxxxx" \
-d '{
"input": "Hello",
"output": "Hi there!"
}'Environment Variables
Store your API key in an environment variable for security:
# .env file
AGENTSHIELD_API_KEY=as_live_xxxxxxxxxxxxxAccessing in Code
Examples of accessing the environment variable in different languages:
JavaScript/Node.js
// JavaScript/Node.js
const apiKey = process.env.AGENTSHIELD_API_KEYPython
# Python
import os
apiKey = os.environ["AGENTSHIELD_API_KEY"]Go
// Go
apiKey := os.Getenv("AGENTSHIELD_API_KEY")Security Best Practices
- • Never commit API keys to version control
- • Use different keys for development and production
- • Rotate keys regularly
- • Revoke keys that are no longer needed