Mettre à jour le profil de l’utilisateur authentifié
curl --request PATCH \
--url https://api.example.com/v1/auth/me \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Jane Smith",
"firstName": "Jane",
"lastName": "Smith",
"displayName": "Jane",
"country": "France",
"onboardingCompleted": true,
"twoFactorEnabled": true,
"image": "data:image/svg+xml;base64,..."
}
'import requests
url = "https://api.example.com/v1/auth/me"
payload = {
"name": "Jane Smith",
"firstName": "Jane",
"lastName": "Smith",
"displayName": "Jane",
"country": "France",
"onboardingCompleted": True,
"twoFactorEnabled": True,
"image": "data:image/svg+xml;base64,..."
}
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: 'Jane Smith',
firstName: 'Jane',
lastName: 'Smith',
displayName: 'Jane',
country: 'France',
onboardingCompleted: true,
twoFactorEnabled: true,
image: 'data:image/svg+xml;base64,...'
})
};
fetch('https://api.example.com/v1/auth/me', 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.example.com/v1/auth/me",
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' => 'Jane Smith',
'firstName' => 'Jane',
'lastName' => 'Smith',
'displayName' => 'Jane',
'country' => 'France',
'onboardingCompleted' => true,
'twoFactorEnabled' => true,
'image' => 'data:image/svg+xml;base64,...'
]),
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.example.com/v1/auth/me"
payload := strings.NewReader("{\n \"name\": \"Jane Smith\",\n \"firstName\": \"Jane\",\n \"lastName\": \"Smith\",\n \"displayName\": \"Jane\",\n \"country\": \"France\",\n \"onboardingCompleted\": true,\n \"twoFactorEnabled\": true,\n \"image\": \"data:image/svg+xml;base64,...\"\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.example.com/v1/auth/me")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Jane Smith\",\n \"firstName\": \"Jane\",\n \"lastName\": \"Smith\",\n \"displayName\": \"Jane\",\n \"country\": \"France\",\n \"onboardingCompleted\": true,\n \"twoFactorEnabled\": true,\n \"image\": \"data:image/svg+xml;base64,...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/auth/me")
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\": \"Jane Smith\",\n \"firstName\": \"Jane\",\n \"lastName\": \"Smith\",\n \"displayName\": \"Jane\",\n \"country\": \"France\",\n \"onboardingCompleted\": true,\n \"twoFactorEnabled\": true,\n \"image\": \"data:image/svg+xml;base64,...\"\n}"
response = http.request(request)
puts response.read_bodyAPI — Compte
Mettre à jour le profil de l’utilisateur authentifié
Updates user-settable profile fields (name, displayName, country, onboardingCompleted). Server-owned fields are rejected by the DTO allow-list.
PATCH
/
v1
/
auth
/
me
Mettre à jour le profil de l’utilisateur authentifié
curl --request PATCH \
--url https://api.example.com/v1/auth/me \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Jane Smith",
"firstName": "Jane",
"lastName": "Smith",
"displayName": "Jane",
"country": "France",
"onboardingCompleted": true,
"twoFactorEnabled": true,
"image": "data:image/svg+xml;base64,..."
}
'import requests
url = "https://api.example.com/v1/auth/me"
payload = {
"name": "Jane Smith",
"firstName": "Jane",
"lastName": "Smith",
"displayName": "Jane",
"country": "France",
"onboardingCompleted": True,
"twoFactorEnabled": True,
"image": "data:image/svg+xml;base64,..."
}
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: 'Jane Smith',
firstName: 'Jane',
lastName: 'Smith',
displayName: 'Jane',
country: 'France',
onboardingCompleted: true,
twoFactorEnabled: true,
image: 'data:image/svg+xml;base64,...'
})
};
fetch('https://api.example.com/v1/auth/me', 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.example.com/v1/auth/me",
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' => 'Jane Smith',
'firstName' => 'Jane',
'lastName' => 'Smith',
'displayName' => 'Jane',
'country' => 'France',
'onboardingCompleted' => true,
'twoFactorEnabled' => true,
'image' => 'data:image/svg+xml;base64,...'
]),
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.example.com/v1/auth/me"
payload := strings.NewReader("{\n \"name\": \"Jane Smith\",\n \"firstName\": \"Jane\",\n \"lastName\": \"Smith\",\n \"displayName\": \"Jane\",\n \"country\": \"France\",\n \"onboardingCompleted\": true,\n \"twoFactorEnabled\": true,\n \"image\": \"data:image/svg+xml;base64,...\"\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.example.com/v1/auth/me")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Jane Smith\",\n \"firstName\": \"Jane\",\n \"lastName\": \"Smith\",\n \"displayName\": \"Jane\",\n \"country\": \"France\",\n \"onboardingCompleted\": true,\n \"twoFactorEnabled\": true,\n \"image\": \"data:image/svg+xml;base64,...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/auth/me")
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\": \"Jane Smith\",\n \"firstName\": \"Jane\",\n \"lastName\": \"Smith\",\n \"displayName\": \"Jane\",\n \"country\": \"France\",\n \"onboardingCompleted\": true,\n \"twoFactorEnabled\": true,\n \"image\": \"data:image/svg+xml;base64,...\"\n}"
response = http.request(request)
puts response.read_bodyAutorisations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Corps
application/json
Full name. Kept for backwards compat - prefer firstName/lastName. When firstName or lastName is set, name is rebuilt from them.
Maximum string length:
120Exemple:
"Jane Smith"
Maximum string length:
80Exemple:
"Jane"
Maximum string length:
80Exemple:
"Smith"
Maximum string length:
80Exemple:
"Jane"
Maximum string length:
80Exemple:
"France"
Marks onboarding as completed (step 4 of the wizard).
Force-set twoFactorEnabled (workaround for Better Auth bearer mode).
Avatar image URL or data URI (used by the preset avatar picker). When set, overrides the uploaded avatar.
Exemple:
"data:image/svg+xml;base64,..."
Réponse
200