Xác thực API
Bắt đầu
Cập nhật: 23/03/2026
Xác thực API
Tất cả API endpoints yêu cầu xác thực bằng API Key.
Lấy API Key
- Đăng nhập Dashboard
- Vào API Keys → Tạo mới
- Copy API Key (chỉ hiển thị 1 lần)
Sử dụng
Gửi API Key trong header Authorization dạng Bearer token:
GET /api/v1/transactions
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Request mẫu
curl -s "https://thueapi.vn/api/v1/transactions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
Response khi thiếu hoặc sai API Key
{
"status": false,
"error": {
"code": "AUTH_REQUIRED",
"message": "API key required"
}
}
{
"status": false,
"error": {
"code": "INVALID_KEY",
"message": "Invalid API key"
}
}
{
"status": false,
"error": {
"code": "KEY_EXPIRED",
"message": "API key expired"
}
}
Bảng mã lỗi
| Code | HTTP | Mô tả |
|---|---|---|
AUTH_REQUIRED | 401 | Không gửi API Key |
INVALID_KEY | 401 | API Key không hợp lệ |
KEY_EXPIRED | 401 | API Key đã hết hạn |