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

# Update user role

> Changes the role of a user in your account.



## OpenAPI

````yaml PUT /v1/accounts/{account_id}/users/{user_id}
openapi: 3.1.0
info:
  title: WotNot API
  version: 1.0.0
  description: 'WotNot API: Update user role.'
servers:
  - url: https://api.wotnot.io
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/accounts/{account_id}/users/{user_id}:
    put:
      summary: Update user role
      description: Changes the role of a user in your account.
      operationId: updateUserRole
      parameters:
        - name: account_id
          in: path
          required: true
          description: The ID of your WotNot account.
          schema:
            type: string
        - name: user_id
          in: path
          required: true
          description: >-
            The ID of the user whose role you want to change. You can find user
            IDs in `users_in_role` from Get account roles.
          schema:
            type: string
      requestBody:
        required: true
        description: The new role.
        content:
          application/json:
            schema:
              type: object
              required:
                - role_id
              properties:
                role_id:
                  type: string
                  description: >-
                    The ID of the new role. Get it from Get account roles. It
                    must be a number.
                  example: '262185'
            example:
              role_id: '262185'
      responses:
        '200':
          description: The role was changed. Returns `ok` set to `true`.
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                properties:
                  ok:
                    type: boolean
                    description: '`true` when the request worked. Errors return `false`.'
                    example: true
              example:
                ok: true
        '400':
          description: >-
            Something in the body is invalid, for example `role_id` isn't a
            number. Each item in `message` points to one problem.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
              example:
                error: BAD_REQUEST
                ok: false
                status: 400
                message:
                  - message: '"role_id" must be a number'
                    path:
                      - role_id
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: >-
            The user or the role wasn't found in your account. Check `error` to
            see which.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                user_not_found:
                  summary: User not found
                  value:
                    error: USER_NOT_FOUND
                    ok: false
                    status: 404
                    message: User not found in this account.
                role_not_found:
                  summary: Role not found
                  value:
                    error: ROLE_NOT_FOUND
                    ok: false
                    status: 404
                    message: Role not found for this account.
components:
  schemas:
    ValidationError:
      type: object
      description: Returned when one or more fields in the request body are invalid.
      required:
        - error
        - ok
        - status
        - message
      properties:
        error:
          type: string
          description: '`BAD_REQUEST` for this kind of error.'
          example: BAD_REQUEST
        ok:
          type: boolean
          description: Always `false` when something went wrong.
          example: false
        status:
          type: integer
          description: The HTTP status code, repeated in the body.
          example: 400
        message:
          type: array
          description: A list of problems with the request, one item per problem.
          items:
            type: object
            required:
              - message
              - path
            properties:
              message:
                type: string
                description: >-
                  What is wrong with this field, for example `"url" must be a
                  valid uri`.
                example: '"url" must be a valid uri'
              path:
                type: array
                description: >-
                  Where the problem is in your request body. For example,
                  `["urls", 0]` means the first item in `urls`.
                items:
                  type:
                    - string
                    - integer
    Error:
      type: object
      description: Returned whenever a request fails.
      required:
        - error
        - ok
        - status
        - message
      properties:
        error:
          type: string
          description: >-
            A short error code in capital letters, for example `UNAUTHORIZED`.
            Check this in your code to tell errors apart.
          example: UNAUTHORIZED
        ok:
          type: boolean
          description: Always `false` when something went wrong.
          example: false
        status:
          type: integer
          description: The HTTP status code, repeated in the body, for example `401`.
          example: 401
        message:
          type: string
          description: What went wrong and how to fix it, in plain words.
          example: Invalid token. Provide the valid account token.
  responses:
    Unauthorized:
      description: >-
        The token is missing or wrong. Check that the `Authorization` header is
        `Bearer` followed by your account token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: UNAUTHORIZED
            ok: false
            status: 401
            message: Invalid token. Provide the valid account token.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        All of WotNot's APIs use Bearer token authentication. Send your account
        token as `Bearer <token>`. You can find it in Settings > Account
        Settings > Developer. Keep it on your server: anyone who has it can call
        the API as your account.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.