MENU navbar-image

Giới thiệu

Tài liệu mô tả các endpoint API của hệ thống.

Tài liệu này mô tả toàn bộ endpoint API hiện có.

Xác thực sử dụng Bearer token (Laravel Sanctum).

Xác thực request

Để xác thực, gửi header Authorization với giá trị "Bearer {TOKEN}".

Tất cả endpoint cần xác thực sẽ có nhãn requires authentication trong tài liệu bên dưới.

Lấy token qua POST /api/v1/auth/login, sau đó gửi header Authorization: Bearer <token>.

Cài đặt

Công khai

Danh sách setting công khai

Ví dụ request:
curl --request GET \
    --get "http://laravel-core.test/api/v1/settings/public" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://laravel-core.test/api/v1/settings/public"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Yêu cầu      

GET api/v1/settings/public

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Quản trị

Danh sách tất cả setting

requires authentication

Ví dụ request:
curl --request GET \
    --get "http://laravel-core.test/api/v1/settings" \
    --header "Authorization: Bearer {TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://laravel-core.test/api/v1/settings"
);

const headers = {
    "Authorization": "Bearer {TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Yêu cầu      

GET api/v1/settings

Header

Authorization        

Example: Bearer {TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Upsert settings (bulk)

requires authentication

Ví dụ request:
curl --request PUT \
    "http://laravel-core.test/api/v1/settings" \
    --header "Authorization: Bearer {TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"items\": [
        {
            \"key\": \"site_name\",
            \"value\": \"Core API\",
            \"group\": \"general\",
            \"is_public\": true,
            \"description\": \"Tên website\"
        }
    ]
}"
const url = new URL(
    "http://laravel-core.test/api/v1/settings"
);

const headers = {
    "Authorization": "Bearer {TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "items": [
        {
            "key": "site_name",
            "value": "Core API",
            "group": "general",
            "is_public": true,
            "description": "Tên website"
        }
    ]
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Yêu cầu      

PUT api/v1/settings

Header

Authorization        

Example: Bearer {TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số Body

items   object[]     

Danh sách settings cần upsert. Trường value phải có tối thiểu 1 phần tử.

key   string     

Trường value không được lớn hơn 150 ký tự. Example: vmqeopfuudtdsufvyvddq

value   string  optional    
group   string  optional    

Trường value không được lớn hơn 100 ký tự. Example: amniihfqcoynlazghdtqt

is_public   boolean  optional    

Example: false

description   string  optional    

Trường value không được lớn hơn 255 ký tự. Example: Necessitatibus architecto aut consequatur debitis et id.

Hàng đợi

Thống kê queue

Ví dụ request:
curl --request GET \
    --get "http://laravel-core.test/api/v1/settings/queue/stats" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://laravel-core.test/api/v1/settings/queue/stats"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Yêu cầu      

GET api/v1/settings/queue/stats

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Danh sách job (jobs)

Ví dụ request:
curl --request GET \
    --get "http://laravel-core.test/api/v1/settings/queue/jobs?sort=-id&page=1&per_page=20" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://laravel-core.test/api/v1/settings/queue/jobs"
);

const params = {
    "sort": "-id",
    "page": "1",
    "per_page": "20",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Yêu cầu      

GET api/v1/settings/queue/jobs

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số Query

filters   object  optional    
filter   object  optional    
sort   string  optional    

Sắp xếp. Mặc định -id. Example: -id

page   integer  optional    

Trang hiện tại. Trường value phải tối thiểu 1. Example: 1

per_page   integer  optional    

Số item mỗi trang. Trường value phải tối thiểu 1. Example: 20

Chi tiết job

Ví dụ request:
curl --request GET \
    --get "http://laravel-core.test/api/v1/settings/queue/jobs/1562" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://laravel-core.test/api/v1/settings/queue/jobs/1562"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Yêu cầu      

GET api/v1/settings/queue/jobs/{id}

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số URL

id   string     

The ID of the job. Example: 1562

Danh sách failed jobs

Ví dụ request:
curl --request GET \
    --get "http://laravel-core.test/api/v1/settings/queue/failed-jobs?sort=-id&page=1&per_page=20" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://laravel-core.test/api/v1/settings/queue/failed-jobs"
);

