Skip to main content

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

  1. Sign in to DayCopilot
  2. Navigate to your account settings
  3. Generate an API token
  4. Copy the JWT token for use in API requests
For third-party integrations and applications, use OAuth 2.0:
Response:

Making Authenticated Requests

Include the JWT token in the Authorization header with the Bearer scheme:

Token Security Best Practices

  • 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
JWT tokens expire after a set period. Implement token refresh logic:
Always use HTTPS when making API requests. Never send tokens over unencrypted HTTP connections.
If a token is compromised, revoke it immediately:

OAuth 2.0 Scopes

DayCopilot supports fine-grained permissions via OAuth scopes: Request only the scopes your application needs:

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
This means you don’t need to manually filter by user ID - access control is handled automatically. See Access Control & Permissions for detailed information.

Error Responses

401 Unauthorized

Causes:
  • Missing Authorization header
  • Invalid or expired token
  • Malformed token

403 Forbidden

Causes:
  • Valid token but insufficient OAuth scopes
  • Attempting to access another user’s data
  • Resource not shared with authenticated user

Testing Authentication

Use this endpoint to verify your token is valid:
Response:

Next Steps

Quick Start

Make your first authenticated API call

API Reference

Explore authenticated endpoints