Update the signed-in user
const url = 'https://your-tenant-host/v1/id/user-details';const options = { method: 'PATCH', headers: { cookie: 'ek.session_token=<ek.session_token>', 'x-edgekit-site-id': 'site_example', 'Content-Type': 'application/json' }, body: '{"name":"Ada Lovelace","firstName":"Ada","lastName":"Lovelace","userTraits":{"job_industry":"01926f3a-8b51-7e99-9aaa-8b9c0d1e2f3a","newsletter_note":null}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://your-tenant-host/v1/id/user-details \ --header 'Content-Type: application/json' \ --header 'x-edgekit-site-id: site_example' \ --cookie ek.session_token=<ek.session_token> \ --data '{ "name": "Ada Lovelace", "firstName": "Ada", "lastName": "Lovelace", "userTraits": { "job_industry": "01926f3a-8b51-7e99-9aaa-8b9c0d1e2f3a", "newsletter_note": null } }'Writes the user’s own fields. userTraits is merged per key: a key you send replaces its stored value, an explicit null deletes it, and a key you omit keeps whatever the user last chose. Validation runs against the merged result, so a one-key patch is never refused for a trait it did not touch. A value naming an item the organization has since retired is accepted and dropped rather than refused. Safe to retry: the same body writes the same values.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”The site this request is for, within this tenant. Every official EdgeKit SDK sets it from the client you configured; set it yourself only when calling this API directly.
Example
site_exampleThe site this request is for, within this tenant. Every official EdgeKit SDK sets it from the client you configured; set it yourself only when calling this API directly.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Example
Ada LovelaceExample
AdaExample
Lovelaceobject
Example
{ "job_industry": "01926f3a-8b51-7e99-9aaa-8b9c0d1e2f3a", "newsletter_note": null}Responses
Section titled “Responses”The updated user.
object
object
Example
{ "id": "01926f3a-8b4c-7d2e-9f10-2a3b4c5d6e7f", "email": "user@example.com", "emailVerified": true, "name": "Ada Lovelace", "firstName": "Ada", "lastName": "Lovelace", "image": null, "userTraits": { "job_industry": "01926f3a-8b51-7e99-9aaa-8b9c0d1e2f3a", "sectors": [ "01926f3a-8b52-7fbb-acc0-9c0d1e2f3a4b" ] }}Invalid request.
object
object
Example
{ "error": { "code": "unauthorized", "message": "Invalid or missing API key." }}Missing or invalid credential.
object
object
Example
{ "error": { "code": "unauthorized", "message": "Invalid or missing API key." }}Not allowed.
object
object
Example
{ "error": { "code": "unauthorized", "message": "Invalid or missing API key." }}Resource not found.
object
object
Example
{ "error": { "code": "unauthorized", "message": "Invalid or missing API key." }}Request validation failed.
object
object
Example
{ "error": { "code": "unauthorized", "message": "Invalid or missing API key." }}Unexpected error.
object
object
Example
{ "error": { "code": "unauthorized", "message": "Invalid or missing API key." }}