API Key Management
Kelola API key untuk mengintegrasikan Garz AI ke aplikasi Anda
Buat API Key Baru
API Key Saya
Belum ada API Key
Buat API Key di atas untuk mulai integrasi
Tutorial Cara Menggunakan API Key
1
Buat API Key
Isi nama API Key, pilih masa berlaku, lalu klik "Generate API Key"
2
Salin API Key
Setelah dibuat, API Key akan muncul di daftar. Klik tombol "Salin" untuk menyalin.
3
Integrasikan ke Aplikasi
Gunakan API Key sebagai Bearer Token di header request Anda.
Contoh Kode Integrasi
๐ Python
import requests
url = "https://api.garz.ai/v1/chat"
headers = {
"Authorization": "Bearer YOUR_API_KEY_HERE",
"Content-Type": "application/json"
}
data = {"prompt": "Halo Garz AI!"}
response = requests.post(url, headers=headers, json=data)
print(response.json())
๐ JavaScript (Fetch)
fetch('https://api.garz.ai/v1/chat', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY_HERE',
'Content-Type': 'application/json'
},
body: JSON.stringify({ prompt: "Halo Garz AI!" })
})
.then(res => res.json())
.then(data => console.log(data));
๐ cURL
curl -X POST https://api.garz.ai/v1/chat \
-H "Authorization: Bearer YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{"prompt":"Halo Garz AI"}'
Peringatan Keamanan: Jangan pernah membagikan API Key Anda ke publik atau menyimpannya di kode frontend. Gunakan environment variable untuk menyimpan API Key.