---
title: "Update user roles"
method: POST
path: "/user/{id}/roles"
tags: ["User"]
---

# Update user roles

`POST /user/{id}/roles`

Replace all account roles for a user with the provided list.

## Path parameters

- `id` string, required

## Query parameters

- `account_id` string

## Response `200`

User Response

- object
  - `_meta` object — Response Metadata
  - `data` object — Response Payload
    - `accounts` ModelsUserAccount[] — Accounts the user has access to
      - `account_id` string — The Account ID
      - `aid` integer — The account AID
      - `auth0_connections` string[]
      - `created` string, date-time
      - `expiration` string, date-time
      - `granted_by` string — The User ID who granted the account access
      - `reason` string
      - `roles` string[] — Which roles does the user have for this account
      - `updated` string, date-time
    - `aid` integer — Default AID for the user
    - `auth_type` 'password' | 'google' | 'github'
    - `authtoken` string
    - `authy_id` string — Authy User ID for 2fa
    - `cellphone` string
    - `cookie` string
    - `country_code` string — Authy Country Code for 2fa
    - `created` string, date-time
    - `email` string
    - `email_verified` string, date-time — Date of user email verification
    - `has_2fa_session` boolean — The user has an active 2fa session
    - `id` string
    - `last_logon` string, date-time
    - `last_pwd_change` string, date-time — Date the user's password was last changed
    - `name` string
    - `needs_2fa` boolean — The user needs a 2fa session
    - `organization_id` string
    - `updated` string, date-time
  - `request_id` string
  - `status` integer — HTTP Status Code

## Other responses

- `400` — Bad Request
- `403` — Forbidden
- `404` — Not Found
- `500` — Internal Server Error

---

[API](https://skmtc.net/lytics/apis/lytics-api.md) · [All operations](https://skmtc.net/lytics/apis/lytics-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/lytics/lytics-api/versions/366eeabcb6de/schema)
