Docs/Account/API/Authentication

Authentication API

Complete reference for all authentication endpoints. These endpoints handle email availability checks, user registration, login, token management, MFA verification, and password flows.

Base URL: https://id.vyntech.com.au/api/v1 — All paths below are relative to this base. Endpoints marked 🔒 require a valid access token in the Authorization: Bearer <token> header.

Checks whether an email address is already registered within a given tenant. This public endpoint allows onboarding and login workflows to validate email availability before submission. Includes per-IP rate limiting and bot protection.


Check Email Availability

Check if an email address exists or is available for registration in a tenant.

Payload Example

{
  "tenant_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "email": "jane@acme-corp.com",
  "captcha_token": "0.AbCdEf123..."
}

Status Codes

  • Name
    200
    Type
    HTTP
    Description
    Email availability checked successfully
  • Name
    400
    Type
    HTTP
    Description
    Validation failed (invalid tenant UUID or email format)
  • Name
    429
    Type
    HTTP
    Description
    Rate limit exceeded (too many verification requests)

Request Parameters

  • Name
    tenant_id
    Type
    string
    Required
    Description
    UUID of the tenant to check email uniqueness within.
  • Name
    email
    Type
    string
    Required
    Description
    The email address to check for existence or availability.
  • Name
    captcha_token
    Type
    string
    Description
    Optional Cloudflare Turnstile / reCAPTCHA verification token if bot challenge is active.
Request
POST/api/v1/auth/check-email
Response 200

Creates a new user within a tenant. Validates the password against the tenant's password policy, sends a verification email, and returns tokens so the user is authenticated immediately.


Register

Create a new user account and receive authentication tokens.

Payload Example

{
  "email": "jane@acme-corp.com",
  "password": "SecureP@ss2024!",
  "display_name": "Jane Smith",
  "tenant_id": "tnt_01H7ABCD9E8F4G2H1J3K5L7M"
}

Status Codes

  • Name
    201
    Type
    HTTP
    Description
    User created successfully, tokens returned
  • Name
    409
    Type
    HTTP
    Description
    Email already registered within this tenant
  • Name
    422
    Type
    HTTP
    Description
    Password does not meet tenant password policy
  • Name
    429
    Type
    HTTP
    Description
    Rate limit exceeded
Request
POST/api/v1/auth/register
Response 201

Authenticates a user with email and password. Returns tokens on success, or indicates that MFA verification or a risk challenge is required. The risk engine evaluates every login attempt automatically.


Login

Authenticate a user and receive tokens (or MFA/challenge requirement).

Payload Example

{
  "email": "jane@acme-corp.com",
  "password": "SecureP@ss2024!",
  "tenant_id": "tnt_01H7ABCD9E8F4G2H1J3K5L7M"
}

Status Codes

  • Name
    200
    Type
    HTTP
    Description
    Login successful — tokens returned
  • Name
    200
    Type
    HTTP
    Description
    MFA required — mfa_token returned instead of tokens
  • Name
    200
    Type
    HTTP
    Description
    Challenge required — challenge_token returned
  • Name
    401
    Type
    HTTP
    Description
    Invalid email or password
  • Name
    403
    Type
    HTTP
    Description
    Account suspended or IP blocked
  • Name
    423
    Type
    HTTP
    Description
    Account locked (too many failed attempts)
  • Name
    429
    Type
    HTTP
    Description
    Rate limit exceeded
Request
POST/api/v1/auth/login
Response 200

Completes authentication when MFA is required. Submit the TOTP code from the user's authenticator app along with the mfa_token received from the login response. The MFA token is valid for 5 minutes.


MFA

Complete MFA verification with a TOTP code.

Payload Example

{
  "mfa_token": "mfa_01H8NXYZ...",
  "code": "482913"
}

Status Codes

  • Name
    200
    Type
    HTTP
    Description
    MFA verified — tokens returned
  • Name
    401
    Type
    HTTP
    Description
    Invalid TOTP code
  • Name
    401
    Type
    HTTP
    Description
    MFA token expired (5-minute window)
  • Name
    429
    Type
    HTTP
    Description
    Too many failed attempts — temporary lockout
Request
POST/api/v1/auth/verify-mfa
Response 200

