Update User
curl --request PATCH \
--url https://api.sublay.io/v7/:projectId/users/:userId \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"username": "<string>",
"avatar": "<string>",
"bio": "<string>",
"birthdate": "<string>",
"location": {
"latitude": 123,
"longitude": 123
},
"metadata": {},
"secureMetadata": {}
}
'import requests
url = "https://api.sublay.io/v7/:projectId/users/:userId"
payload = {
"name": "<string>",
"username": "<string>",
"avatar": "<string>",
"bio": "<string>",
"birthdate": "<string>",
"location": {
"latitude": 123,
"longitude": 123
},
"metadata": {},
"secureMetadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
username: '<string>',
avatar: '<string>',
bio: '<string>',
birthdate: '<string>',
location: {latitude: 123, longitude: 123},
metadata: {},
secureMetadata: {}
})
};
fetch('https://api.sublay.io/v7/:projectId/users/:userId', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sublay.io/v7/:projectId/users/:userId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'username' => '<string>',
'avatar' => '<string>',
'bio' => '<string>',
'birthdate' => '<string>',
'location' => [
'latitude' => 123,
'longitude' => 123
],
'metadata' => [
],
'secureMetadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sublay.io/v7/:projectId/users/:userId"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"username\": \"<string>\",\n \"avatar\": \"<string>\",\n \"bio\": \"<string>\",\n \"birthdate\": \"<string>\",\n \"location\": {\n \"latitude\": 123,\n \"longitude\": 123\n },\n \"metadata\": {},\n \"secureMetadata\": {}\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.sublay.io/v7/:projectId/users/:userId")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"username\": \"<string>\",\n \"avatar\": \"<string>\",\n \"bio\": \"<string>\",\n \"birthdate\": \"<string>\",\n \"location\": {\n \"latitude\": 123,\n \"longitude\": 123\n },\n \"metadata\": {},\n \"secureMetadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v7/:projectId/users/:userId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"username\": \"<string>\",\n \"avatar\": \"<string>\",\n \"bio\": \"<string>\",\n \"birthdate\": \"<string>\",\n \"location\": {\n \"latitude\": 123,\n \"longitude\": 123\n },\n \"metadata\": {},\n \"secureMetadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"foreignId": {},
"role": "<string>",
"email": {},
"name": {},
"username": {},
"avatar": {},
"bio": {},
"metadata": {},
"reputation": {},
"isVerified": {},
"isActive": {},
"lastActive": {},
"suspensions": [
{}
],
"avatarFile": {},
"bannerFile": {},
"authMethods": [
"<string>"
],
"createdAt": "<string>"
}User Endpoints
Update User
Update a user’s profile fields, including avatar and banner images
Update User
curl --request PATCH \
--url https://api.sublay.io/v7/:projectId/users/:userId \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"username": "<string>",
"avatar": "<string>",
"bio": "<string>",
"birthdate": "<string>",
"location": {
"latitude": 123,
"longitude": 123
},
"metadata": {},
"secureMetadata": {}
}
'import requests
url = "https://api.sublay.io/v7/:projectId/users/:userId"
payload = {
"name": "<string>",
"username": "<string>",
"avatar": "<string>",
"bio": "<string>",
"birthdate": "<string>",
"location": {
"latitude": 123,
"longitude": 123
},
"metadata": {},
"secureMetadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
username: '<string>',
avatar: '<string>',
bio: '<string>',
birthdate: '<string>',
location: {latitude: 123, longitude: 123},
metadata: {},
secureMetadata: {}
})
};
fetch('https://api.sublay.io/v7/:projectId/users/:userId', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sublay.io/v7/:projectId/users/:userId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'username' => '<string>',
'avatar' => '<string>',
'bio' => '<string>',
'birthdate' => '<string>',
'location' => [
'latitude' => 123,
'longitude' => 123
],
'metadata' => [
],
'secureMetadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sublay.io/v7/:projectId/users/:userId"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"username\": \"<string>\",\n \"avatar\": \"<string>\",\n \"bio\": \"<string>\",\n \"birthdate\": \"<string>\",\n \"location\": {\n \"latitude\": 123,\n \"longitude\": 123\n },\n \"metadata\": {},\n \"secureMetadata\": {}\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.sublay.io/v7/:projectId/users/:userId")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"username\": \"<string>\",\n \"avatar\": \"<string>\",\n \"bio\": \"<string>\",\n \"birthdate\": \"<string>\",\n \"location\": {\n \"latitude\": 123,\n \"longitude\": 123\n },\n \"metadata\": {},\n \"secureMetadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v7/:projectId/users/:userId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"username\": \"<string>\",\n \"avatar\": \"<string>\",\n \"bio\": \"<string>\",\n \"birthdate\": \"<string>\",\n \"location\": {\n \"latitude\": 123,\n \"longitude\": 123\n },\n \"metadata\": {},\n \"secureMetadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"foreignId": {},
"role": "<string>",
"email": {},
"name": {},
"username": {},
"avatar": {},
"bio": {},
"metadata": {},
"reputation": {},
"isVerified": {},
"isActive": {},
"lastActive": {},
"suspensions": [
{}
],
"avatarFile": {},
"bannerFile": {},
"authMethods": [
"<string>"
],
"createdAt": "<string>"
}Updates one or more profile fields for the specified user. The requesting user must own the account, or use a service key to update any user.
Supports direct image uploads for the avatar and banner via
multipart/form-data. Uploaded images are processed, stored in Supabase, and the old files are automatically cleaned up after a successful update.
Send
application/json for text-only updates. Use multipart/form-data
when uploading image files.Authentication
Requires a valid user auth token. The authenticated user must match:userId, or the request must carry a service token.
Path Parameters
Body Parameters
All fields are optional. Only the fields provided are updated.New username. Automatically lowercased and sanitized. Returns 409 if already
taken by another user.
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.
Avatar image file (multipart). Maximum 50 MB. Must be a valid image.
Requires
avatarFile.options to be present in the same request.Banner image file (multipart). Maximum 50 MB. Must be a valid image.
Requires
bannerFile.options to be present in the same request.Response
On success, returns HTTP200 with the updated user’s authenticated profile:
When
name, username, or bio changes, the user’s semantic search
embedding is automatically updated asynchronously.Error Responses
Not Authorized — 403
Not Authorized — 403
{
"error": "Not authorized to update this user.",
"code": "user/not-authorized"
}
User Not Found — 404
User Not Found — 404
{
"error": "User not found",
"code": "user/not-found"
}
File Too Large — 413
File Too Large — 413
{
"message": "Avatar image exceeds 50MB limit.",
"code": "user/file-too-large"
}
Invalid Image — 422
Invalid Image — 422
{
"message": "Avatar file is not a valid image: ...",
"code": "user/invalid-image"
}
Missing Image Options — 400
Missing Image Options — 400
{
"message": "Image options are required when uploading an avatar. Must include mode property.",
"code": "user/missing-image-options"
}
Validation Failed — 400
Validation Failed — 400
{
"error": "User validation failed",
"code": "user/validation-failed"
}
Invalid Params — 400
Invalid Params — 400
{
"error": "...",
"code": "user/invalid-params"
}
See Also
useUserActionshook —updateUser- Storage: Upload Image
- User data model

