How to Use Auth and Profile APIs

This guide describes how to register users, manage auth sessions, verify emails, perform password resets, and update user profiles via the REST APIs.


πŸ”‘ Authentication

Most endpoints in this guide require standard user authentication. Include the user JWT token in your requests: Authorization: Bearer <user-jwt-token>

Exceptions: /api/auth/register, /api/auth/forgot-password, and /api/auth/reset-password are public endpoints.


1. Register a User

Registers a new user account.

  • HTTP Method: POST
  • Path: /api/auth/register
  • Headers:
    • Content-Type: application/json

Request Body Parameters

Parameter Type Required Description
email string Yes Unique user email address.
password string Yes Strong password.
organizationName string Yes The name of the organization (tenant) to be created.
firstName string No User's first name.
lastName string No User's last name.
country string No Country code (e.g. US).

Example Request (curl)

curl -X POST https://ids.fabrixly.com/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "my-secure-password-789",
    "organizationName": "Acme Corp",
    "firstName": "Jane",
    "lastName": "Doe",
    "country": "US"
  }'

Response (201 Created)

{
  "id": "usr_abc123",
  "email": "user@example.com",
  "firstName": "Jane",
  "lastName": "Doe",
  "country": "US",
  "email_verified": false,
  "status": "active"
}

Error Response (400 Bad Request)

{
  "error": "Organization Name is required"
}

2. Get Current Auth State (/me)

Retrieve profile details of the currently authenticated user.

  • HTTP Method: GET
  • Path: /api/auth/me
  • Headers:
    • Authorization: Bearer <user-jwt-token>

Example Request (curl)

curl -X GET https://ids.fabrixly.com/api/auth/me \
  -H "Authorization: Bearer <user-jwt-token>"

3. Log Out

Revokes the active user session token.

  • HTTP Method: POST
  • Path: /api/auth/logout
  • Headers:
    • Authorization: Bearer <user-jwt-token>

Example Request (curl)

curl -X POST https://ids.fabrixly.com/api/auth/logout \
  -H "Authorization: Bearer <user-jwt-token>"

4. Resend Verification Email

Resends the email confirmation link to unverified users.

  • HTTP Method: POST
  • Path: /api/auth/resend-verification
  • Headers:
    • Content-Type: application/json

Example Request (curl)

curl -X POST https://ids.fabrixly.com/api/auth/resend-verification \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com"
  }'

5. Forgot Password

Requests a password reset link to be sent via email.

  • HTTP Method: POST
  • Path: /api/auth/forgot-password
  • Headers:
    • Content-Type: application/json

Example Request (curl)

curl -X POST https://ids.fabrixly.com/api/auth/forgot-password \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com"
  }'

6. Reset Password

Resets the password using a valid reset token.

  • HTTP Method: POST
  • Path: /api/auth/reset-password
  • Headers:
    • Content-Type: application/json

Example Request (curl)

curl -X POST https://ids.fabrixly.com/api/auth/reset-password \
  -H "Content-Type: application/json" \
  -d '{
    "token": "reset-token-received-in-email",
    "password": "my-new-secure-password-000"
  }'

7. Get User Profile

Retrieve the currently authenticated user's profile card details.

  • HTTP Method: GET
  • Path: /api/profile
  • Headers:
    • Authorization: Bearer <user-jwt-token>

Example Request (curl)

curl -X GET https://ids.fabrixly.com/api/profile \
  -H "Authorization: Bearer <user-jwt-token>"

8. Update User Profile

  • HTTP Method: PUT
  • Path: /api/profile
  • Headers:
    • Content-Type: application/json
    • Authorization: Bearer <user-jwt-token>

Example Request (curl)

curl -X PUT https://ids.fabrixly.com/api/profile \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <user-jwt-token>" \
  -d '{
    "firstName": "Jane (Updated)",
    "lastName": "Doe (Updated)",
    "mobile": "+15550199"
  }'

9. Change Password (Profile)

Updates the user's password while authenticated in their profile dashboard.

  • HTTP Method: PUT
  • Path: /api/profile/password
  • Headers:
    • Content-Type: application/json
    • Authorization: Bearer <user-jwt-token>

Example Request (curl)

curl -X PUT https://ids.fabrixly.com/api/profile/password \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <user-jwt-token>" \
  -d '{
    "currentPassword": "old-password-123",
    "newPassword": "new-password-456"
  }'

10. Verify MFA Recovery Code

Verifies an emergency recovery backup code to bypass standard multi-factor authentication (e.g. if the authenticator device is lost).

  • HTTP Method: POST
  • Path: /api/auth/verify-recovery-code
  • Headers:
    • Content-Type: application/json

Example Request (curl)

curl -X POST https://ids.fabrixly.com/api/auth/verify-recovery-code \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "recoveryCode": "abcd-1234"
  }'

Response (200 OK)

{
  "message": "Recovery code accepted. MFA has been temporarily bypassed.",
  "token": "one-time-session-jwt-token-string"
}

Subscribe to The Fabrixly Blog

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe