Auth Login

Overview

The merchant login process authenticates your credentials and provides an access token that you'll use for all subsequent API requests. The login endpoint is specifically designed for merchants and differs from the admin login endpoint.


Login Endpoint

Base URL

POST /api/v2/auth/login

Full Endpoint Example

https://api.switchwallet.com/api/v2/auth/login

Request

Headers

Content-Type: application/json

Request Body

{
  "email": "[email protected]",
  "password": "YourPassword123!"
}

Field Descriptions

Field
Type
Required
Description

email

string

Yes

Your registered merchant email address

password

string

Yes

Your account password


Example Requests

cURL

JavaScript/Node.js

Python

PHP


Success Response

HTTP Status: 200 OK

Response Fields

Field
Type
Description

isSuccessful

boolean

Indicates if the login was successful

httpStatusCode

number

HTTP status code (200 for success)

message

string

Success message

data.token

string

Access token - Use this in the Authorization header for API requests

data.refreshToken

string

Token used to refresh your access token when it expires

data.expiresAtTimestamp

number

Unix timestamp (milliseconds) when the token expires

data.email

string

Your registered email address

data.businessName

string

Your business name

roles

array

Array of user roles (e.g., ["Merchant"])


Error Responses

Invalid Credentials

HTTP Status: 400 Bad Request

Common Causes:

  • Incorrect email address

  • Incorrect password

  • Email address not registered



Using Your Access Token

After successful login, include the token in all subsequent API requests using the Authorization header:

Format

Example Request with Token

JavaScript Example


Token Refresh

When your access token expires, use the refresh token to obtain a new access token.

Refresh Token Endpoint

Example

Response


Complete Login Flow Example

JavaScript/Node.js


Troubleshooting

Invalid Login Credentials

Problem: You're getting "Invalid Login Credentials" error.

Solutions:

  • Verify your email address is correct (check for typos)

  • Ensure your password is correct

  • Make sure you're using the email you registered with

  • Try resetting your password if you've forgotten it

Password Reset

If you've forgotten your password:

  1. Request a password reset OTP: POST /api/v2/auth/password-reset/otp

  2. Complete password reset: POST /api/v2/auth/password-reset

KYC/KYB Status Issues

Problem: Login is blocked due to KYC/KYB status.

Solutions:

  • UnVerified: Complete your Know Your Business (KYB) verification

  • Initiated/InProgress: Wait for verification to complete

  • Rejected: Review the rejection reason and resubmit your KYB documents

Note: Sandbox accounts typically don't require KYC verification.

Token Expired

Problem: Your API requests are returning 401 Unauthorized.

Solutions:

  • Use the refresh token endpoint to get a new access token

  • If refresh token also expired, log in again to get new tokens

Email Not Found

Problem: Getting "Invalid Login Credentials" but email seems correct.

Solutions:

  • Confirm you registered as a merchant (not admin)

  • Check if you completed the registration process

  • Contact support if you believe your account should exist


Security Best Practices

  1. Never Share Your Credentials

    • Keep your email and password secure

    • Don't commit tokens to version control

    • Use environment variables for credentials

  2. Token Storage

    • Store tokens securely (environment variables, secure storage)

    • Don't log tokens in console or files

    • Implement token refresh logic

  3. HTTPS Only

    • Always use HTTPS endpoints

    • Never send credentials over unencrypted connections

  4. Token Expiration

    • Monitor token expiration times

    • Implement automatic token refresh

    • Re-authenticate when refresh tokens expire


Merchant Login vs Admin Login

Important: This guide is for merchant login only.

  • Merchant Login: POST /api/v2/auth/login (this guide)

  • Admin Login: POST /api/v2/auth/admin/login (different endpoint, not covered here)

The merchant login endpoint:

  • Requires a merchant account (not admin account)

  • Validates merchant KYC/KYB status

  • Returns merchant-specific data

  • Has different authorization requirements


Next Steps After Login

Once you've successfully logged in:

  1. Store Your Token - Save the access token for API requests

  2. Check Wallet Status - Verify your wallet addresses are available

  3. Review Account Settings - Check your merchant profile

  4. Explore API Endpoints - Start making authenticated API calls

  5. Set Up Webhooks - Configure payment notifications


API Reference Summary

Endpoint
Method
Description

/api/v2/auth/login

POST

Merchant login

/api/v2/auth/refreshToken

GET

Refresh access token

/api/v2/auth/password-reset/otp

POST

Request password reset OTP

/api/v2/auth/password-reset

POST

Complete password reset


Support

For additional help:

  • Documentation: https://docs.switchwallet.com

  • API Status: https://status.switchwallet.com


Last Updated: November 2025

Last updated