Authentication

Autentikasi

Daftar, login, dan kelola sesi akun Anda.

WAPIZ menggunakan JWT yang disimpan sebagai HTTP-only cookie (wa_token). Semua request selanjutnya harus menyertakan cookie ini.


POST /api/auth/register

Buat akun baru. Paket Free otomatis diberikan saat registrasi.

Request body

FieldTypeRequiredKeterangan
namestringYaNama lengkap
emailstringYaAlamat email
passwordstringYaMinimal 8 karakter
curl -X POST /api/auth/register \
  -H "Content-Type: application/json" \
  -d '{"name":"John Doe","email":"john@example.com","password":"rahasia123"}'

Response 201

{
  "ok": true,
  "user": {
    "id": "uuid",
    "name": "John Doe",
    "email": "john@example.com"
  }
}

Response juga menyertakan cookie wa_token sehingga langsung bisa digunakan.

Errors

StatusPesan
400Semua field wajib diisi
400Password minimal 8 karakter
409Email sudah terdaftar

POST /api/auth/login

Login menggunakan email dan password.

Request body

FieldTypeRequired
emailstringYa
passwordstringYa
curl -X POST /api/auth/login \
  -H "Content-Type: application/json" \
  -c cookies.txt \
  -d '{"email":"john@example.com","password":"rahasia123"}'

Response 200

{
  "ok": true,
  "user": {
    "id": "uuid",
    "name": "John Doe",
    "email": "john@example.com",
    "role": "USER"
  }
}

Errors

StatusPesan
400Email dan password wajib diisi
401Email atau password salah

GET /api/auth/me

Ambil data akun yang sedang login, termasuk info paket dan device.

curl /api/auth/me -b "wa_token=<token>"

Response 200

{
  "id": "uuid",
  "name": "John Doe",
  "email": "john@example.com",
  "role": "USER",
  "createdAt": "2024-01-01T00:00:00.000Z",
  "subscription": {
    "status": "ACTIVE",
    "expiresAt": "2034-01-01T00:00:00.000Z",
    "plan": {
      "name": "Regular",
      "slug": "regular"
    }
  },
  "devices": [...]
}

Errors

StatusPesan
401Unauthorized

GET /api/auth/logout

Hapus sesi dan redirect ke halaman login.

curl /api/auth/logout -b "wa_token=<token>"

DELETE /api/auth/me

Logout tanpa redirect — cocok untuk client API.

curl -X DELETE /api/auth/me -b "wa_token=<token>"

Response 200

{ "ok": true }

© 2026 WAPIZ. Unofficial WhatsApp API.