Beta documentation. This is an early preview — content is still in active development. Feedback helps shape the final release. Share your thoughts or join the discussion.

Users

Returns all users for the authenticated site.

On this page

List users

Returns all users for the authenticated site.

curl "https://api.wapka.org/v1/users?page=1&limit=20" \
  -H "Authorization: Bearer eyJ..."

Query parameters

Parameter Type Description
search string Search by username or email
type int Filter by user type (1=Active, 2=Banned, 4=Deleted)
level int Filter by permission level (0–10)
page int Page number (default 1)
limit int Items per page (default 20, max 100)

Response

{
  "data": [
    {
      "id": 36012,
      "username": "johndoe",
      "email": "john@example.com",
      "level": 5,
      "role": "user",
      "type": 1,
      "type_label": "Active",
      "is_online": false,
      "points": 150,
      "created_at": "2025-06-01T00:00:00Z",
      "last_login_at": "2026-05-23T10:00:00Z",
      "avatar": "https://img.wapka.org/u/36012.jpg",
      "var": {}
    }
  ],
  "pagination": { "page": 1, "limit": 20, "totalItems": 1, "totalPages": 1, "hasNext": false, "hasPrev": false },
  "meta": { "requestId": "req_...", "timestamp": "..." }
}

User fields

Field Type Description
id int Unique user ID
username string Display name
email string Email address (hidden for level<8 users viewing others)
level int Permission level (0–10)
role string Persona label (public, user, moderator, admin, superadmin)
type int Account type (1=Active, 2=Banned, 4=Deleted)
type_label string Human-readable type
is_online bool Whether the user is currently online
points int Activity points
created_at string Registration timestamp (ISO 8601)
last_login_at string Last login timestamp
avatar string Avatar image URL
var object Custom user metadata (key-value pairs)

Get current user

curl https://api.wapka.org/v1/users/me \
  -H "Authorization: Bearer eyJ..."

Returns the authenticated user's full profile. Requires a logged-in token (not a guest token).

Get a user

curl https://api.wapka.org/v1/users/42 \
  -H "Authorization: Bearer eyJ..."

Create a user

Requires a logged-in token.

curl -X POST https://api.wapka.org/v1/users \
  -H "Authorization: Bearer eyJ..." \
  -H "Content-Type: application/json" \
  -d '{
    "username": "newuser",
    "password": "secure-password",
    "email": "new@example.com",
    "type": 1
  }'
Field Required Type Description
username Yes string Unique username
password Yes string Plain text (hashed on server)
email No string Email address
type No int 1=Active (default), 2=Banned

Returns 201 Created with the new user object.

Update a user

Requires a logged-in token.

curl -X PATCH https://api.wapka.org/v1/users/42 \
  -H "Authorization: Bearer eyJ..." \
  -H "Content-Type: application/json" \
  -d '{
    "username": "newname",
    "email": "new@example.com",
    "password": "new-password",
    "level": 5,
    "type": 1,
    "point": 200
  }'

All fields are optional — send only what you want to change.

Delete a user

Requires admin (level ≥ 8).

curl -X DELETE https://api.wapka.org/v1/users/42 \
  -H "Authorization: Bearer eyJ..."

Soft-deletes the user by setting type = 4. The user can no longer log in but their content remains.

Online users

List currently online visitors for the site.

curl "https://api.wapka.org/v1/online" \
  -H "Authorization: Bearer eyJ..."

Optional query parameters: id (user ID), pageid (page ID), page, limit.

Response includes online visitor objects with embedded user info.

Lua API wrapper

-- List users
local users = api.users:list({ search = "john", page = 1, limit = 10 })

-- Get current user
local me = api.users:getMe()

-- Get a user
local user = api.users:get(42)

-- Create a user
local newUser = api.users:create({
    username = "newuser",
    password = "secure-password",
    email = "new@example.com"
})

-- Update a user
api.users:update(42, { level = 5 })

-- Delete a user
api.users:delete(42)

-- Online visitors
local visitors = api.users:online()

Next: Sites & API Keys — manage site info and API keys.

Previous Authentication Next Sites & API Keys