API Keys
API Keys digunakan untuk mengautentikasi request ke Public API kirim.dev.
Membuat API Key
- Buka API Keys di sidebar
- Klik Create API Key
- Isi form:
- Name: Nama untuk identifikasi (misal: "Website Integration")
- Scopes: Pilih permissions yang dibutuhkan
- Device (opsional): Batasi ke device tertentu
- Expiry (opsional): Set tanggal kadaluarsa
- Klik Create
- Salin API key yang muncul - hanya ditampilkan sekali!
Format API Key
Code
kc_- Prefix kirim.devlive_- Environment (live/test)xxxxx- Unique identifier
Scopes
Scopes mengontrol apa yang bisa dilakukan dengan API key:
Messages
| Scope | Deskripsi |
|---|---|
messages:send | Kirim pesan |
messages:read | Baca pesan |
Contacts
| Scope | Deskripsi |
|---|---|
contacts:read | Lihat kontak |
contacts:write | Buat/edit/hapus kontak |
Broadcasts
| Scope | Deskripsi |
|---|---|
broadcasts:read | Lihat broadcast |
broadcasts:write | Buat/edit broadcast |
broadcasts:send | Jalankan broadcast |
Templates
| Scope | Deskripsi |
|---|---|
templates:read | Lihat templates |
templates:write | Buat/edit templates |
Webhooks
| Scope | Deskripsi |
|---|---|
webhooks:read | Lihat webhook config |
webhooks:write | Kelola webhooks |
Devices
| Scope | Deskripsi |
|---|---|
devices:read | Lihat devices |
Device Restriction
Anda bisa membatasi API key ke device tertentu:
- Jika di-set, API key hanya bisa akses device tersebut
- Jika tidak di-set, API key bisa akses semua device
Menggunakan API Key
Sertakan di header setiap request:
Code
Mengelola API Keys
List API Keys
Lihat semua API keys di halaman API Keys. Informasi yang ditampilkan:
- Nama
- Partial key (4 karakter terakhir)
- Scopes
- Device restriction
- Created date
- Last used
Revoke API Key
Jika API key compromised atau tidak dibutuhkan lagi:
- Klik icon Delete pada API key
- Konfirmasi revoke
- API key langsung tidak bisa digunakan
Warning: Revoke tidak bisa di-undo. Pastikan tidak ada sistem yang masih menggunakan key tersebut.
Best Practices
1. Principle of Least Privilege
Hanya berikan scope yang benar-benar dibutuhkan:
- Website form hanya butuh
messages:send - Dashboard analytics hanya butuh
*:read
2. Separate Keys per Environment
Gunakan key berbeda untuk:
- Development
- Staging
- Production
3. Rotate Keys Regularly
Rotate API keys secara berkala:
- Buat key baru
- Update di semua sistem
- Revoke key lama
4. Never Expose in Frontend
Jangan pernah expose API key di:
- JavaScript frontend
- Mobile app code
- Git repository
Selalu gunakan backend proxy.
5. Set Expiry for Temporary Access
Untuk akses sementara (misal: contractor), set expiry date.
Error Responses
Missing API Key
Code
Invalid API Key
Code
Insufficient Scope
Code
Last modified on