const params = {
    "sort": "-id",
    "page": "1",
    "per_page": "20",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Yêu cầu      

GET api/v1/settings/queue/failed-jobs

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số Query

filters   object  optional    
filter   object  optional    
sort   string  optional    

Sắp xếp. Mặc định -id. Example: -id

page   integer  optional    

Trang hiện tại. Trường value phải tối thiểu 1. Example: 1

per_page   integer  optional    

Số item mỗi trang. Trường value phải tối thiểu 1. Example: 20

Chi tiết failed job

Ví dụ request:
curl --request GET \
    --get "http://laravel-core.test/api/v1/settings/queue/failed-jobs/1562" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://laravel-core.test/api/v1/settings/queue/failed-jobs/1562"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Yêu cầu      

GET api/v1/settings/queue/failed-jobs/{id}

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số URL

id   string     

The ID of the failed job. Example: 1562

Retry failed job

Ví dụ request:
curl --request POST \
    "http://laravel-core.test/api/v1/settings/queue/failed-jobs/1562/retry" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://laravel-core.test/api/v1/settings/queue/failed-jobs/1562/retry"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Yêu cầu      

POST api/v1/settings/queue/failed-jobs/{id}/retry

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số URL

id   string     

The ID of the failed job. Example: 1562

Xoá failed job khỏi failed_jobs

Ví dụ request:
curl --request DELETE \
    "http://laravel-core.test/api/v1/settings/queue/failed-jobs/1562" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://laravel-core.test/api/v1/settings/queue/failed-jobs/1562"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Yêu cầu      

DELETE api/v1/settings/queue/failed-jobs/{id}

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số URL

id   string     

The ID of the failed job. Example: 1562

Danh sách job batches

Ví dụ request:
curl --request GET \
    --get "http://laravel-core.test/api/v1/settings/queue/batches?sort=-created_at&page=1&per_page=20" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://laravel-core.test/api/v1/settings/queue/batches"
);

const params = {
    "sort": "-created_at",
    "page": "1",
    "per_page": "20",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Yêu cầu      

GET api/v1/settings/queue/batches

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số Query

filters   object  optional    
filter   object  optional    
sort   string  optional    

Sắp xếp. Mặc định -created_at. Example: -created_at

page   integer  optional    

Trang hiện tại. Trường value phải tối thiểu 1. Example: 1

per_page   integer  optional    

Số item mỗi trang. Trường value phải tối thiểu 1. Example: 20

Chi tiết batch

Ví dụ request:
curl --request GET \
    --get "http://laravel-core.test/api/v1/settings/queue/batches/consequatur" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://laravel-core.test/api/v1/settings/queue/batches/consequatur"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Yêu cầu      

GET api/v1/settings/queue/batches/{id}

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số URL

id   string     

The ID of the batch. Example: consequatur

Theo key

Lấy setting theo key

Nếu setting là public: không cần đăng nhập. Nếu setting không public: yêu cầu user_type là ADMIN hoặc SYSTEM.

Ví dụ request:
curl --request GET \
    --get "http://laravel-core.test/api/v1/settings/!public$)!queue$^//^" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://laravel-core.test/api/v1/settings/!public$)!queue$^//^"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Yêu cầu      

GET api/v1/settings/{key}

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số URL

key   string     

Example: !public$)!queue$^//^

Tài khoản

Quản trị

Danh sách tài khoản

Hỗ trợ query:

Ví dụ request:
curl --request GET \
    --get "http://laravel-core.test/api/v1/users?include=consequatur&sort=-id&page=1&per_page=20" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://laravel-core.test/api/v1/users"
);

