Authentication
How to authenticate API calls. Ed25519 signature headers for the gateway, bearer sessions for the control plane.
Agent signatures
Gateway runtime routes authenticate each request with four headers:
| Header | Format |
|---|---|
X-AgentShield-Agent-Id | Agent UUID |
X-AgentShield-Timestamp | Unix seconds, within 60 s of the gateway clock |
X-AgentShield-Nonce | ^[A-Za-z0-9_-]{16,128}$, never reused within 130 s |
X-AgentShield-Signature | Unpadded base64url Ed25519 signature of timestamp.nonce.hex(sha256(body)) |
import secrets, time, urllib.request
from agentshield_sdk import sign
from agentshield_sdk.jsonenc import encode_json
body = encode_json({"decision_id": DECISION_ID, "idempotency_key": IDEMPOTENCY_KEY}) # serialize once
timestamp, nonce = int(time.time()), secrets.token_urlsafe(16)
request = urllib.request.Request(
"http://127.0.0.1:8081/api/v1/runtime/execute",
data=body, method="POST",
headers={
"Content-Type": "application/json",
"X-AgentShield-Agent-Id": AGENT_ID,
"X-AgentShield-Timestamp": str(timestamp),
"X-AgentShield-Nonce": nonce,
"X-AgentShield-Signature": sign(seed, timestamp, nonce, body),
},
)In practice, use Client from the SDK, which does this for both authorize and execute. Full specification: Request signing.
| Failure | Response |
|---|---|
Authorization header present | 401 unauthenticated "human sessions are not accepted by the gateway" |
| Missing signature headers | 401 unauthenticated "agent signature headers are required" |
| Unknown agent, bad signature, bad nonce shape, timestamp outside 60 s | 401 unauthenticated "authentication failed" |
| Nonce reused | 401 unauthenticated "nonce already used" |
Bearer sessions
Control plane routes accept Authorization: Bearer <token>, where the token is 20–200 characters of base64url alphabet. Create one with email and password:
/api/v1/sessionsCreate a human session
Checks the email and password of a bootstrapped user. There is no public registration route. The token is returned once and only its SHA-256 is stored. Agent signature headers are rejected.
Request body · required
emailstring (email)requiredpasswordstringrequiredmin length 12 · max length 128
Responses
201SessionSession token
401ErrorBodyError
403ErrorBodyError
curl -X POST "http://127.0.0.1:8080/api/v1/sessions" \
-H "Content-Type: application/json" \
--data-binary @body.jsonExamples are generated from the schema. Values are placeholders.
| Property | Value |
|---|---|
| Lifetime | 12 hours |
| Server storage | SHA-256 of the token only |
| Revocation | DELETE /api/v1/sessions/current; password change revokes other sessions; disabling a member revokes all |
| Temporary password sessions | Only GET/DELETE /api/v1/sessions/current and POST /api/v1/sessions/current/password; everything else is 403 password_change_required |
Inspect and end a session
/api/v1/sessions/currentThe caller's user, organization, role, and session expiry
Responses
200CurrentSessionCurrent session
401ErrorBodyError
curl -X GET "http://127.0.0.1:8080/api/v1/sessions/current" \
-H "Authorization: Bearer $AGENTSHIELD_TOKEN"Examples are generated from the schema. Values are placeholders.
/api/v1/sessions/currentEnd the session that made this request
Responses
204no bodySession ended. The token is refused from now on.
curl -X DELETE "http://127.0.0.1:8080/api/v1/sessions/current" \
-H "Authorization: Bearer $AGENTSHIELD_TOKEN"Examples are generated from the schema. Values are placeholders.
/api/v1/sessions/current/passwordChange the caller's password and end their other sessions
Request body · required
current_passwordstringrequirednew_passwordstringrequiredmin length 12 · max length 128
Responses
204no bodyPassword changed. The calling session stays valid.
403ErrorBodyThe current password is wrong
curl -X POST "http://127.0.0.1:8080/api/v1/sessions/current/password" \
-H "Authorization: Bearer $AGENTSHIELD_TOKEN" \
-H "Content-Type: application/json" \
--data-binary @body.jsonExamples are generated from the schema. Values are placeholders.
Cross-plane refusal
| Sent to | With | Result |
|---|---|---|
| Gateway runtime route | Authorization header | 401 |
Control plane /api/ route | X-AgentShield-Signature or X-AgentShield-Agent-Id | 401 "agent signatures are not accepted on the control plane" |
Roles
After authentication, each control plane route checks the member's role. A role that is not allowed receives 403 forbidden ("insufficient role"). The role matrix is in Authentication.
Was this page helpful?
Control Plane API
Complete reference for the AgentShield control plane. Sessions, members, agents, policies, approvals, audit, alerts, evidence, metrics, and chaos.
Agent Management
Register agents, list and read them, rotate credentials, and suspend, resume, or revoke agents through the control plane.