Authentication
The Co-mind.ai API supports two authentication methods. Both use theAuthorization: Bearer <token> header.
- Personal Access Tokens (Recommended)
- JWT Authentication
PATs are long-lived tokens for programmatic API access. They are the recommended method for integrations, scripts, CI/CD pipelines, and any non-interactive usage.Token format: Advantages:
cmnd_<tokenId>.<secret>- Long-lived (up to 365 days)
- Fine-grained scopes limit access to only what’s needed
- Can be rotated without downtime
- No refresh flow required
JWT Authentication Flow
Login
POST /v1/auth/login
LDAP/AD routing: If the user’s email domain matches an IdP configuration, the login request is automatically routed to the configured LDAP/AD directory for authentication. No client-side changes are needed.
SSO Login (Microsoft Entra ID)
POST /v1/auth/sso
Refresh Token
POST /v1/auth/refresh
Logout
POST /v1/auth/logout
Get Current User
GET /v1/auth/me
Registration & Password Reset
Registration Flow
Password Reset Flow
Authentication Endpoints Reference
| Endpoint | Method | Auth | Purpose |
|---|---|---|---|
/v1/auth/login | POST | None | Login and get JWT tokens |
/v1/auth/sso | POST | None | SSO login (Microsoft Entra ID) |
/v1/auth/refresh | POST | None | Refresh JWT access token |
/v1/auth/me | GET | Bearer | Get current user info |
/v1/auth/logout | POST | None | Revoke JWT tokens |
/v1/auth/check-registration | GET | None | Check if email is registered |
/v1/auth/register | POST | None | Register new user |
/v1/auth/confirm | POST | None | Confirm email with auth code |
/v1/auth/change-password | POST | JWT | Change password |
/v1/auth/password-reset-request | POST | None | Request password reset |
/v1/auth/password-reset | POST | None | Execute password reset |
/v1/auth/admin/set-password | POST | Service | Admin set user password |
/v1/auth/users/{userId} | DELETE | Service | Delete user with cascade |
Security Best Practices
Use PATs for integrations
Use PATs for integrations
PATs are long-lived and scoped — much better than JWTs for automated workflows. Reserve JWTs for interactive sessions.
Always use HTTPS
Always use HTTPS
Never send tokens over HTTP. All production deployments should enforce TLS.
Store secrets securely
Store secrets securely
Use environment variables or secret managers (AWS Secrets Manager, HashiCorp Vault) — never commit tokens to source control.
Use minimal scopes
Use minimal scopes
Only request the permissions you need. A read-only integration should not have
write scopes.Rotate tokens periodically
Rotate tokens periodically
Use the
POST /v1/api-tokens/{id}/rotate endpoint for seamless rotation without downtime.Revoke unused tokens
Revoke unused tokens
Delete tokens that are no longer needed using
DELETE /v1/api-tokens/{id}.Never commit tokens to source control
Never commit tokens to source control
Use
.env files, CI/CD secrets, or secret managers instead.
