Getting Started
Authentication
Login, signup, sessions, and API keys
Overview
The Mail Panda platform uses email and password authentication. Sessions are stored in an admin_token HTTP-only cookie that persists for 7 days. All dashboard routes are protected and require a valid session.
Authentication works differently depending on your deployment mode:
- Self-hosted — A default admin account (
admin@mailpanda.io/password123) is seeded on first launch. Change the password immediately. Seedb/seed.tsfor the seed logic. - SaaS — No default account is created. Users register through the
/signuppage. The seed is skipped whenSTRIPE_SECRET_KEYis set.
For programmatic access (scripts, integrations, CI/CD), use API keys instead of session cookies. See the API Key Auth section below.
Sign Up
Create a new user account. The response sets a session cookie automatically, so the user is signed in immediately after registration.
/api/authCreate a new account and start a session.
Parameters
| Name | Type | Description |
|---|---|---|
action* | string | Must be "signup" |
email* | string | Valid email address |
password* | string | Minimum 6 characters |
Request
{
"action": "signup",
"email": "user@example.com",
"password": "securepassword"
}Response
{
"success": true,
"user": {
"email": "user@example.com",
"name": null
}
}Sign In
Authenticate with an existing account. On success, an HTTP-only cookie is set with a session token valid for 7 days.
/api/authSign in with email and password. Returns user info and sets session cookie.
Parameters
| Name | Type | Description |
|---|---|---|
action* | string | Must be "login" |
email* | string | Registered email address |
password* | string | Account password |
Request
{
"action": "login",
"email": "user@example.com",
"password": "securepassword"
}Response
{
"success": true,
"user": {
"email": "user@example.com",
"name": "User Name"
}
}Check Session
Verify whether the current request has a valid session. Useful for checking authentication status on page load or in middleware.
/api/authCheck if the current session is authenticated. Returns user info if valid.
Response
{
"authenticated": true,
"user": {
"email": "user@example.com",
"name": "User Name"
}
}When no valid session exists, the response returns:
{
"authenticated": false,
"user": null
}Sign Out
End the current session and clear the authentication cookie.
/api/authSign out and clear the session cookie.
Response
{
"success": true
}API Key Auth
For programmatic access to the API (scripts, external integrations, CI/CD pipelines), use API keys instead of session cookies. API keys are managed from the Settings page in the dashboard.
Include the API key in the Authorization header with a Bearer prefix:
curl -H "Authorization: Bearer em_your_api_key_here" \
http://localhost:3000/api/v1/contactsAPI key endpoints are served under the /api/v1/ prefix. See the API Keys documentation for details on creating and managing keys.