LogoLogo
  • Home
  • Overview
  • Getting Started
  • Prompt Guide
  • API Reference
    • Authentication
      • Web3
      • Google OAuth
    • Account
    • Escrow
    • File upload
    • Wallet
Powered by GitBook
On this page
Export as PDF
  1. API Reference

Authentication

With the Pakt Web API, Chainsite builders can establish user authentication features such as:

PreviousAPI ReferenceNextWeb3

Last updated 1 day ago

Register New User
Activate New User Account
Resend New User Account Verification Email
Authenticate Returning User for Login
Complete Two-Factor Authentication via Email for Returning User Login
Resend Two-Factor Authentication Code via Email for Returning User Login
Initiate Password Reset
Verify Password Reset Code
Complete Password Reset
  • POSTRegister New User
  • POSTActivate New User Account
  • POSTResend New User Account Verification Email
  • POSTAuthenticate Returning User for Login
  • POSTComplete Two-Factor Authentication via Email for Returning User Login
  • POSTResend Two-Factor Authentication Code via Email for Returning User Login
  • POSTInitiate Password Reset
  • POSTVerify Password Reset Code
  • POSTComplete Password Reset

Register New User

post

This endpoint is used to create a new user account.

Request

  • firstName (string): The first name of the user.

  • lastName (string): The last name of the user.

  • email (string): The email address of the user.

  • password (string): The password for the user account.

  • confirmPassword (string): The confirmation of the password.

Response

  • status (string): The status of the request.

  • message (string): Additional information or error message.

  • data (object):

    • email (string): The email address of the user.

    • tempToken (object):

      • token (string): Temporary token for account verification.

      • token_type (string): Type of the token.

      • expiresIn (number): Expiry duration of the token in seconds.

Authorizations
Body
objectOptionalExample: {"firstName":"Alice","lastName":"Bob","email":"mail@example.com","password":"1234@Abcd","confirmPassword":"1234@Abcd"}
Responses
202
Accepted
application/json
Responseobject
post
POST /v1/auth/create-account HTTP/1.1
Host: {{baseurl}}
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 118

{
  "firstName": "Alice",
  "lastName": "Bob",
  "email": "mail@example.com",
  "password": "1234@Abcd",
  "confirmPassword": "1234@Abcd"
}
202

Accepted

{
  "status": "success",
  "message": "Account created successfully, Please verify your account",
  "data": {
    "email": "mail@example.com",
    "tempToken": {
      "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3Zjg2ODNlZTVkY2Q5MzYzZmQwYTk3YiIsImlhdCI6MTc0NDMzMjg2MiwiZXhwIjoxNzQ0MzM0OTY0fQ.mxZTFOMT21JQ2wFGCHnHctuwBJhUf1nYP7vk7IaPMLaKdBxuVKgX00ovN7w_Sxwoo4oAW-BV1bBpYfD_OS9v2_lfHfP2EoW6523x7eLKBzp6dnCNC7pJLuKMNY9fn6UjVctE8KzZYKwqHDcWm1RB52LyuTkVEQVom2ipQkDibSqftWyeIlw1A6DXY7qIADBYrc1rAWbSnSr7bnMBWZPBRA3dEz0zDNG-1T2LxmFV77eBFaVcHGlUVrQ9SRQxeGBTsX0jI_zzjvkCeVLbGT4eqkiR2TbGrJy9PDHi2sBVz08-_zBEyMLBrXLW7Jo9LOaweyi52NzgkdY8nyWEJ9yvCA",
      "token_type": "jwt",
      "expiresIn": 1744334964000
    }
  }
}

Activate New User Account

post

Verifies and activates a user account using a verification token and temporary authentication token.

This endpoint completes the multi-step user registration flow, where a user first creates an account with basic information, receives a verification code, and then confirms their identity by submitting that code along with the temporary token received during registration.

Request

The request requires a JSON body with the following fields:

  • token: A 6-digit verification code sent to the user's email or phone

  • tempToken: A temporary JWT authentication token provided during the registration or account recovery process

Response

