meeva
Docs

Authentication API

Endpoints for user authentication and session management.

POST/auth/register

Register a new user and create an organization.

Request Body:

email *
User email address
password *
Minimum 8 characters
firstName *
User first name
lastName *
User last name
organizationName
Optional org name
// Request
{
  "email": "user@example.com",
  "password": "securepassword123",
  "firstName": "John",
  "lastName": "Doe",
  "organizationName": "Acme Inc"
}

// Response (201 Created)
{
  "user": {
    "id": "usr_abc123",
    "email": "user@example.com",
    "firstName": "John",
    "lastName": "Doe"
  },
  "organization": {
    "id": "org_xyz789",
    "name": "Acme Inc",
    "slug": "acme-inc"
  },
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
POST/auth/login

Authenticate with email/password and receive a JWT token.

Request Body:

email *
User email address
password *
User password
// Request
{
  "email": "user@example.com",
  "password": "securepassword123"
}

// Response (200 OK)
{
  "user": {
    "id": "usr_abc123",
    "email": "user@example.com",
    "firstName": "John",
    "lastName": "Doe"
  },
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
GET/auth/me

Get current user information using the session token.

Required Headers:

Authorization: Bearer <token>
// Response (200 OK)
{
  "user": {
    "id": "usr_abc123",
    "email": "user@example.com",
    "firstName": "John",
    "lastName": "Doe",
    "timezone": "America/New_York",
    "avatarUrl": "https://..."
  },
  "organizations": [
    {
      "id": "org_xyz789",
      "name": "Acme Inc",
      "slug": "acme-inc",
      "role": "owner"
    }
  ]
}

Error Responses

CodeErrorDescription
400VALIDATION_ERRORInvalid request body
401INVALID_CREDENTIALSWrong email or password
409EMAIL_EXISTSEmail already registered