Skip to main content
POST
https://api.bunship.com
/
api
/
v1
/
auth
/
login
Login
curl --request POST \
  --url https://api.bunship.com/api/v1/auth/login \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "email": "<string>",
  "password": "<string>",
  "twoFactorCode": "<string>"
}
'
{
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expiresIn": 900,
  "user": {
    "id": "usr_cld2abc123def456",
    "email": "[email protected]",
    "fullName": "John Doe"
  }
}
Authenticates a user with email and password credentials. Returns JWT access and refresh tokens on success. If the account has two-factor authentication enabled, the twoFactorCode field is required.

Auth

None required.

Rate Limit

20 requests per minute per IP.

Request Body

email
string
required
User email address.
password
string
required
User password.
twoFactorCode
string
6-digit TOTP code from an authenticator app. Required only if 2FA is enabled on the account.

Response

accessToken
string
JWT access token. Expires in 15 minutes.
refreshToken
string
JWT refresh token. Expires in 7 days. Use this to obtain new token pairs.
expiresIn
number
Access token expiry in seconds (900).
user
object
Authenticated user profile object.
{
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expiresIn": 900,
  "user": {
    "id": "usr_cld2abc123def456",
    "email": "[email protected]",
    "fullName": "John Doe"
  }
}

Errors

StatusCodeDescription
401AUTHENTICATION_ERRORInvalid email or password, or missing 2FA code when required
{
  "success": false,
  "error": {
    "code": "AUTHENTICATION_ERROR",
    "message": "Invalid email or password"
  }
}

Example

curl -X POST https://api.bunship.com/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "SecureP@ssw0rd"
  }'
With 2FA:
curl -X POST https://api.bunship.com/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "SecureP@ssw0rd",
    "twoFactorCode": "123456"
  }'