The response contains the following structure:

  • status: Indicates if the account verification was successful

  • message: A descriptive message confirming the account was successfully activated

  • data: An object containing authentication credentials and verification status:

    • token: A permanent JWT authentication token that can be used for subsequent API calls

    • token_type: Specifies the type of token provided ("jwt")

    • expiresIn: The timestamp when the token will expire, set to a far future date

    • isVerified: Boolean flag confirming the account is now verified

The successful verification process transforms the user's account status from pending to active, enabling full access to the platform. The provided authentication token has an extremely long expiration period, allowing the user to remain logged in for an extended time.

Authorizations
Body
objectOptionalExample: {"token":"191908","tempToken":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3Zjg2ODNlZTVkY2Q5MzYzZmQwYTk3YiIsImlhdCI6MTc0NDMzMjg2MiwiZXhwIjoxNzQ0MzM0OTY0fQ.mxZTFOMT21JQ2wFGCHnHctuwBJhUf1nYP7vk7IaPMLaKdBxuVKgX00ovN7w_Sxwoo4oAW-BV1bBpYfD_OS9v2_lfHfP2EoW6523x7eLKBzp6dnCNC7pJLuKMNY9fn6UjVctE8KzZYKwqHDcWm1RB52LyuTkVEQVom2ipQkDibSqftWyeIlw1A6DXY7qIADBYrc1rAWbSnSr7bnMBWZPBRA3dEz0zDNG-1T2LxmFV77eBFaVcHGlUVrQ9SRQxeGBTsX0jI_zzjvkCeVLbGT4eqkiR2TbGrJy9PDHi2sBVz08-_zBEyMLBrXLW7Jo9LOaweyi52NzgkdY8nyWEJ9yvCA"}
Responses
200
OK
application/json
Responseobject
post
POST /v1/auth/account/verify HTTP/1.1
Host: {{baseurl}}
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 503

{
  "token": "191908",
  "tempToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3Zjg2ODNlZTVkY2Q5MzYzZmQwYTk3YiIsImlhdCI6MTc0NDMzMjg2MiwiZXhwIjoxNzQ0MzM0OTY0fQ.mxZTFOMT21JQ2wFGCHnHctuwBJhUf1nYP7vk7IaPMLaKdBxuVKgX00ovN7w_Sxwoo4oAW-BV1bBpYfD_OS9v2_lfHfP2EoW6523x7eLKBzp6dnCNC7pJLuKMNY9fn6UjVctE8KzZYKwqHDcWm1RB52LyuTkVEQVom2ipQkDibSqftWyeIlw1A6DXY7qIADBYrc1rAWbSnSr7bnMBWZPBRA3dEz0zDNG-1T2LxmFV77eBFaVcHGlUVrQ9SRQxeGBTsX0jI_zzjvkCeVLbGT4eqkiR2TbGrJy9PDHi2sBVz08-_zBEyMLBrXLW7Jo9LOaweyi52NzgkdY8nyWEJ9yvCA"
}
200

OK

{
  "status": "success",
  "message": "Account activated successfully",
  "data": {
    "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3Zjg2ODNlZTVkY2Q5MzYzZmQwYTk3YiIsIm93bmVyIjoiNjdmODY4M2VlNWRjZDkzNjNmZDBhOTdiIiwiaWF0IjoxNzQ0MzMyOTQyLCJleHAiOjEzMDc1MzMzMjk0Mn0.GQJpLS4kSNfQ-U2eY2TGgLX-QUxKZbfTpoAauafeST8Usm5DYAs120g4Cok_jriFKNT2kkuvva09HYOgmLboiH41TAGzV_M5SiaLSAz7jOEytsFn56rdbt2HQSc_SPMJW-TW82ywsUUAhYPNN4qj3jnfKwbXFNwuqniGqZ8ekNmHGnq_IP4wZgE9SRpbku9_X471yznTL2Ve-1ehOveGkW-wo_hS_9rHDZOxp6mvSooXHkivKpqdWpX0-e54yjhh6Lw6ZcV9dBOJgLPGLalVAhBRQnNAT57ju8vx2iyq14gpk41WuLJ4OjHG8Q6gCbzEAQBRz-2aiKXvpS_fWx7P1Q",
    "token_type": "jwt",
    "expiresIn": 130753332942000,
    "isVerified": true
  }
}

Resend New User Account Verification Email

post

This endpoint is used to resend the verification email to the specified email address.

Request

  • email (string, required): The email address to which the verification email will be resent.

Response

  • status (string): The status of the request.

  • message (string): A message related to the status of the request.

  • data (object): The data object containing the temporary token.

    • tempToken (object): The temporary token details.

      • token (string): The temporary token value.

      • token_type (string): The type of the token.

      • expiresIn (number): The expiration time of the token in seconds.

Authorizations
Body
objectOptionalExample: {"email":"mail@example.com"}
Responses
200
OK
application/json
Responseobject
post
POST /v1/auth/verify/resend HTTP/1.1
Host: {{baseurl}}
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 28

{
  "email": "mail@example.com"
}
200

OK

{
  "status": "success",
  "message": "Email verification sent",
  "data": {
    "tempToken": {
      "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3Zjg2ODNlZTVkY2Q5MzYzZmQwYTk3YiIsImlhdCI6MTc0NDMzNTYyMCwiZXhwIjoxNzQ0MzM3NzIyfQ.PSa0T_BaAR6k5mpUd0U1UWqxSk1iv4pf8JpnVjyJGFMcYEbQZalABfVg4FbUkhT6VTxlPTaUBqJ7s7_yqE1E5sw-DnijVoYqC-pVn1uTVltoIxgFy1KCFWpfJtTOX4kgk-S45yn1iaWqBiZvqbiKO4NX511Uzj_Jxhz4XD6RQZVfTVq97mUGXOWev7f5LIdA_lI6ttoMAZRwCGJJW91YJUsy-z9j6ZGdUm7iV3z27rhnRzEjEFh6DhbHCRpsfxbAfPg0mNJVhYdNvhGASOTrxjX__6Abt4Pqt58OD1XfE7bT0sG7xOMwKMlgrVGcFneRkJEqiNFB_UgnxkWym5hKkg",
      "token_type": "jwt",
      "expiresIn": 1744337722000
    }
  }
}

Authenticate Returning User for Login

post

This endpoint allows users to authenticate and obtain a token for accessing protected resources.

Request

  • email (string): The email address of the user.

  • password (string): The password for the user's account.

Response

  • status (string): The status of the response.

  • message (string): A message related to the response status.

  • data (object): The data object containing authentication details.

    • token (string): The authentication token.

    • token_type (string): The type of token.

    • expiresIn (number): The expiration time of the token.

    • isVerified (boolean): Indicates if the user's account is verified.

Authorizations
Body
objectOptionalExample: {"email":"mail@example.com","password":"1234567890@Abcde"}
Responses
200
OK
application/json
Responseobject
post
POST /v1/auth/login HTTP/1.1
Host: {{baseurl}}
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 58

{
  "email": "mail@example.com",
  "password": "1234567890@Abcde"
}
200

OK

{
  "status": "success",
  "message": "success",
  "data": {
    "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3Zjg2ODNlZTVkY2Q5MzYzZmQwYTk3YiIsIm93bmVyIjoiNjdmODY4M2VlNWRjZDkzNjNmZDBhOTdiIiwiaWF0IjoxNzQ0MzM1NjgwLCJleHAiOjEzMDc1MzMzNTY4MH0.1LSG8xOITLj69PyElVSWDF41G9VQqwP7RJ6aN7bwwCWsg2nP3PFhhqGDr1ZtZ4RmXqKkbDPXKjbgZGd9dG0cacDycaYpjgZuwL3KQ6uGo9XJ3oQTRjSyI_8Nu42gPDwH08kkmCBDu3mbIOOCi3totuVlRkv9OyEprg32O0UJdRL6K_rptNSfw7fseCuuzW4fPRrXhYMVAimoKAtQcQpiglI1221Mb-2Xi9NGokRakEQgJvzJvcSxKADIHDdWont3iX1Dl4bnsofKX97BQjnX7DTq2GRtqs2FgE_YjKkIrrA-oNnE4oRcpA_BEoya5AAJ1q9st9YWUTA9e4AsRrtsJA",
    "token_type": "jwt",
    "expiresIn": 130753335680000,
    "isVerified": true
  }
}

Complete Two-Factor Authentication via Email for Returning User Login

post

This endpoint allows users to log in using two-factor authentication by providing a temporary token and the verification code.

Request

  • tempToken (string): The temporary token generated during the initial login process.

  • code (string): The verification code entered by the user.

Response

The response contains the following structure:

  • status: Indicates if the request was successful

  • message: A brief status message

  • data: Contains the user profile information with extensive details:

    • _id: Unique MongoDB identifier for the user

    • firstName: User's first name

    • lastName: User's last name

    • email: User's email address

    • status: Boolean indicating if the account is active

    • emailVerified: Boolean indicating if the email has been verified

    • role: User's role in the system (e.g., "user")

    • type: User's type classification (e.g., "recipient")

    • profile: Object containing detailed profile information:

      • contact: Address and phone information

        • country: User's country

        • state: User's state/province

        • city: User's city

        • address: User's physical address

        • phone: User's phone number

      • bio: Professional information

        • title: User's professional title

        • description: Brief description of professional skills

      • talent: Skills and availability information

        • about: Detailed information about the user's background

        • availability: Current availability status

        • tags: Array of skill/interest tags as strings

        • tagsIds: Detailed array of tag objects with metadata

    • isPrivate: Boolean indicating profile privacy setting

    • walletGenerated: Boolean indicating if a wallet has been created

    • score: Numeric score value (appears to be reputation or activity based)

    • profileCompleteness: Percentage indicating profile completion status

    • socket: Object with connection status information

    • loggedInAt: Timestamp of last login

    • referralCode: User's unique referral code

    • userName: User's unique username

    • bgImage: Object containing background image details and URL

    • meta: Object containing additional metadata like point scores

    • profileImage: Object containing profile image details and URL

    • socials: Object containing social media profile links

      • github: GitHub profile URL

      • twitter: Twitter profile URL

      • linkedin: LinkedIn profile URL

      • website: Personal website URL

    • token: JWT authentication token

    • token_type: Type of authentication token

    • expiresIn: Token expiration timestamp

    • isVerified: Boolean indicating if the user is verified

The tags system includes detailed information about each skill tag, including parent-child relationships, color coding, and entry counts, supporting a rich categorization system for user talents and specializations.

Authorizations
Body
objectOptionalExample: {"tempToken":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY2ZmQyNWY1N2VmYjRiNjdiZDVkMjcxZSIsImlhdCI6MTc0NDM3MTEwMiwiZXhwIjoxNzQ0MzczMjA0fQ.SH54FSVuG3s9jXqCP39Bn0L7rf0-TEtfBpuk-9T8bJfN1bTALVmhVzc-jyEfyYc86aMaJ-_m4KtlqtBuwIgSVeOznNX-Y9IoY9zCQgskqJDViznKQdVb9tKAhmDY5ijNT-8muRoWK88gdqj1A0E9m8zTx8_qzkU9uNvQukOXgt2PqU1GI2rg0MUWBgST00KqLoddl9oY-vOcxQC8_2WGZiYFUfNRO7vo_mXwd_dJixoE0iruA4ahBoL1rs1s7L-YkaljU2TabyvnxFJXSEEAYFVxhwFgs2Ia6tlNubM55po2tvQufnB10hdGRq3DRlWWPvYMpyRq75rtXYeJFtfPlw","code":"746611"}
Responses
200
OK
application/json
Responseobject
post
POST /v1/auth/login/2fa HTTP/1.1
Host: {{baseurl}}
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 502

{
  "tempToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY2ZmQyNWY1N2VmYjRiNjdiZDVkMjcxZSIsImlhdCI6MTc0NDM3MTEwMiwiZXhwIjoxNzQ0MzczMjA0fQ.SH54FSVuG3s9jXqCP39Bn0L7rf0-TEtfBpuk-9T8bJfN1bTALVmhVzc-jyEfyYc86aMaJ-_m4KtlqtBuwIgSVeOznNX-Y9IoY9zCQgskqJDViznKQdVb9tKAhmDY5ijNT-8muRoWK88gdqj1A0E9m8zTx8_qzkU9uNvQukOXgt2PqU1GI2rg0MUWBgST00KqLoddl9oY-vOcxQC8_2WGZiYFUfNRO7vo_mXwd_dJixoE0iruA4ahBoL1rs1s7L-YkaljU2TabyvnxFJXSEEAYFVxhwFgs2Ia6tlNubM55po2tvQufnB10hdGRq3DRlWWPvYMpyRq75rtXYeJFtfPlw",
  "code": "746611"
}
200

OK

{
  "status": "success",
  "message": "success",
  "data": {
    "_id": "66fd25f57efb4b67bd5d271e",
    "firstName": "Test",
    "lastName": "Member Ten - Updated",
    "email": "test_ten@member.dev",
    "status": true,
    "emailVerified": true,
    "role": "user",
    "type": "recipient",
    "profile": {
      "contact": {
        "country": "Kenya",
        "state": "Lagos",
        "city": "Lagos",
        "address": "30, isimbi rwanda street",
        "phone": "08012345678"
      },
      "bio": {
        "title": "Software Engineer",
        "description": "Builds software Products"
      },
      "talent": {
        "about": "About this user?. User is the best developer in the solar system",
        "availability": "available",
        "tags": [
          "product",
          "writing",
          "custom",
          "engineering",
          "devops",
          "web3",
          "crypto"
        ],
        "tagsIds": [
          {
            "_id": "66fabd5d0f3ed134f11ec77a",
            "name": "Product",
            "description": "Product",
            "icon": "",
            "categories": [
              "66fabd5d0f3ed134f11ec780",
              "66fabd5d0f3ed134f11ec785"
            ],
            "isParent": true,
            "type": "tags",
            "entryCount": 1,
            "createdAt": "2024-09-30T15:01:49.089Z",
            "updatedAt": "2024-09-30T15:01:49.104Z",
            "__v": 0
          },
          {
            "_id": "671273a2d4b17f7eebc7c433",
            "name": "writing",
            "key": "writing",
            "color": "#1E9ED5",
            "categories": [],
            "isParent": false,
            "type": "",
            "entryCount": 1,
            "createdAt": "2024-10-18T14:41:38.135Z",
            "updatedAt": "2024-10-18T14:41:38.135Z",
            "__v": 0
          },
          {
            "_id": "67f8f89999b0c3c52a841c06",
            "name": "custom",
            "key": "custom",
            "color": "#EDDEA4",
            "categories": [],
            "isParent": false,
            "type": "",
            "entryCount": 1,
            "createdAt": "2025-04-11T11:10:17.871Z",
            "updatedAt": "2025-04-11T11:10:17.871Z",
            "__v": 0
          },
          {
            "_id": "66fabd5d0f3ed134f11ec752",
            "name": "Engineering",
            "description": "Engineering",
            "icon": "",
            "categories": [
              "66fabd5d0f3ed134f11ec757",
              "66fabd5d0f3ed134f11ec75e",
              "66fabd5d0f3ed134f11ec763",
              "66fabd5d0f3ed134f11ec768",
              "66fabd5d0f3ed134f11ec76f"
            ],
            "isParent": true,
            "type": "tags",
            "entryCount": 1,
            "createdAt": "2024-09-30T15:01:49.046Z",
            "updatedAt": "2024-09-30T15:01:49.081Z",
            "__v": 0
          },
          {
            "_id": "67f8f89999b0c3c52a841c0b",
            "name": "devops",
            "key": "devops",
            "color": "#FCF6BD",
            "categories": [],
            "isParent": false,
            "type": "",
            "entryCount": 1,
            "createdAt": "2025-04-11T11:10:17.900Z",
            "updatedAt": "2025-04-11T11:10:17.900Z",
            "__v": 0
          },
          {
            "_id": "67201db2c1569a68bcbc6b05",
            "name": "Web3",
            "key": "web3",
            "color": "#E9EBB4",
            "categories": [],
            "isParent": false,
            "type": "tags",
            "entryCount": 16,
            "createdAt": "2024-10-28T23:26:42.368Z",
            "updatedAt": "2025-01-29T15:04:21.107Z",
            "__v": 0
          },
          {
            "_id": "676e9980d979d551e643342c",
            "name": "Crypto",
            "key": "crypto",
            "color": "#8fc8f0",
            "categories": [],
            "isParent": false,
            "type": "tags",
            "entryCount": 5,
            "createdAt": "2024-12-27T12:11:44.907Z",
            "updatedAt": "2025-01-23T19:56:33.428Z",
            "__v": 0
          }
        ]
      }
    },
    "isPrivate": false,
    "walletGenerated": true,
    "score": 0,
    "profileCompleteness": 100,
    "socket": {
      "status": "OFFLINE"
    },
    "loggedInAt": "2025-04-11T11:04:35.136Z",
    "referralCode": "BFBm",
    "userName": "test-member-msrz",
    "bgImage": {
      "_id": "670ccad414e6574bd97a3b25",
      "name": "public/66fd24e87efb4b67bd5d2609/91849b55-1c6d-490d-ba4d-8297892fc299.jpeg",
      "type": "image/jpeg",
      "size": "186314",
      "url": "https://s3.amazonaws.com/chainsite-dev-storage/public/66fd24e87efb4b67bd5d2609/91849b55-1c6d-490d-ba4d-8297892fc299.jpeg"
    },
    "meta": {
      "pointScore": 1
    },
    "profileImage": {
      "_id": "670ccad414e6574bd97a3b25",
      "name": "public/66fd24e87efb4b67bd5d2609/91849b55-1c6d-490d-ba4d-8297892fc299.jpeg",
      "type": "image/jpeg",
      "size": "186314",
      "url": "https://s3.amazonaws.com/chainsite-dev-storage/public/66fd24e87efb4b67bd5d2609/91849b55-1c6d-490d-ba4d-8297892fc299.jpeg"
    },
    "socials": {
      "github": "https://github.com/tester",
      "twitter": "https://twitter.com/tester",
      "linkedin": "https://linkedin.com/tester",
      "website": "https://mywebsite.com"
    },
    "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY2ZmQyNWY1N2VmYjRiNjdiZDVkMjcxZSIsIm93bmVyIjoiNjZmZDI1ZjU3ZWZiNGI2N2JkNWQyNzFlIiwiaWF0IjoxNzQ0MzcxMTM1LCJleHAiOjE3NDU2NjEyMjV9.ZUTDM2LS5Ff4-3lbrtIoap8ub1pw9wjUZNac9zkm3V9laQVtmGGhD7yswqJKC2BqdVgnG1x5I7tVMR1sfDK9Cx3CQo1TuhZAKci_wzrjncpLLCV7VPP0uG6HSl_cp049-0A9FcUSWJ3ajDB5rlHzpflaicZ1ZRRADaQ8VlkfseDvCHGnDXxa1omS-m7d6SYmDtmoFry0bvORr46E1l3v6lzG5gqe0vem6F6VMT5W5myZ4YfSPATH-HOXbrEGOmpPSfWx2fxGMfb-ZY8Bghxv5Qltrsxoq6bjhzEtxNYVsXaoSNb3AywsBTNpy5Az3Vpq3z1wbo7uWF33fd_C7u2LxQ",
    "token_type": "jwt",
    "expiresIn": 1745661225000,
    "isVerified": true
  }
}

Resend Two-Factor Authentication Code via Email for Returning User Login

post

This endpoint allows the user to make an HTTP POST request to {{baseUrl}}/v1/auth/2fa/email/code in order to send a two-factor authentication (2FA) code to the provided email address. The request should include a JSON payload with the "email" key set to the user's email address.

Request

  • email (string, required): The email address to which the 2FA code will be sent.

Response

The response will include the following parameters:

  • status: Indicates the status of the request.

  • message: Provides additional information or error messages.

  • data: An empty object.

Authorizations
Body
objectOptionalExample: {"email":"user@example.com"}
Responses
200
OK
application/json
Responseobject
post
POST /v1/auth/2fa/email/code HTTP/1.1
Host: {{baseurl}}
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 28

{
  "email": "user@example.com"
}
200

OK

{
  "status": "success",
  "message": "OK",
  "data": {}
}

Initiate Password Reset

post

This endpoint allows the user to reset their password by providing their email.

Request Body

  • email (string, required): The email address for which the password needs to be reset.

Response

  • status (string): The status of the request.

  • message (string): A message related to the status of the request.

  • data (object): The data object containing the temporary token.

    • tempToken (object): The temporary token object.

      • token (string): The temporary token value.

      • token_type (string): The type of the token.

      • expiresIn (number): The expiration time of the token in seconds.

Authorizations
Body
objectOptionalExample: {"email":"mail@example.com"}
Responses
200
OK
application/json
Responseobject
post
POST /v1/auth/password/reset HTTP/1.1
Host: {{baseurl}}
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 28

{
  "email": "mail@example.com"
}
200

OK

{
  "status": "success",
  "message": "Password reset email sent",
  "data": {
    "tempToken": {
      "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3Zjg2ODNlZTVkY2Q5MzYzZmQwYTk3YiIsImlhdCI6MTc0NDMzNTcyNCwiZXhwIjoxNzQ0MzM3ODI2fQ.uxrQIZ5jfLM-WmL3Hz0ydUnLTAybVpqX1oMcJvRoRgkV8MNeAsYFvG-tIuBSHXwqfI3sK_aDCCfhW2Pk8kcq0a1pyzyB-r6XyZh8H-HPK7phU-tvD2iMDjHqUdyksZZeoSG4iGUXyG3lrm8cqqt6idMYjwMmoXwYlRue5f3VIpEzaqkQUasge6JImG5tfo_8l2Tl_ZzrzRdCGhFh-VV7AVAyFAuGLetb5jKymluS4JteWcwiEE3fKd8mR8Lh41kLEmf9n6JbkwwGmn_miLedF2xckizsLgXOUI79Vd1oE_uBT_SpcjaZCyJ-3lRrH3t0tfltXDp2pnZmFHtcqiX-Lw",
      "token_type": "jwt",
      "expiresIn": 1744337826000
    }
  }
}

Verify Password Reset Code

post

Validates a verification token during the password reset or account recovery process.

Request

The request requires a JSON body with the following fields:

  • token: A 6-digit verification code sent to the user's email or phone

  • tempToken: A temporary JWT authentication token provided after initiating the password reset process

Response

The response contains the following structure:

  • status: Indicates if the verification token validation was successful

  • message: A brief message confirming the success of the validation

  • data: Null, as no additional data is returned for this operation

This endpoint serves as an intermediate step in the password reset flow, validating that the user has access to their registered email or phone number by confirming receipt of the verification code. The successful validation indicates that the provided verification token matches the expected value and the temporary token is still valid.

After successful validation through this endpoint, the user would typically proceed to the next step in the flow, such as setting a new password via a separate endpoint. This validation step adds an additional layer of security to ensure that only authorized users can complete the password reset process.

Authorizations
Body
objectOptionalExample: {"token":"174221","tempToken":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY4MGI4ZjViMDMxMjdhNGZkNzExMGUzOCIsImlhdCI6MTc0NTkyOTg0MCwiZXhwIjoxNzQ1OTMxOTQyfQ.l2Psi5J-e2PM5598Z81TkhjCz67Eba4CGyIjWUR8H7mXPIZb-DrO2jyoIECW2h6ZlodnU8Pn9i3fyWTMj6gHJoudw9OllQHjtNX7cLc8XiI4x2knkYnjT80CyxbDFmz09p9Zxs7JkoGHNWZQBfY_UWvdeNd0jhvN0tyaPIz4SlX-zXFN7CJgltsOh7mOU-8v_6vu2r7HXNc3je2tuwYuyWVP8W-c_1IFSM7UqMvLKcAoQzUvlRX7XWX2qii7S1FjWLafK6rBhAn6dHyf9slQvpEa0wJ5KJ4VVPm9XIh19YKjNS8EjFJsuDlOu5fq4lJokhKbtMD68QLTNUw4US8iEA"}
Responses
200
OK
application/json
Responseobject
post
POST /v1/auth/validate/password HTTP/1.1
Host: {{baseurl}}
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 503

{
  "token": "174221",
  "tempToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY4MGI4ZjViMDMxMjdhNGZkNzExMGUzOCIsImlhdCI6MTc0NTkyOTg0MCwiZXhwIjoxNzQ1OTMxOTQyfQ.l2Psi5J-e2PM5598Z81TkhjCz67Eba4CGyIjWUR8H7mXPIZb-DrO2jyoIECW2h6ZlodnU8Pn9i3fyWTMj6gHJoudw9OllQHjtNX7cLc8XiI4x2knkYnjT80CyxbDFmz09p9Zxs7JkoGHNWZQBfY_UWvdeNd0jhvN0tyaPIz4SlX-zXFN7CJgltsOh7mOU-8v_6vu2r7HXNc3je2tuwYuyWVP8W-c_1IFSM7UqMvLKcAoQzUvlRX7XWX2qii7S1FjWLafK6rBhAn6dHyf9slQvpEa0wJ5KJ4VVPm9XIh19YKjNS8EjFJsuDlOu5fq4lJokhKbtMD68QLTNUw4US8iEA"
}
200

OK

{
  "status": "success",
  "message": "Success",
  "data": null
}

Complete Password Reset

post

Changes a user's password using a verification token and temporary authentication token.

Request

The request requires a JSON body with the following fields:

  • token: A 6-digit verification code sent to the user's email or phone

  • tempToken: A temporary JWT authentication token provided after initiating the password change process

  • password: The new password that meets the system's password requirements

Response

The response contains the following structure:

  • status: Indicates if the password change operation was successful

  • message: A descriptive message confirming the password was successfully changed

  • data: An empty object, as no additional data is returned for this operation

The successful response indicates that the provided verification token was valid, the temporary token had not expired, and the new password met the system's requirements. After this operation, the user will need to use their new password for future authentication attempts.

The password change process is part of a secure two-factor authentication flow that requires both possession of the temporary token (received after initiating the password change request) and knowledge of the verification code (sent to the user's verified contact method).

Authorizations
Body
objectOptionalExample: {"token":"284818","tempToken":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3Zjg2ODNlZTVkY2Q5MzYzZmQwYTk3YiIsImlhdCI6MTc0NDMzNTcyNCwiZXhwIjoxNzQ0MzM3ODI2fQ.uxrQIZ5jfLM-WmL3Hz0ydUnLTAybVpqX1oMcJvRoRgkV8MNeAsYFvG-tIuBSHXwqfI3sK_aDCCfhW2Pk8kcq0a1pyzyB-r6XyZh8H-HPK7phU-tvD2iMDjHqUdyksZZeoSG4iGUXyG3lrm8cqqt6idMYjwMmoXwYlRue5f3VIpEzaqkQUasge6JImG5tfo_8l2Tl_ZzrzRdCGhFh-VV7AVAyFAuGLetb5jKymluS4JteWcwiEE3fKd8mR8Lh41kLEmf9n6JbkwwGmn_miLedF2xckizsLgXOUI79Vd1oE_uBT_SpcjaZCyJ-3lRrH3t0tfltXDp2pnZmFHtcqiX-Lw","password":"1234@Abcd"}
Responses
200
OK
text/plain
Responsestring
post
POST /v1/auth/password/change HTTP/1.1
Host: {{baseurl}}
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 526

{
  "token": "284818",
  "tempToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3Zjg2ODNlZTVkY2Q5MzYzZmQwYTk3YiIsImlhdCI6MTc0NDMzNTcyNCwiZXhwIjoxNzQ0MzM3ODI2fQ.uxrQIZ5jfLM-WmL3Hz0ydUnLTAybVpqX1oMcJvRoRgkV8MNeAsYFvG-tIuBSHXwqfI3sK_aDCCfhW2Pk8kcq0a1pyzyB-r6XyZh8H-HPK7phU-tvD2iMDjHqUdyksZZeoSG4iGUXyG3lrm8cqqt6idMYjwMmoXwYlRue5f3VIpEzaqkQUasge6JImG5tfo_8l2Tl_ZzrzRdCGhFh-VV7AVAyFAuGLetb5jKymluS4JteWcwiEE3fKd8mR8Lh41kLEmf9n6JbkwwGmn_miLedF2xckizsLgXOUI79Vd1oE_uBT_SpcjaZCyJ-3lRrH3t0tfltXDp2pnZmFHtcqiX-Lw",
  "password": "1234@Abcd"
}
200

OK

{
    "status": "success",
    "message": "Password Changed Successfully",
    "data": {}
}