> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wisdom.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Set User Attributes

The `setUserAttributes` mutation updates the DATABASE-sourced attributes for an existing user. Use this to update persistent key-value pairs that control parameterized connections and row-level data access.

<Warning>
  This mutation **replaces all DATABASE-sourced attributes** on the user. Any attributes not included in the new list will be removed. JWT-sourced attributes (from SSO claims) are not affected. See [User attributes](/integrations/user-management/user-attributes) for the difference between attribute sources.
</Warning>

## Signature

```graphql theme={null}
setUserAttributes(input: SetUserAttributesInput!): SetUserAttributesResponse!
```

## Arguments

<ParamField path="input" type="SetUserAttributesInput!" required>
  Input object identifying the user and the new attribute set.
</ParamField>

### SetUserAttributesInput fields

<ParamField path="userId" type="ID!" required>
  The ID of the user whose attributes should be updated. Use [listUsers](/integrations/graphql-api/queries/user/list-users) to find user IDs.
</ParamField>

<ParamField path="userAttributes" type="[UserAttributeInput!]!" required>
  The complete new set of DATABASE-sourced attributes. This replaces all existing DATABASE-sourced attributes — include every attribute you want the user to have after the call, not just the ones you're changing.
</ParamField>

## Response

<ParamField path="status" type="ResponseStatus!">
  Indicates whether the operation succeeded. See [ResponseStatus](/integrations/graphql-api/objects/response-status).
</ParamField>

## Usage example

```graphql theme={null}
mutation SetUserAttributes($input: SetUserAttributesInput!) {
  setUserAttributes(input: $input) {
    status {
      code
      message
    }
  }
}
```

<RequestExample>
  ```bash Request theme={null}
  curl -s -X POST \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <access_token>" \
    -d '{
      "query": "mutation SetUserAttributes($input: SetUserAttributesInput!) { setUserAttributes(input: $input) { status { code message } } }",
      "variables": {
        "input": {
          "userId": "user_abc123",
          "userAttributes": [
            { "key": "account_id", "value": "acct_456" },
            { "key": "region", "value": "us-west" }
          ]
        }
      }
    }' \
    https://{ACCOUNT}.askwisdom.ai/graphql
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "data": {
      "setUserAttributes": {
        "status": {
          "code": "OK",
          "message": "User attributes updated successfully"
        }
      }
    }
  }
  ```
</ResponseExample>

<Tip>
  For attributes that are stable (e.g., `account_id`), set them once at creation via `userAttributes` in [createUsers](/integrations/graphql-api/mutations/user/create-users). For session-scoped overrides that should not be persisted, use `attributes` in [impersonateUser](/integrations/graphql-api/mutations/auth/impersonate-user) instead.
</Tip>

## Related articles

<CardGroup cols={2}>
  <Card title="User attributes" icon="list" href="/integrations/user-management/user-attributes">
    Understand attribute sources and how they interact
  </Card>

  <Card title="Impersonate user" icon="user-secret" href="/integrations/graphql-api/mutations/auth/impersonate-user">
    Pass transient attributes at session time
  </Card>

  <Card title="List users" icon="users" href="/integrations/graphql-api/queries/user/list-users">
    Query users and inspect their current attributes
  </Card>
</CardGroup>
