Authentication Methods
Human Intelligence API supports two authentication methods depending on your use case:- API Key - For server-to-server integration and general API access
- JWT Bearer Token - For authenticated user sessions and long-lived context
1. API Key Authentication
Use API keys for server-side integrations where you need to access the API on behalf of your application.Request Format
Include your API key in theX-API-Key header:
Example Request
When to Use API Keys
- Server-to-server API calls
- Anonymous user conversations
- General API access without user-specific context
- Third-party integrations
2. JWT Bearer Token Authentication
Use JWT tokens for authenticated user sessions, enabling long-lived context and personalized experiences.Login Flow
Step 1: User Login
Step 2: Receive JWT Token
Step 3: Use Bearer Token in Requests
When to Use JWT Tokens
- User-specific conversations with persistent history
- Accessing user’s private threads and data
- Long-lived sessions across multiple requests
- Expert actions requiring coach authentication (e.g.,
create_knowledge) - Personalized experiences tied to user profiles
JavaScript/TypeScript Example
Python Example
Long-Lived Sessions & Token Refresh
JWT tokens expire after 1 hour (3600 seconds). For long-lived sessions, use the refresh token to obtain a new access token without requiring the user to log in again.Refreshing Tokens
Response
Automatic Token Refresh (JavaScript)
Getting Your API Key
1
Request Access
Email support@myweave.ai with your use case and integration plans
2
Receive API Key
Our team will review your request and send you an API key within 24 hours
3
Start Building
Use your API key in the
X-API-Key header for all requestsAuthentication Comparison
Security Best Practices
- Store securely: Keep API keys in environment variables
- Server-side only: Make API calls from your backend, not frontend
- Rotate regularly: Update keys periodically for enhanced security
- Monitor usage: Track API calls for suspicious activity
- Use HTTPS: Always make requests over secure connections
Rate Limiting
All API endpoints are rate limited per API key to ensure fair usage and system stability:Rate Limit Headers
Each API response includes rate limit information:Handling Rate Limits
When rate limits are exceeded, you’ll receive a429 Too Many Requests response:
CORS Support
All endpoints support Cross-Origin Resource Sharing (CORS) with the following headers:Access-Control-Allow-Origin: *Access-Control-Allow-Headers: authorization, x-client-info, apikey, content-type