Exchanges a valid refresh token for a new access token and refresh token pair. Refresh tokens are single-use — the old token is invalidated immediately (rotation). If a refresh token is used twice, the entire session is revoked.


Refresh Token

Exchange a refresh token for new access and refresh tokens.

Payload Example

{
  "refresh_token": "ref_01H8MWXY7A9B3C5D..."
}

Status Codes

  • Name
    200
    Type
    HTTP
    Description
    Tokens refreshed successfully
  • Name
    401
    Type
    HTTP
    Description
    Refresh token is invalid, expired, or already used
  • Name
    401
    Type
    HTTP
    Description
    Session revoked (reuse detection triggered)
Request
POST/api/v1/auth/refresh
Response 200

Revokes the current session and invalidates the refresh token. The access token will remain valid until it expires (max 15 minutes), so for immediate revocation, also remove the token from your client storage.


LogoutAuth

Revoke the current session and refresh token.

Status Codes

  • Name
    200
    Type
    HTTP
    Description
    Session revoked
  • Name
    401
    Type
    HTTP
    Description
    Invalid or expired access token
Request
POST/api/v1/auth/logout
Response 200

Changes the authenticated user's password. Requires the current password for verification. The new password is validated against the tenant's password policy. All other sessions for this user are revoked on success.


Change PasswordAuth

Change the current user's password (requires authentication).

Payload Example

{
  "current_password": "SecureP@ss2024!",
  "new_password": "EvenStr0nger#2025"
}

Status Codes

  • Name
    200
    Type
    HTTP
    Description
    Password changed, other sessions revoked
  • Name
    401
    Type
    HTTP
    Description
    Current password is incorrect
  • Name
    422
    Type
    HTTP
    Description
    New password does not meet tenant policy
Request
POST/api/v1/auth/change-password
Response 200

Initiates the password reset flow by sending a reset link to the user's email. Always returns 200 regardless of whether the email exists (prevents user enumeration). The reset token is valid for 1 hour.


Forgot Password

Request a password reset email.

Payload Example

{
  "email": "jane@acme-corp.com",
  "tenant_id": "tnt_01H7ABCD9E8F4G2H1J3K5L7M"
}

Status Codes

  • Name
    200
    Type
    HTTP
    Description
    Request processed (always returns 200)
  • Name
    429
    Type
    HTTP
    Description
    Rate limit exceeded
Request
POST/api/v1/auth/forgot-password
Response 200

Completes the password reset using the token from the email link. Validates the new password against the tenant's policy and revokes all existing sessions for the user.


Reset Password

Set a new password using a reset token from the email.

Payload Example

{
  "token": "rst_01H8QWER5T7Y9U1I...",
  "new_password": "MyNewSecure#Pass1"
}

Status Codes

  • Name
    200
    Type
    HTTP
    Description
    Password reset, all sessions revoked
  • Name
    401
    Type
    HTTP
    Description
    Reset token is invalid or expired
  • Name
    422
    Type
    HTTP
    Description
    New password does not meet tenant policy
Request
POST/api/v1/auth/reset-password
Response 200

Confirms the user's email address using the token from the verification email sent during registration. The token is valid for 24 hours.


Email

Verify a user's email address with the token from the verification email.

Payload Example

{
  "token": "evf_01H8ASDF3G5H7J9K..."
}

Status Codes

  • Name
    200
    Type
    HTTP
    Description
    Email verified
  • Name
    401
    Type
    HTTP
    Description
    Token is invalid or expired
  • Name
    409
    Type
    HTTP
    Description
    Email already verified
Request
POST/api/v1/auth/verify-email
Response 200

Sends a new email verification link if the original expired. Rate-limited to 3 requests per hour per user. Returns 200 regardless of whether the email exists.


Resend Verification Email

Send a new email verification link.

Payload Example

{
  "email": "jane@acme-corp.com",
  "tenant_id": "tnt_01H7ABCD9E8F4G2H1J3K5L7M"
}

Status Codes

  • Name
    200
    Type
    HTTP
    Description
    Request processed (always returns 200)
  • Name
    429
    Type
    HTTP
    Description
    Rate limit exceeded (max 3/hour per user)
Request
POST/api/v1/auth/resend-verification
Response 200

What's Next

We use cookies and similar technologies to measure traffic and improve the site. You can choose which categories to allow. Manage Preferences.