Request
curl --location 'api.onlyup.ir/api/v1/auth/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"identifier": "r.rahiminia1@gmail.com",
"password": "Reza12345678"
}'
Response
{
"statusCode": 200,
"message": "User logged in succesfully",
"data": {
"user": {
"user_id": 7,
"name": "ramin",
"username": "rahiminia1",
"email": "r.rahiminia1@gmail.com",
"created_at": "2025-07-13T10:54:22.000Z",
"deleted_at": null
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjcsImlhdCI6MTc1NTk0MTM1NSwiZXhwIjoxNzg3NDc3MzU1fQ.13t1cydpD80PRK4CGa2ij6l_Oe9NLgdhgGf94_Ouq-E"
}
}
Parameters
| Name | Type | Required | Description |
|---|
| identifier | string | Yes | User's email or username |
| password | string | Yes | User's password |
| token | string | No | JWT token for authenticated requests |
Response Fields
| Name | Type | Description |
|---|
| statusCode | number | HTTP status code of the response |
| message | string | Message indicating the result of the login attempt |
| data | object | Contains user information and token |
| user | object | Contains user details |
| user_id | number | Unique identifier for the user |
| name | string | User's full name |
| username | string | User's username |
| email | string | User's email address |
| created_at | string | Timestamp of when the user was created |
| deleted_at | string | Timestamp of when the user was deleted (null if not deleted) |
| token | string | JWT token for authenticated requests |
Responses
| Code | Description |
|---|
| 200 | User logged in successfully |
| 400 | Bad request, invalid credentials |
| 401 | Unauthorized, invalid credentials |
| 404 | Not found, user does not exist |
Notes
- The
identifier can be either the user's email or username.
- The
token returned in the response is a JWT (JSON Web Token) that must be included in the headers of subsequent API requests to access protected resources.
- The token has an expiration time, after which it must be renewed by logging in again.
- Ensure that the password is stored securely and not logged or exposed in any way.
- Always use HTTPS to protect sensitive information during transmission.