Email Auth Endpoints

API reference for all email authentication endpoints. These endpoints allow end users to sign up, sign in, verify their email, and reset their password using email + password credentials.

All endpoints require Content-Type: application/json and an Authorization: Bearer <api_key> header. The project is resolved automatically from the API key.


POST/api/proxy/email/signup

Signup

Register a new end user with email and password.

Request body

  • Name
    email
    Type
    string
    Description

    The user's email address.

  • Name
    password
    Type
    string
    Description

    The user's password (min 8 chars, max 128, at least 1 letter and 1 number).

  • Name
    name
    Type
    string
    Description

    The user's display name (optional).

  • Name
    callback_url
    Type
    string
    Description

    A registered callback URL for the project.

Response 200

{
  "token": "eyJhbGciOiJIUzI1NiIs...",
  "user": {
    "id": "user_abc123",
    "email": "user@example.com",
    "name": "Jane Doe",
    "email_verified": false
  }
}

Error responses

StatusError
400Missing fields or invalid password
401Missing or invalid API key
403Callback URL not registered or email provider not enabled
404Project not found
409Account already exists
415Invalid Content-Type
429Rate limited

POST/api/proxy/email/signin

Signin

Authenticate an existing end user.

Request body

  • Name
    email
    Type
    string
    Description

    The user's email address.

  • Name
    password
    Type
    string
    Description

    The user's password.

  • Name
    callback_url
    Type
    string
    Description

    A registered callback URL for the project.

Response 200

{
  "token": "eyJhbGciOiJIUzI1NiIs...",
  "user": {
    "id": "user_abc123",
    "email": "user@example.com",
    "name": "Jane Doe",
    "email_verified": true
  }
}

Error responses

StatusError
400Missing fields
401Invalid credentials or invalid API key
403Callback URL not registered or email provider not enabled
404Project not found
429Rate limited

POST/api/proxy/email/verify

Verify email

Verify a user's email using a 6-digit OTP code sent to their email after signup.

Request body

  • Name
    email
    Type
    string
    Description

    The user's email address.

  • Name
    code
    Type
    string
    Description

    The 6-digit verification code from the email.

Response 200

{
  "success": true,
  "email_verified": true
}

Error responses

StatusError
400Missing fields or invalid/expired code
401Missing or invalid API key
404Project or user not found
415Invalid Content-Type
429Rate limited

OTP codes expire after 5 minutes and are invalidated after 3 failed attempts.


POST/api/proxy/email/verify/resend

Resend verification

Resend the verification email for an unverified user.

Request body

  • Name
    email
    Type
    string
    Description

    The user's email address.

  • Name
    callback_url
    Type
    string
    Description

    Callback URL for the verification link.

Response

Always returns 200 with { "success": true } to prevent email enumeration.


POST/api/proxy/email/reset-password

Request password reset

Send a password reset email. Always returns 200 regardless of whether the email exists.

Request body

  • Name
    email
    Type
    string
    Description

    The user's email address.

  • Name
    callback_url
    Type
    string
    Description

    The URL where the reset link will point to. The token will be appended as a query parameter.

Response

Always 200 with { "success": true }.


POST/api/proxy/email/reset-password/confirm

Confirm password reset

Set a new password using a valid reset token.

Request body

  • Name
    token
    Type
    string
    Description

    The reset token from the email link.

  • Name
    password
    Type
    string
    Description

    The new password (same requirements as signup).

Response 200

{
  "token": "eyJhbGciOiJIUzI1NiIs...",
  "user": {
    "id": "user_abc123",
    "email": "user@example.com",
    "name": "Jane Doe",
    "email_verified": true
  }
}

JWT claims

All email auth JWTs include the same claims as OAuth JWTs, plus:

{
  "sub": "user_abc123",
  "email": "user@example.com",
  "name": "Jane Doe",
  "picture": null,
  "provider": "email",
  "email_verified": true,
  "project_id": "proj_xyz",
  "iss": "authgate",
  "exp": 1234567890,
  "iat": 1234567590
}

The provider field is always "email" and email_verified is true or false.


MFA challenge response

When a user with MFA enabled signs in via email, the signin endpoint returns an MFA challenge instead of a JWT:

Response 200 (MFA required)

{
  "mfa_required": true,
  "mfa_challenge": "challenge_token_here",
  "mfa_methods": ["totp", "sms"]
}

Submit the challenge to POST /api/proxy/mfa/verify with the user's MFA code to receive the final JWT and refresh token.

Response 200 (MFA setup required)

If the project requires MFA but the user hasn't enrolled yet:

{
  "token": "eyJhbGciOiJIUzI1NiIs...",
  "user": { ... },
  "mfa_setup_required": true
}

Redirect the user to your MFA setup page to enroll before granting access.

Refresh token

All successful authentication responses now include a refresh_token field:

{
  "token": "eyJhbGciOiJIUzI1NiIs...",
  "refresh_token": "rt_abc123...",
  "user": { ... }
}

See Session Management for how to use refresh tokens.


POST/api/proxy/email/magic-link/send

Send a magic link email to the user. If the user does not exist, an account is created automatically. Requires the Magic Link provider to be enabled (independent from the Email provider).

Request body

  • Name
    email
    Type
    string
    Description

    The user's email address.

  • Name
    callback_url
    Type
    string
    Description

    A registered callback URL for the project. The magic link will redirect here with a token query parameter.

Response 200

{
  "success": true
}

Error responses

StatusError
400Missing email or callback_url
401Missing or invalid API key
403Callback URL not registered or Magic Link provider not enabled
404Project not found
415Invalid Content-Type
429Rate limited

GET/api/proxy/email/magic-link/verify

When the user clicks the magic link, this endpoint validates the token, creates a session JWT, and redirects to your callback URL with the token.

Query parameters

  • Name
    token
    Type
    string
    Description

    The magic link token from the email.

  • Name
    callback_url
    Type
    string
    Description

    The registered callback URL to redirect to after verification.

Redirect

{callback_url}?token={jwt_token}

JWT claims

Magic link JWTs include the same claims as other auth JWTs:

{
  "sub": "user_abc123",
  "email": "user@example.com",
  "name": null,
  "picture": null,
  "provider": "magic-link",
  "email_verified": true,
  "project_id": "proj_xyz",
  "iss": "authgate",
  "exp": 1234567890,
  "iat": 1234567590
}

The provider field is always "magic-link" and email_verified is always true.

Was this page helpful?