const params = {
    "include": "consequatur",
    "sort": "-id",
    "page": "1",
    "per_page": "20",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Yêu cầu      

GET api/v1/users

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số Query

filters   object  optional    
filter   object  optional    
include   string  optional    

Example: consequatur

sort   string  optional    

Sắp xếp. Ví dụ: "-id" (mặc định nếu bỏ trống), "-created_at,name". Example: -id

page   integer  optional    

Trang hiện tại. Trường value phải tối thiểu 1. Example: 1

per_page   integer  optional    

Số item mỗi trang (giới hạn theo CORE_API_MAX_PER_PAGE). Trường value phải tối thiểu 1. Example: 20

Chi tiết tài khoản

Ví dụ request:
curl --request GET \
    --get "http://laravel-core.test/api/v1/users/1562" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://laravel-core.test/api/v1/users/1562"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Yêu cầu      

GET api/v1/users/{id}

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số URL

id   string     

The ID of the user. Example: 1562

Tạo tài khoản

Ví dụ request:
curl --request POST \
    "http://laravel-core.test/api/v1/users" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"Demo User\",
    \"email\": \"demo2@example.com\",
    \"password\": \"123456789\",
    \"user_type\": \"USER\",
    \"phone\": \"0986420994\",
    \"avatar_url\": \"http:\\/\\/kunze.biz\\/iste-laborum-eius-est-dolor.html\",
    \"date_of_birth\": \"2026-03-18T07:06:46\",
    \"gender\": \"dtdsufvyvddqamnii\",
    \"address_line1\": \"hfqcoynlazghdtqtqxbaj\",
    \"address_line2\": \"wbpilpmufinllwloauydl\",
    \"ward\": \"smsjuryvojcybzvrbyick\",
    \"district\": \"znkygloigmkwxphlvazjr\",
    \"province\": \"HCM\",
    \"country\": \"cn\",
    \"postal_code\": \"fbaqywuxhgjjmzuxj\",
    \"company\": \"ubqouzswiwxtrkimfcatb\",
    \"job_title\": \"xspzmrazsroyjpxmqesed\",
    \"timezone\": \"Pacific\\/Guam\",
    \"locale\": \"en_MP\",
    \"bio\": \"consequatur\"
}"
const url = new URL(
    "http://laravel-core.test/api/v1/users"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "Demo User",
    "email": "demo2@example.com",
    "password": "123456789",
    "user_type": "USER",
    "phone": "0986420994",
    "avatar_url": "http:\/\/kunze.biz\/iste-laborum-eius-est-dolor.html",
    "date_of_birth": "2026-03-18T07:06:46",
    "gender": "dtdsufvyvddqamnii",
    "address_line1": "hfqcoynlazghdtqtqxbaj",
    "address_line2": "wbpilpmufinllwloauydl",
    "ward": "smsjuryvojcybzvrbyick",
    "district": "znkygloigmkwxphlvazjr",
    "province": "HCM",
    "country": "cn",
    "postal_code": "fbaqywuxhgjjmzuxj",
    "company": "ubqouzswiwxtrkimfcatb",
    "job_title": "xspzmrazsroyjpxmqesed",
    "timezone": "Pacific\/Guam",
    "locale": "en_MP",
    "bio": "consequatur"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Yêu cầu      

POST api/v1/users

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số Body

name   string     

Tên hiển thị của tài khoản. Trường value không được lớn hơn 255 ký tự. Example: Demo User

email   string     

Email (duy nhất). Trường value phải là địa chỉ email hợp lệ. Trường value không được lớn hơn 255 ký tự. Example: demo2@example.com

password   string     

Mật khẩu (tối thiểu 8 ký tự). Trường value phải tối thiểu 8 ký tự. Trường value không được lớn hơn 255 ký tự. Example: 123456789

user_type   string  optional    

Loại tài khoản (ADMIN|USER|SYSTEM). Example: USER

Must be one of:
  • ADMIN
  • USER
  • SYSTEM
phone   string  optional    

Số điện thoại. Trường value không được lớn hơn 30 ký tự. Example: 0986420994

avatar_url   string  optional    

Must be a valid URL. Example: http://kunze.biz/iste-laborum-eius-est-dolor.html

date_of_birth   string  optional    

Trường value không phải là ngày hợp lệ. Example: 2026-03-18T07:06:46

gender   string  optional    

Trường value không được lớn hơn 20 ký tự. Example: dtdsufvyvddqamnii

address_line1   string  optional    

Trường value không được lớn hơn 255 ký tự. Example: hfqcoynlazghdtqtqxbaj

address_line2   string  optional    

Trường value không được lớn hơn 255 ký tự. Example: wbpilpmufinllwloauydl

ward   string  optional    

Trường value không được lớn hơn 255 ký tự. Example: smsjuryvojcybzvrbyick

district   string  optional    

Trường value không được lớn hơn 255 ký tự. Example: znkygloigmkwxphlvazjr

province   string  optional    

Tỉnh/Thành. Trường value không được lớn hơn 255 ký tự. Example: HCM

country   string  optional    

Trường value phải có 2 ký tự. Example: cn

postal_code   string  optional    

Trường value không được lớn hơn 20 ký tự. Example: fbaqywuxhgjjmzuxj

company   string  optional    

Trường value không được lớn hơn 255 ký tự. Example: ubqouzswiwxtrkimfcatb

job_title   string  optional    

Trường value không được lớn hơn 255 ký tự. Example: xspzmrazsroyjpxmqesed

timezone   string  optional    

Trường value không được lớn hơn 50 ký tự. Example: Pacific/Guam

locale   string  optional    

Trường value không được lớn hơn 10 ký tự. Example: en_MP

bio   string  optional    

Example: consequatur

Cập nhật tài khoản

Ví dụ request:
curl --request PUT \
    "http://laravel-core.test/api/v1/users/1562" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"Nguyễn Văn A\",
    \"email\": \"demo@example.com\",
    \"user_type\": \"USER\",
    \"phone\": \"0900000000\",
    \"avatar_url\": \"http:\\/\\/kunze.biz\\/iste-laborum-eius-est-dolor.html\",
    \"date_of_birth\": \"2026-03-18T07:06:46\",
    \"gender\": \"dtdsufvyvddqamnii\",
    \"address_line1\": \"hfqcoynlazghdtqtqxbaj\",
    \"address_line2\": \"wbpilpmufinllwloauydl\",
    \"ward\": \"smsjuryvojcybzvrbyick\",
    \"district\": \"znkygloigmkwxphlvazjr\",
    \"province\": \"cnfbaqywuxhgjjmzuxjub\",
    \"country\": \"qo\",
    \"postal_code\": \"uzswiwxtrkimfcatb\",
    \"company\": \"xspzmrazsroyjpxmqesed\",
    \"job_title\": \"yghenqcopwvownkbamlnf\",
    \"timezone\": \"Asia\\/Colombo\",
    \"locale\": \"en_PH\",
    \"bio\": \"Mô tả ngắn về user\"
}"
const url = new URL(
    "http://laravel-core.test/api/v1/users/1562"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "Nguyễn Văn A",
    "email": "demo@example.com",
    "user_type": "USER",
    "phone": "0900000000",
    "avatar_url": "http:\/\/kunze.biz\/iste-laborum-eius-est-dolor.html",
    "date_of_birth": "2026-03-18T07:06:46",
    "gender": "dtdsufvyvddqamnii",
    "address_line1": "hfqcoynlazghdtqtqxbaj",
    "address_line2": "wbpilpmufinllwloauydl",
    "ward": "smsjuryvojcybzvrbyick",
    "district": "znkygloigmkwxphlvazjr",
    "province": "cnfbaqywuxhgjjmzuxjub",
    "country": "qo",
    "postal_code": "uzswiwxtrkimfcatb",
    "company": "xspzmrazsroyjpxmqesed",
    "job_title": "yghenqcopwvownkbamlnf",
    "timezone": "Asia\/Colombo",
    "locale": "en_PH",
    "bio": "Mô tả ngắn về user"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Yêu cầu      

PUT api/v1/users/{id}

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số URL

id   string     

The ID of the user. Example: 1562

Tham số Body

name   string  optional    

Tên hiển thị. Trường value không được lớn hơn 255 ký tự. Example: Nguyễn Văn A

email   string  optional    

Email (duy nhất). Trường value phải là địa chỉ email hợp lệ. Trường value không được lớn hơn 255 ký tự. Example: demo@example.com

user_type   string  optional    

Loại tài khoản (ADMIN|USER|SYSTEM). Example: USER

Must be one of:
  • ADMIN
  • USER
  • SYSTEM
phone   string  optional    

Số điện thoại. Trường value không được lớn hơn 30 ký tự. Example: 0900000000

avatar_url   string  optional    

Must be a valid URL. Example: http://kunze.biz/iste-laborum-eius-est-dolor.html

date_of_birth   string  optional    

Trường value không phải là ngày hợp lệ. Example: 2026-03-18T07:06:46

gender   string  optional    

Trường value không được lớn hơn 20 ký tự. Example: dtdsufvyvddqamnii

address_line1   string  optional    

Trường value không được lớn hơn 255 ký tự. Example: hfqcoynlazghdtqtqxbaj

address_line2   string  optional    

Trường value không được lớn hơn 255 ký tự. Example: wbpilpmufinllwloauydl

ward   string  optional    

Trường value không được lớn hơn 255 ký tự. Example: smsjuryvojcybzvrbyick

district   string  optional    

Trường value không được lớn hơn 255 ký tự. Example: znkygloigmkwxphlvazjr

province   string  optional    

Trường value không được lớn hơn 255 ký tự. Example: cnfbaqywuxhgjjmzuxjub

country   string  optional    

Trường value phải có 2 ký tự. Example: qo

postal_code   string  optional    

Trường value không được lớn hơn 20 ký tự. Example: uzswiwxtrkimfcatb

company   string  optional    

Trường value không được lớn hơn 255 ký tự. Example: xspzmrazsroyjpxmqesed

job_title   string  optional    

Trường value không được lớn hơn 255 ký tự. Example: yghenqcopwvownkbamlnf

timezone   string  optional    

Trường value không được lớn hơn 50 ký tự. Example: Asia/Colombo

locale   string  optional    

Trường value không được lớn hơn 10 ký tự. Example: en_PH

bio   string  optional    

Giới thiệu ngắn. Example: Mô tả ngắn về user

Đổi user_type

Ví dụ request:
curl --request PATCH \
    "http://laravel-core.test/api/v1/users/1562/user-type" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"user_type\": \"ADMIN\"
}"
const url = new URL(
    "http://laravel-core.test/api/v1/users/1562/user-type"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "user_type": "ADMIN"
};

