Appearance
Auth - User
Base URL:
https://your-domain.com
Authentication endpoints for Admin/Staff/Reseller users.
Login
Authenticate a user (Admin/Staff/Reseller) and receive an access token for API access.
| Property | Value |
|---|---|
| Endpoint | User Login |
| Method | POST |
| URL | /api/v1/auth/login |
| Authentication | Not Required |
Request Headers:
| Header | Value | Required |
|---|---|---|
Content-Type | application/json | Yes |
Accept | application/json | Yes |
Request Body:
json
{
"email": "[email protected]",
"password": "your-password"
}| Parameter | Type | Required | Description |
|---|---|---|---|
email | string | Yes | User's email address |
password | string | Yes | User's password |
Success Response (200 OK):
json
{
"success": true,
"message": "Login successful",
"data": {
"user": {
"id": 1,
"name": "Admin User",
"email": "[email protected]",
"role": "admin"
},
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"token_type": "bearer",
"expires_in": 3600
}
}Error Response (401 Unauthorized):
json
{
"success": false,
"message": "Invalid credentials"
}Error Response (422 Validation Error):
json
{
"success": false,
"message": "Validation failed",
"errors": {
"email": ["The email field is required."],
"password": ["The password field is required."]
}
}Logout
Invalidate the current access token and end the user session.
| Property | Value |
|---|---|
| Endpoint | User Logout |
| Method | POST |
| URL | /api/v1/auth/logout |
| Authentication | Bearer Token |
Request Headers:
| Header | Value | Required |
|---|---|---|
Accept | application/json | Yes |
Authorization | Bearer your-auth-token | Yes |
Request Body: None
Success Response (200 OK):
json
{
"success": true,
"message": "Successfully logged out"
}Error Response (401 Unauthorized):
json
{
"success": false,
"message": "Unauthenticated"
}Me (Get Current User)
Retrieve the authenticated user's profile information including permissions and role.
| Property | Value |
|---|---|
| Endpoint | Get Current User |
| Method | GET |
| URL | /api/v1/auth/me |
| Authentication | Bearer Token |
Request Headers:
| Header | Value | Required |
|---|---|---|
Accept | application/json | Yes |
Authorization | Bearer your-auth-token | Yes |
Request Body: None
Success Response (200 OK):
json
{
"success": true,
"data": {
"id": 1,
"name": "Admin User",
"email": "[email protected]",
"phone": "01712345678",
"role": "admin",
"isp_id": 1,
"branch_id": 1,
"permissions": ["subscribers.view", "subscribers.create", "packages.view"]
}
}Error Response (401 Unauthorized):
json
{
"success": false,
"message": "Unauthenticated"
}Refresh Token
Refresh the access token to extend the session without re-authentication.
| Property | Value |
|---|---|
| Endpoint | Refresh Token |
| Method | POST |
| URL | /api/v1/auth/refresh |
| Authentication | Bearer Token |
Request Headers:
| Header | Value | Required |
|---|---|---|
Accept | application/json | Yes |
Authorization | Bearer your-auth-token | Yes |
Request Body: None
Success Response (200 OK):
json
{
"success": true,
"data": {
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"token_type": "bearer",
"expires_in": 3600
}
}Error Response (401 Unauthorized):
json
{
"success": false,
"message": "Token has expired and cannot be refreshed"
}