Skip to main content

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

FieldTypeRequiredDescription
idintegerNoInclude for updates. Omit to create a new user.
emailstringYesMust be unique within the platform.
namestringYesFull display name.
rolestringYesOne of: free, basic, admin, creator.
PlatformIdintegerYesThe platform ID (note: capital P).
photoUrlstringNoURL to profile image.
bannerImageUrlstringNoURL to banner image.
notesstringNoUser bio or notes.
GroupIdsarray[integer]NoArray of group IDs to assign (note: capital G).
statusstringNoUser status: active or pending. Defaults to active.
passwordstringNoPassword 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 id is provided, the endpoint updates the existing user
  • If no id is provided, a new user is created
  • Email addresses must be unique within a platform
  • PlatformId is 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