# Users API ## Available Fields | Field | Type | Description | |---|---|---| | `user_id` | int | User ID | | `username` | string | Unique username (min 4 chars, lowercase, no spaces) | | `email` | string | Unique email address | | `firstname` | string | First name | | `lastname` | string | Last name | | `biography` | string | Short bio shown on author profile page | | `avatar` | string | Avatar image URL (200×200) | | `avatar_small` | string | Small avatar URL (50×50, auto-generated) | | `user_role` | int | Role ID — see your user roles in Dashboard → Settings → Users | | `language` | string | UI language code (e.g. `en-US`, `he-IL`, `fr-FR`) | | `account_suspended` | int | `0` = active, `1` = suspended (blocked from login) | | `email_alerts` | int | `1` = receives email notifications, `0` = off | | `device_alerts` | int | `1` = receives push notifications, `0` = off | | `public_key` | string | Public identifier | | `link_website` | string | Personal website URL | | `link_facebook` | string | Facebook profile URL | | `link_x` | string | X (Twitter) profile URL | | `link_instagram` | string | Instagram profile URL | | `link_youtube` | string | YouTube channel URL | | `link_twitch` | string | Twitch channel URL | | `link_linkedin` | string | LinkedIn profile URL | | `total_views` | int | Total article views across all authored articles | | `created_at` | datetime | Registration date | | `updated_at` | datetime | Last update date | --- ## Get All Users ```json { "resource": "user", "action": "get", "filters": { "user_role": 2, "account_suspended": 0, "language": "en-US", "search": "john" }, "fields": ["user_id", "username", "email", "firstname", "lastname", "user_role", "created_at"], "limit": 20, "offset": 0, "order_by": "created_at DESC" } ``` | Filter | Description | |---|---| | `search` | Searches in username, firstname, lastname, email | | `user_role` | Filter by role ID | | `account_suspended` | `0` = active only, `1` = suspended only | | `language` | Filter by language code (e.g. `en-US`) | --- ## Get Single User ```json { "resource": "user", "action": "get", "id": 3 } ``` --- ## Add User ```json { "resource": "user", "action": "add", "firstname": "John", "lastname": "Doe", "username": "johndoe", "email": "john@example.com", "user_role": 2, "language": "en-US", "account_suspended": 0, "avatar": "https://example.com/avatar.jpg", "biography": "Senior reporter covering international affairs", "link_website": "https://johndoe.com", "link_facebook": "https://facebook.com/johndoe", "link_x": "https://x.com/johndoe", "link_instagram": "https://instagram.com/johndoe", "link_youtube": "https://youtube.com/johndoe", "link_twitch": "https://twitch.tv/johndoe", "link_linkedin": "https://linkedin.com/in/johndoe", "email_alerts": 1, "device_alerts": 1 } ``` | Field | Required | Notes | |---|---|---| | `firstname` | Yes | User's first name | | `lastname` | No | User's last name | | `username` | Yes | Unique, min 4 chars, lowercase, no spaces | | `email` | Yes | Unique email address | | `user_role` | Yes | Role ID from Dashboard → Settings → Users | | `language` | No | Language code. Default: `en-US` | | `account_suspended` | No | `0` = active, `1` = suspended. Default: `0` | | `avatar` | No | Public image URL — downloaded and resized to 200×200 automatically | | `biography` | No | Short bio for author profile | | `link_*` | No | Social/website profile URLs | | `email_alerts` | No | `1` = on, `0` = off | | `device_alerts` | No | `1` = on, `0` = off | --- ## Edit User All fields are optional except `user_id`. Only fields included in the request are updated. ```json { "resource": "user", "action": "edit", "user_id": 3, "firstname": "John Updated", "lastname": "Doe", "username": "johndoe_updated", "email": "newemail@example.com", "biography": "Updated bio", "avatar": "https://example.com/new-avatar.jpg", "user_role": 2, "language": "en-US", "account_suspended": 0, "email_alerts": 1, "device_alerts": 1, "link_website": "https://johndoe.com", "link_facebook": "https://facebook.com/johndoe", "link_x": "https://x.com/johndoe", "link_instagram": "https://instagram.com/johndoe", "link_youtube": "https://youtube.com/johndoe", "link_twitch": "https://twitch.tv/johndoe", "link_linkedin": "https://linkedin.com/in/johndoe" } ``` --- ## Delete User ```json { "resource": "user", "action": "delete", "user_id": 3 } ```