Tài liệu › Quản trị

REST API và API key

Toàn bộ dashboard chạy trên REST API /api/v1; dùng API key cho script, CI/CD và tích hợp.

API key

Cài đặt → Chung → API key → Tạo. Key chỉ hiện một lần, có quyền Quản trị của tổ chức; lưu như mật khẩu, thu hồi khi nghi ngờ lộ. Gửi key qua header Authorization: Bearer <key>. Key sai bị đếm theo địa chỉ: 10 lần trong 15 phút thì chặn.

Ví dụ

# danh sách chứng chỉ sắp hết hạn trong 30 ngày
curl -s -H "Authorization: Bearer $KEY" "https://console.mettacert.com/api/v1/certificates?expiring=30"

# thêm endpoint
curl -s -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"host":"portal.congty.vn","port":443}' https://console.mettacert.com/api/v1/endpoints

# tạo chứng chỉ cấp tự động trên agent
curl -s -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"agent_id":"ag_…","name":"web-portal","domains":["portal.congty.vn"],"issuer":"le","targets":[{"type":"file","cert_path":"/etc/nginx/ssl/portal.crt","key_path":"/etc/nginx/ssl/portal.key","reload":"systemctl reload nginx"}]}' \
  https://console.mettacert.com/api/v1/auto-certs

Các nhóm endpoint

NhómĐường dẫn
Chứng chỉ, endpoint, CT log/api/v1/certificates, /api/v1/endpoints, /api/v1/discover
Chứng chỉ dùng chung nhiều agent/api/v1/auto-certs/{id}/share, /api/v1/auto-certs/{id}/share/resend
Trường tùy biến, nhóm chứng chỉ/api/v1/settings/custom-fields, /api/v1/groups, PATCH /api/v1/certificates (sửa hàng loạt)
Agent, CA, kho/api/v1/agents, /api/v1/agents/{id}/config, /api/v1/cas, /api/v1/stores
Cấp tự động, thủ công, phê duyệt/api/v1/auto-certs, /api/v1/manual-requests, /api/v1/approvals
Khóa SSH, chứng thư số/api/v1/ssh-keys, /api/v1/signing-certs
Rủi ro, dịch vụ, chính sách, tuân thủ/api/v1/risk, /api/v1/services, /api/v1/policy, /api/v1/compliance
Kênh cảnh báo, người dùng, cài đặt, nhật ký/api/v1/channels, /api/v1/users, /api/v1/settings/*, /api/v1/audit
Gói, hóa đơn/api/v1/billing, /api/v1/billing/checkout, /api/v1/billing/invoices

Mọi phản hồi là JSON; lỗi có error (thông điệp) và request_id. Danh sách lớn hỗ trợ phân trang ?page=&size=. Giới hạn: 30 lần/phút cho quét, tìm CT log, gửi thử kênh, cấp ngay.

Cập nhật 13/10/2026Bài này có hữu ích?