Overview
All DayCopilot API requests require authentication using JSON Web Tokens (JWT). The API uses Bearer token authentication in the Authorization header.Getting Your Token
Via Dashboard
- Sign in to DayCopilot
- Navigate to your account settings
- Generate an API token
- Copy the JWT token for use in API requests
Via OAuth 2.0 (Recommended for integrations)
For third-party integrations and applications, use OAuth 2.0:Making Authenticated Requests
Include the JWT token in theAuthorization header with the Bearer scheme:
Token Security Best Practices
Store Tokens Securely
Store Tokens Securely
- Never commit tokens to version control
- Use environment variables or secure key management systems
- Rotate tokens regularly (at least every 90 days)
- Never expose tokens in client-side code or URLs
Handle Token Expiration
Handle Token Expiration
JWT tokens expire after a set period. Implement token refresh logic:
Use HTTPS Only
Use HTTPS Only
Always use HTTPS when making API requests. Never send tokens over unencrypted HTTP connections.
Implement Token Revocation
Implement Token Revocation
If a token is compromised, revoke it immediately:
OAuth 2.0 Scopes
DayCopilot supports fine-grained permissions via OAuth scopes:| Scope | Description |
|---|---|
tasks:read | Read access to tasks |
tasks:write | Create, update, and delete tasks |
events:read | Read access to events |
events:write | Create, update, and delete events |
contexts:read | Read access to contexts |
contexts:write | Create, update, and delete contexts |
user:read | Read user profile information |
user:write | Update user profile information |
Access Control
All API requests are automatically scoped to the authenticated user via access control policies:- Users can only access their own data
- Users can access data explicitly shared with them
- Collaborative contexts respect sharing permissions
- All queries are filtered by user context
Error Responses
401 Unauthorized
- Missing
Authorizationheader - Invalid or expired token
- Malformed token
403 Forbidden
- Valid token but insufficient OAuth scopes
- Attempting to access another user’s data
- Resource not shared with authenticated user