fetch(url, {
    method: "PATCH",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Yêu cầu      

PATCH api/v1/users/{id}/user-type

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số URL

id   string     

The ID of the user. Example: 1562

Tham số Body

user_type   string     

Loại tài khoản mới (ADMIN|USER|SYSTEM). Example: ADMIN

Must be one of:
  • ADMIN
  • USER
  • SYSTEM

Reset mật khẩu

Ví dụ request:
curl --request PATCH \
    "http://laravel-core.test/api/v1/users/1562/password" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"password\": \"123456789\",
    \"password_confirmation\": \"123456789\"
}"
const url = new URL(
    "http://laravel-core.test/api/v1/users/1562/password"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "password": "123456789",
    "password_confirmation": "123456789"
};

fetch(url, {
    method: "PATCH",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Yêu cầu      

PATCH api/v1/users/{id}/password

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số URL

id   string     

The ID of the user. Example: 1562

Tham số Body

password   string     

Mật khẩu mới (tối thiểu 8 ký tự). Trường value phải tối thiểu 8 ký tự. Trường value không được lớn hơn 255 ký tự. Example: 123456789

password_confirmation   string     

Nhập lại mật khẩu mới (phải giống password). The value and password must match. Example: 123456789

Xoá tài khoản (soft delete)

Ví dụ request:
curl --request DELETE \
    "http://laravel-core.test/api/v1/users/1562" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://laravel-core.test/api/v1/users/1562"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Yêu cầu      

DELETE api/v1/users/{id}

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số URL

id   string     

The ID of the user. Example: 1562

Khôi phục tài khoản đã xoá

Ví dụ request:
curl --request POST \
    "http://laravel-core.test/api/v1/users/1562/restore" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://laravel-core.test/api/v1/users/1562/restore"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Yêu cầu      

POST api/v1/users/{id}/restore

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số URL

id   string     

The ID of the user. Example: 1562

Xác thực

API đăng ký/đăng nhập/cập nhật profile sử dụng Bearer token (Sanctum).

Tài khoản

Các thao tác đăng ký/đăng nhập.

Đăng ký

Ví dụ request:
curl --request POST \
    "http://laravel-core.test/api/v1/auth/register" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"Demo User\",
    \"email\": \"demo@example.com\",
    \"password\": \"password123\",
    \"device_name\": \"postman\"
}"
const url = new URL(
    "http://laravel-core.test/api/v1/auth/register"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "Demo User",
    "email": "demo@example.com",
    "password": "password123",
    "device_name": "postman"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Yêu cầu      

POST api/v1/auth/register

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số Body

name   string     

User display name. Trường value không được lớn hơn 150 ký tự. Example: Demo User

email   string     

Unique email address. Trường value phải là địa chỉ email hợp lệ. Trường value không được lớn hơn 255 ký tự. Example: demo@example.com

password   string     

Password (min 8 chars). Trường value phải tối thiểu 8 ký tự. Example: password123

device_name   string  optional    

Optional device name for the token. Trường value không được lớn hơn 100 ký tự. Example: postman

Đăng nhập

Ví dụ request:
curl --request POST \
    "http://laravel-core.test/api/v1/auth/login" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"email\": \"demo@example.com\",
    \"password\": \"password123\",
    \"device_name\": \"postman\"
}"
const url = new URL(
    "http://laravel-core.test/api/v1/auth/login"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "demo@example.com",
    "password": "password123",
    "device_name": "postman"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Yêu cầu      

POST api/v1/auth/login

Header

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số Body

email   string     

Registered email address. Trường value phải là địa chỉ email hợp lệ. Trường value không được lớn hơn 255 ký tự. Example: demo@example.com

password   string     

Account password. Example: password123

device_name   string  optional    

Optional device name for the token. Trường value không được lớn hơn 100 ký tự. Example: postman

Hồ sơ

Các thao tác xem/cập nhật hồ sơ.

Thông tin tài khoản

requires authentication

Lấy thông tin user đang đăng nhập.

Ví dụ request:
curl --request GET \
    --get "http://laravel-core.test/api/v1/auth/me" \
    --header "Authorization: Bearer {TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://laravel-core.test/api/v1/auth/me"
);

const headers = {
    "Authorization": "Bearer {TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Yêu cầu      

GET api/v1/auth/me

Header

Authorization        

Example: Bearer {TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Cập nhật profile

requires authentication

Cập nhật thông tin profile của user hiện tại.

Ví dụ request:
curl --request PUT \
    "http://laravel-core.test/api/v1/auth/profile" \
    --header "Authorization: Bearer {TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"Demo User\",
    \"phone\": \"0900000000\",
    \"avatar_url\": \"https:\\/\\/example.com\\/avatar.png\",
    \"date_of_birth\": \"1990-01-01\",
    \"gender\": \"male\",
    \"address_line1\": \"123 Street\",
    \"address_line2\": \"Apt 4\",
    \"ward\": \"Ward 1\",
    \"district\": \"District 1\",
    \"province\": \"HCM\",
    \"country\": \"VN\",
    \"postal_code\": \"700000\",
    \"company\": \"Core Co\",
    \"job_title\": \"Engineer\",
    \"timezone\": \"Asia\\/Ho_Chi_Minh\",
    \"locale\": \"vi\",
    \"bio\": \"Hello\"
}"
const url = new URL(
    "http://laravel-core.test/api/v1/auth/profile"
);

const headers = {
    "Authorization": "Bearer {TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "Demo User",
    "phone": "0900000000",
    "avatar_url": "https:\/\/example.com\/avatar.png",
    "date_of_birth": "1990-01-01",
    "gender": "male",
    "address_line1": "123 Street",
    "address_line2": "Apt 4",
    "ward": "Ward 1",
    "district": "District 1",
    "province": "HCM",
    "country": "VN",
    "postal_code": "700000",
    "company": "Core Co",
    "job_title": "Engineer",
    "timezone": "Asia\/Ho_Chi_Minh",
    "locale": "vi",
    "bio": "Hello"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Yêu cầu      

PUT api/v1/auth/profile

Header

Authorization        

Example: Bearer {TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Tham số Body

name   string  optional    

User display name. Trường value không được lớn hơn 150 ký tự. Example: Demo User

phone   string  optional    

Phone number. Trường value không được lớn hơn 30 ký tự. Example: 0900000000

avatar_url   string  optional    

Avatar image URL. Trường value không được lớn hơn 255 ký tự. Example: https://example.com/avatar.png

date_of_birth   string  optional    

Date of birth (YYYY-MM-DD). Trường value không phải là ngày hợp lệ. Example: 1990-01-01

gender   string  optional    

Gender (free text). Trường value không được lớn hơn 20 ký tự. Example: male

address_line1   string  optional    

Address line 1. Trường value không được lớn hơn 255 ký tự. Example: 123 Street

address_line2   string  optional    

Address line 2. Trường value không được lớn hơn 255 ký tự. Example: Apt 4

ward   string  optional    

Ward. Trường value không được lớn hơn 255 ký tự. Example: Ward 1

district   string  optional    

District. Trường value không được lớn hơn 255 ký tự. Example: District 1

province   string  optional    

Province/City. Trường value không được lớn hơn 255 ký tự. Example: HCM

country   string  optional    

ISO 3166-1 alpha-2 country code. Trường value phải có 2 ký tự. Example: VN

postal_code   string  optional    

Postal code. Trường value không được lớn hơn 20 ký tự. Example: 700000

company   string  optional    

Company name. Trường value không được lớn hơn 255 ký tự. Example: Core Co

job_title   string  optional    

Job title. Trường value không được lớn hơn 255 ký tự. Example: Engineer

timezone   string  optional    

Timezone identifier. Trường value không được lớn hơn 50 ký tự. Example: Asia/Ho_Chi_Minh

locale   string  optional    

Locale code. Trường value không được lớn hơn 10 ký tự. Example: vi

bio   string  optional    

Short bio. Trường value không được lớn hơn 2000 ký tự. Example: Hello

Phiên

Quản lý phiên và token.

Đăng xuất

requires authentication

Thu hồi token hiện tại.

Ví dụ request:
curl --request POST \
    "http://laravel-core.test/api/v1/auth/logout" \
    --header "Authorization: Bearer {TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://laravel-core.test/api/v1/auth/logout"
);

const headers = {
    "Authorization": "Bearer {TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Yêu cầu      

POST api/v1/auth/logout

Header

Authorization        

Example: Bearer {TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json