Skip to main content
The Payroll Service API uses bearer token authentication. All authenticated endpoints expect a bearer token in the Authorization header.

Getting Started

To use the API, you’ll need to:
  1. Register a new user account or login with existing credentials
  2. Use the returned access token in subsequent requests
  3. Include the token in your Authorization header

Bearer Token

Include the access token in the Authorization header of your requests:
Authorization: Bearer your_access_token_here

Available Endpoints

Register

Create a new user account.
curl -X POST https://api.paystub.dev/auth/register \
-H "Content-Type: application/json" \
-d '{
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"password": "your_password",
"password_confirmation": "your_password"
}'

Login

Authenticate an existing user.
curl -X POST https://api.paystub.dev/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "your_password"
}'

Logout

Invalidate the current access token.
curl -X POST https://api.paystub.dev/auth/logout \
-H "Authorization: Bearer your_token_here"

User Profile

Get the authenticated user’s details.
curl https://api.paystub.dev/auth/me \
-H "Authorization: Bearer your_token_here"

Password Reset

The API provides endpoints for password reset functionality:
  1. /auth/forgot-password - Request a password reset link
  2. /auth/reset-password - Reset password using the token from email

Token Expiration

Access tokens expire after 24 hours. Use the refresh token endpoint to obtain a new token:
curl -X POST https://api.paystub.dev/auth/refresh \
-H "Authorization: Bearer your_token_here"

Error Handling

Common authentication errors include:
  • 401 Unauthenticated - Invalid or expired token
  • 422 Validation Error - Invalid input data
  • 429 Too Many Attempts - Rate limit exceeded