Multi-user REST API + API Key
Kirim email via Gmail App Password dari API key project.
Daftar akun, login JWT, buat project Gmail, lalu gunakan API key untuk call endpoint /api/send. Setiap API key otomatis memakai Gmail milik project tersebut.
1
Register / Login
Auth user memakai JWT.
2
Buat Project Gmail
Simpan Gmail + App Password terenkripsi.
3
Dapatkan API Key
API key hanya tampil saat dibuat / rotate.
4
Call /api/send
Email keluar dari Gmail project API key.
Login / Daftar
JWT AuthTester Kirim Email
POST /api/sendDokumentasi REST API
v2| Endpoint | Auth | Fungsi |
|---|---|---|
| POST /api/auth/register | - | Daftar user: name, email, password. |
| POST /api/auth/login | - | Login user dan ambil JWT. |
| GET /api/me | JWT | Cek user login. |
| GET /api/projects | JWT | List project user. |
| POST /api/projects | JWT | Buat project Gmail dan API key. |
| PATCH /api/projects?id=... | JWT | Update nama, Gmail, app password, from name, status. |
| POST /api/projects?action=rotate&id=... | JWT | Regenerate API key. |
| DELETE /api/projects?id=... | JWT | Hapus project. |
| GET /api/logs | JWT | Log email terbaru. |
| POST /api/send | API Key | Kirim email dari Gmail project. |
POST/api/auth/register
Daftar user baru.
curl -X POST http://localhost:3000/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"name":"Sidik",
"email":"sidik@example.com",
"password":"secret123"
}'POST/api/auth/login
Login dan ambil token JWT.
curl -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email":"sidik@example.com",
"password":"secret123"
}'POST/api/projects
Buat project Gmail. Response berisi API key, simpan langsung.
curl -X POST http://localhost:3000/api/projects \
-H "Authorization: Bearer JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name":"Website Kontak",
"gmail_user":"akun@gmail.com",
"gmail_app_password":"abcdefghijklmnop",
"from_name":"Tim Website"
}'POST/api/send
Kirim email menggunakan Gmail project dari API key.
curl -X POST http://localhost:3000/api/send \
-H "X-API-Key: gr_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"to":"penerima@example.com",
"subject":"Halo dari API",
"html":"Berhasil
Email terkirim.
",
"reply_to":"support@example.com"
}'