Skip to content

Update

client.users.update(stringuserRef, UserUpdateParams { tags } body, RequestOptionsoptions?): UserUpdateResponse { data }
PATCH/users/{user_ref}

Updates a user.

ParametersExpand Collapse
userRef: string

User id or external_id.

body: UserUpdateParams { tags }
tags: Tags

Tag updates.

create?: Array<Create>

Tags to create. The tag key must not already exist.

key: string

Tag key. Must not contain #, /, or :. Max 50 characters.

value: string

Tag value. Must not contain #, /, or :. Max 200 characters.

delete?: Array<Delete>

Tags to remove.

key: string

Tag key to delete.

set?: Array<Set>

Tags to set. Creates a new tag or updates an existing tag.

key: string

Tag key. Must not contain #, /, or :. Max 50 characters.

value: string

Tag value. Must not contain #, /, or :. Max 200 characters.

update?: Array<Update>

Tags to update. The tag key must already exist.

key: string

Tag key. Must not contain #, /, or :. Max 50 characters.

value: string

Tag value. Must not contain #, /, or :. Max 200 characters.

ReturnsExpand Collapse
UserUpdateResponse { data }
data: User { id, external_id, tags }

User object.

id: string

FRAGMENT generated unique ID.

external_id: string

User-provided unique ID.

tags: Array<Tag>

Tags for the user.

key: string

Tag key.

value: string

Tag value.

Update

import Fragment from '@fragment-dev/ts-node';

const client = new Fragment();

const user = await client.users.update('user_dXNyX2ZyYWdfMDAx', { tags: {} });

console.log(user.data);
{
  "data": {
    "id": "user_abc123",
    "external_id": "user_ext_123",
    "tags": [
      {
        "key": "department",
        "value": "engineering"
      }
    ]
  }
}
Returns Examples
{
  "data": {
    "id": "user_abc123",
    "external_id": "user_ext_123",
    "tags": [
      {
        "key": "department",
        "value": "engineering"
      }
    ]
  }
}