Auth
Barcha endpointlar Bearer authorization bilan himoyalangan. Barcha ma'lumotlar json formatida almashiniladi.
Barcha requestlar uchun quyidagi header lar majburiy hisoblanadi:
http
Accept: application/json
Content-Type: application/jsonLogin
Auth uchun tokenni olish
Endpoint
POST /auth/login
Request:
Form
| Field | Type | Required | Description |
|---|---|---|---|
email | Yes | Unique user identifier | |
password | string | Yes | Password |
Example
json
{
"email": "example_email@gmail.com",
"password": "my_password"
}Response:
| Field | Type | Description |
|---|---|---|
status | string | Statussuccess yoki error |
code | int | Response http kodi |
result | object | Asosiy ma'lumotlar |
result.access_token | string | Access token |
message | string | Umumiy xabar |
Example
json
{
"status": "success",
"code": 200,
"result": {
"access_token": "1|i5poMifK2y0Sd1Wf8TVKeLVRjJKR8RyPb92YUbKH61170f51"
},
"message": "User successfully authenticated"
}Ehtiyot bo'ling!
access_token avtomatik expire bo'lmaydi (muddati cheklanmagan). Uni faolsizlantirish uchun logout qilish talab qilinadi.
Me
User ma'lumotlarni olish
Endpoint
GET /auth/me
Response:
| Field | Type | Description |
|---|---|---|
status | string | Statussuccess yoki error |
code | int | Response http kodi |
result | AuthUserResource | AuthUserResource |
message | string | Umumiy xabar |
Example
json
{
"status": "success",
"code": 200,
"result": {
"id": 1,
"name": "Dev",
"email": "dev@utel.uz",
"type": {
"number": 2,
"name": "USER"
},
"created_at": "2025-11-28T07:02:52.000000Z"
},
"message": "User successfully retrieved"
}Change password
User parolini o'zgartirish
Endpoint
POST /auth/change-password
Request:
Form
| Field | Type | Required | Description |
|---|---|---|---|
old_password | string | yes | Oldingi parol |
password | string | yes | min 6 belgi |
password_confirmation | string | yes | password ga mos bo'lishi kerak |
Example
json
{
"old_password": "old_password",
"password": "new_password",
"password_confirmation": "new_password"
}Response:
| Field | Type | Description |
|---|---|---|
status | string | Statussuccess yoki error |
code | int | Response http kodi |
result | object | Asosiy ma'lumotlar |
result.access_token | string | Access token |
message | string | Umumiy xabar |
Example
json
{
"status": "success",
"code": 200,
"result": {
"access_token": "2|i5poMifK2y0Sd1Wf8TVKeLVRjJKR8RyPb92YUbKH61170f51"
},
"message": "Password successfully updated"
}Logout
access_token ni faolsizlantirish yoki o'chirish
Endpoint
POST /auth/logout
Response:
| Field | Type | Description |
|---|---|---|
status | string | Statussuccess yoki error |
code | int | Response http kodi |
result | array | Empty array |
message | string | Umumiy xabar |
Example
json
{
"status": "success",
"code": 200,
"result": [],
"message": "User unauthenticated"
}