Add or Edit User
Create a new user or update an existing user's information.
Endpoint
POST /api/user
Request Body
{
"id": 12345678,
"email": "[email protected]",
"name": "John Doe",
"role": "free",
"PlatformId": 35,
"photoUrl": "https://example.com/photo.jpg",
"bannerImageUrl": "https://example.com/banner.jpg",
"notes": "User bio or notes",
"GroupIds": [170, 171],
"status": "active"
}
Field Reference
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | No | Include for updates. Omit to create a new user. |
email | string | Yes | Must be unique within the platform. |
name | string | Yes | Full display name. |
role | string | Yes | One of: free, basic, admin, creator. |
PlatformId | integer | Yes | The platform ID (note: capital P). |
photoUrl | string | No | URL to profile image. |
bannerImageUrl | string | No | URL to banner image. |
notes | string | No | User bio or notes. |
GroupIds | array[integer] | No | Array of group IDs to assign (note: capital G). |
status | string | No | User status: active or pending. Defaults to active. |
password | string | No | Password for new users. Ignored on updates. |
Adding Users to Groups
To add a user to multiple groups, pass an array of integer group IDs:
{
"GroupIds": [170, 171, 172]
}
Note: When updating a user, GroupIds will replace all existing group memberships.
Response
Returns an array with two elements: the user object and a boolean indicating if the user was created (true) or updated (false).
Create Response
[
{
"id": 12345678,
"email": "[email protected]",
"name": "John Doe",
"role": "free",
"PlatformId": 35,
"photoUrl": "https://example.com/photo.jpg",
"bannerImageUrl": "https://example.com/banner.jpg",
"notes": "User bio or notes",
"status": "active",
"token": "eyJhbGciOiJIUzI1NiIs...",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z"
},
true
]
Update Response
[
{
"id": 12345678,
"email": "[email protected]",
"name": "John Doe",
"role": "free",
"PlatformId": 35,
"Groups": [
{
"id": 170,
"name": "Group Name"
}
],
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T12:00:00.000Z"
},
false
]
Notes
- If an
idis provided, the endpoint updates the existing user - If no
idis provided, a new user is created - Email addresses must be unique within a platform
PlatformIdis required when creating a new user- Only admins can update other users; regular users can only update themselves
- A JWT token is returned in the response when creating a new user