Skip to content

Authentication API

User authentication endpoints.

Register

Create a new user account.

http
POST /api/v1/auth/register

Request

json
{
  "email": "user@example.com",
  "password": "SecureP@ss123",
  "first_name": "John",
  "last_name": "Doe",
  "organization_name": "Example Corp"
}

Response (201 Created)

json
{
  "success": true,
  "data": {
    "user": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "email": "user@example.com",
      "first_name": "John",
      "last_name": "Doe"
    },
    "access_token": "eyJhbGciOiJIUzI1NiIs...",
    "refresh_token": "eyJhbGciOiJIUzI1NiIs...",
    "expires_in": 900
  }
}

Login

Authenticate and receive tokens.

http
POST /api/v1/auth/login

Request

json
{
  "email": "user@example.com",
  "password": "SecureP@ss123"
}

Response (200 OK)

json
{
  "success": true,
  "data": {
    "user": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "email": "user@example.com",
      "first_name": "John",
      "last_name": "Doe",
      "role": "admin",
      "organization": {
        "id": "org-uuid",
        "name": "Example Corp"
      }
    },
    "access_token": "eyJhbGciOiJIUzI1NiIs...",
    "refresh_token": "eyJhbGciOiJIUzI1NiIs...",
    "expires_in": 900
  }
}

Error Response (401 Unauthorized)

json
{
  "success": false,
  "error": {
    "code": "INVALID_CREDENTIALS",
    "message": "Invalid email or password"
  }
}

Refresh Token

Get a new access token using refresh token.

http
POST /api/v1/auth/refresh

Request

json
{
  "refresh_token": "eyJhbGciOiJIUzI1NiIs..."
}

Response (200 OK)

json
{
  "success": true,
  "data": {
    "access_token": "eyJhbGciOiJIUzI1NiIs...",
    "refresh_token": "eyJhbGciOiJIUzI1NiIs...",
    "expires_in": 900
  }
}

Logout

Invalidate current session.

http
POST /api/v1/auth/logout
Authorization: Bearer <access_token>

Response (200 OK)

json
{
  "success": true,
  "data": {
    "message": "Successfully logged out"
  }
}

Get Current User

Get authenticated user profile.

http
GET /api/v1/auth/me
Authorization: Bearer <access_token>

Response (200 OK)

json
{
  "success": true,
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "email": "user@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "role": "admin",
    "email_verified": true,
    "organization": {
      "id": "org-uuid",
      "name": "Example Corp",
      "plan": "pro"
    },
    "created_at": "2026-01-01T00:00:00Z"
  }
}

Password Reset Request

Request password reset email.

http
POST /api/v1/auth/password/forgot

Request

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

Response (200 OK)

json
{
  "success": true,
  "data": {
    "message": "Password reset email sent"
  }
}

Password Reset

Reset password with token.

http
POST /api/v1/auth/password/reset

Request

json
{
  "token": "reset-token-from-email",
  "password": "NewSecureP@ss123",
  "password_confirmation": "NewSecureP@ss123"
}

Response (200 OK)

json
{
  "success": true,
  "data": {
    "message": "Password successfully reset"
  }
}

Token Expiration

Token TypeExpiration
Access Token15 minutes
Refresh Token7 days
Reset Token1 hour

Error Codes

CodeDescription
INVALID_CREDENTIALSWrong email or password
EMAIL_NOT_VERIFIEDEmail verification required
ACCOUNT_LOCKEDToo many failed attempts
TOKEN_EXPIREDJWT token has expired
TOKEN_INVALIDJWT token is invalid

GSign Digital Signature Platform