Skip to main content
Update User
Updates one or more profile fields for the specified user. A user edits only their own profile. A service key edits a user by acting as that user: it must send actingUserId naming the user in the path, and the request then behaves exactly as that user’s own token would. Uploads a new avatar or banner with multipart/form-data: the image is processed into the sizes you ask for, and the file it replaces is deleted once the update is saved. removeFileIds removes the avatar or banner without a replacement.
Send application/json for text-only updates. Use multipart/form-data when uploading image files.

Authentication

Requires a user access token whose user matches :userId, or a service key that sends actingUserId set to :userId.

Path Parameters

string
required
The Sublay user ID (UUID) to update.

Body Parameters

string
Service key only, and required with one: the user this request acts as. It must be the user in the path (:userId). Not an update field. A user token always acts as its own user and must not send it (400 user/acting-user-not-allowed). With multipart/form-data, send it as a form field.
All other fields are optional. Only the fields provided are updated.
string
Display name.
string
New username. Automatically lowercased and sanitized. Returns 409 user/username-taken (with param: "username") if another user already holds it.
string
URL of the user’s avatar image, stored as given. Separate from avatarFile, which uploads an image file and sets avatarFileId.
string
Short bio text.
string
ISO 8601 datetime string for the user’s date of birth (e.g. "1990-06-15T00:00:00.000Z").
object
Geographic location stored as a PostGIS point.
object
Public custom key-value data. Replaces the existing value.
object
Custom key-value data. No API response returns it, to this user or anyone else; your backend receives it in webhooks. The user can write it themselves, so don’t store anything your app needs to trust here. Replaces the existing value.
file
Avatar image file (multipart), replacing the current one. Maximum 50 MB. Must be a valid image. Requires avatarFile.options to be present in the same request.
string
Stringified JSON describing how to process the avatar. Must include a mode field; see Upload Image for the modes and optional fields. Not used when no avatarFile is sent, but still validated: invalid JSON or options get a 400. A key the options don’t take, a key of another mode included (for example sizes with exact-dimensions), is refused with 400 user/invalid-body, param naming it.
file
Banner image file (multipart), replacing the current one. Maximum 50 MB. Must be a valid image. Requires bannerFile.options to be present in the same request.
string
Stringified JSON describing how to process the banner, as avatarFile.options. Not used when no bannerFile is sent, but still validated: invalid JSON or options get a 400.
string[]
Files to remove from the user: their avatarFileId and/or bannerFileId, nothing else. Removing one clears that image (the pointer becomes null and the file is deleted). Works alone or with uploads in the same request; uploading a new avatar while listing the old one is a plain replace. On a multipart request, send it as a JSON string ('["<fileId>"]'). Any other id refuses the whole request with 400 user/invalid-remove-file-ids.

Response

On success, returns HTTP 200 with the updated user’s authenticated profile:
string
Unique user ID (UUID).
string | null
External identifier from your system.
string
User role (e.g., "visitor").
string | null
User’s email address.
string | null
Updated display name.
string | null
Updated username.
string | null
Avatar URL.
string | null
Bio text.
object | null
Public custom key-value data.
number | null
Reputation score.
boolean | null
Whether the user’s email has been verified.
boolean | null
Whether the user account is active.
string | null
ISO timestamp of the user’s last activity.
array
Active suspensions on the account.
object | null
Processed avatar image with variants.
object | null
Processed banner image with variants.
string[]
Active auth methods (e.g., ["password", "google"]).
string
ISO timestamp of account creation.
When name, username, or bio changes, the user’s semantic search embedding is automatically updated asynchronously.

Error Responses

Returned with no JSON body: 401 when no Authorization header is sent, 403 when the access token is invalid or expired. Checked before any uploaded file is read, so a request with no credentials gets 401 rather than a body or acting-user error. A valid token for a different user gets 403 user/forbidden instead (Signed In as Another User, below).
A valid user token, signed in as a user other than :userId, tried to update that user. Returned with a JSON body, unlike the invalid-token 403 above.
The user in the path no longer exists, for example a user token that outlived its user.
The image is over 50 MB. param names its field: avatarFile or bannerFile.
The file can’t be read as an image. Also returned for the banner, with "Banner file is not a valid image." and param: "bannerFile". An image over 10000 px on a side gets the same code. error gives its size:
For bannerFile:
avatarFile or bannerFile was uploaded without its .options field. param is avatarFile.options or bannerFile.options.
The .options field isn’t valid JSON. param names the field: avatarFile.options or bannerFile.options. avatarFile.options without mode, or with a mode that isn’t one of the five (other options fields the same way, named in error and param):
In an aspect-ratio mode, a variant’s computed side would be outside 1–10000 px. Checked once the image is read, before anything is stored. param names the option:
In aspect-ratio-height-based it names a heights option and gives a width. In multi-aspect-ratio it names a sizes option, and the ratio is the one in aspectRatios closest to the image, so the text reads ”… at the 3:1 aspect ratio, the one in aspectRatios closest to this image. Each side of a variant must be 1–10000 px.” More than 30 entries in dimensions, widths, heights or sizes (one variant each). param names the option:
A variant name that uses a character other than letters, digits, _, - and ., that is longer than 64 characters, that contains .., or that is original. param names the option:
A key the options don’t take (also a key of another mode). error names the object holding it, param the key itself:
Another user already holds the username sent. Nothing is changed, and any file uploaded with the request is removed.
Returned when your user.updated validation webhook rejects the update. error carries the message your webhook returned (User validation failed when it returned none). Nothing is changed.
A service key sent no actingUserId.
A service key sent an actingUserId other than :userId.
A user token sent actingUserId, even naming its own user. Only a service key names the user it acts as; a user token always acts as its own user.
Returned when a service key names an actingUserId that isn’t a user in this project, so also when it names a :userId that doesn’t exist.
removeFileIds names a file that isn’t this user’s current avatar or banner. invalidIds lists those ids. Checked before anything is uploaded, so nothing is stored or removed.
A removeFileIds that isn’t an array of file ids gets 400 user/invalid-body instead.
Returned when an avatar or banner is uploaded on a project without the files-images bundle. missingTables lists the tables that aren’t installed and bundleId the bundle to install. While the bundle is still being installed, the response is 503 database/tables-provisioning instead. See Bundles.
A file was refused as the body was read: user/unsupported-file-type or user/unexpected-file-field (a file in another field, or a second file in avatarFile or bannerFile), with param naming the field when there is one. A body over 250 MB gets 413 request/body-too-large; one that can’t be read at all gets request/invalid-multipart or request/field-too-large. See Upload errors.

See Also