Endpoint
How It Works
The agent proves their identity by signing a message containing their agent ID and current timestamp:Request Body
The agent’s ID (format:
ag_*)Current timestamp in ISO 8601 format (e.g.,
"2024-01-01T00:00:00.000Z")Base64-encoded Ed25519 signature of the message
agentdoor:auth:{agent_id}:{timestamp}Response (200 OK)
Fresh JWT token
ISO 8601 timestamp when this token expires (typically 1 hour from now)
Example Request
Example Response
Error Responses
400 - invalid_request
Missing or invalid required fields (agent_id, timestamp, signature)
400 - timestamp_invalid
Timestamp is too far from server time. Maximum allowed clock skew is 5 minutes.
401 - invalid_signature
Signature verification failed. Ensure you signed the message
agentdoor:auth:{agent_id}:{timestamp} with the correct private key.403 - agent_inactive
Agent account is suspended or banned. Contact service owner for assistance.
404 - agent_not_found
No registered agent found with this agent_id
Message Format
The signed message must follow this exact format:Authentication Flow
Timestamp Validation
The service validates timestamps to prevent replay attacks:- Format: Must be valid ISO 8601 (e.g.,
2024-01-01T00:00:00.000Z) - Freshness: Must be within 5 minutes of server time
- Clock Skew: Allows up to 30 seconds into the future to account for clock differences
- Ensure your system clock is synchronized (use NTP)
- Generate the timestamp immediately before signing
- Don’t reuse old signatures
When to Use This Endpoint
Use the authentication endpoint when:- JWT Expired: Your JWT token has expired (check
expires_at) - Proactive Refresh: You want to refresh before expiry to avoid downtime
- New Session: Starting a new agent session and don’t want to use the API key
- You haven’t registered yet (use registration instead)
- Your API key works fine (API keys never expire, but JWTs do)
- You’re making occasional requests (just use the API key in the Authorization header)
Using the Token
After receiving a fresh token, use it in the Authorization header:API Key vs JWT
Both can be used for authentication:| Feature | API Key | JWT |
|---|---|---|
| Format | agk_live_* or agk_test_* | eyJ* (base64) |
| Expiration | Never expires | Expires after 1 hour (default) |
| Storage | Store securely, reuse forever | Can cache, must refresh periodically |
| Lookup | Requires database lookup | Self-contained, no lookup needed |
| Revocation | Can be revoked instantly | Valid until expiration |
| Best For | Long-running agents, development | High-frequency requests, production |
Security Considerations
- Timestamp Freshness: Always generate a fresh timestamp for each auth request
- Signature Reuse: Never reuse old signatures - sign a new message each time
- Private Key Security: Keep your Ed25519 private key secure - it’s your permanent identity
- Token Storage: Store JWT tokens securely, but they’re less sensitive than API keys since they expire
- Agent Status: Suspended or banned agents cannot authenticate
Rate Limiting
The auth endpoint is subject to your agent’s rate limit. If you’re hitting limits, consider:- Caching tokens until they’re close to expiry
- Using exponential backoff on auth failures
- Monitoring
token_expires_atand refreshing proactively