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

# Set User's Status Active

> Activate or deactivate a user in the workspace.

Any one of the following permissions is required:
* `edit-other-user-active-status`: Change another user's active status.
* `manage-moderation-actions`: Manage moderation actions on reported users.

When a user is deactivated (`activeStatus=false`), Rocket.Chat revokes all of the user's login tokens and OAuth access tokens, refresh tokens, and authorization codes. The user can no longer call the REST API with previously issued OAuth credentials.

### Changelog
| Version      | Description |
| ---------------- | ------------|
|8.5.0            | Added OAuth access token, refresh token, and authorization code revocation on deactivation. |
|3.7.0            | Added `confirmRelinquish` to the payload.       |
|0.75.0            | Added       |

## OpenAPI

````json POST /api/v1/users.setActiveStatus
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "User Management"
  },
  "servers": [
    {
      "url": "https://apiexplorer.support.rocket.chat"
    }
  ],
  "tags": [
    {
      "name": "LDAP"
    },
    {
      "name": "Permissions"
    },
    {
      "name": "Roles"
    },
    {
      "name": "Users"
    }
  ],
  "paths": {
    "/api/v1/users.setActiveStatus": {
      "post": {
        "summary": "Set User's Status Active",
        "operationId": "post-api-v1-users.setActiveStatus",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "active": {
                          "type": "boolean"
                        }
                      }
                    },
                    "success": {
                      "type": "boolean"
                    }
                  }
                },
                "examples": {
                  "Success Example": {
                    "value": {
                      "user": {
                        "_id": "jJNyu4BQFqdgEcqnR",
                        "active": "false"
                      },
                      "success": "true"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    },
                    "errorType": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "success": "false",
                      "error": "must have required property 'activeStatus'\n[invalid-params]",
                      "errorType": "invalid-params"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/authorizationError"
          }
        },
        "description": "Activate or deactivate a user in the workspace.\n\nAny one of the following permissions is required:\n* `edit-other-user-active-status`: Change another user's active status.\n* `manage-moderation-actions`: Manage moderation actions on reported users.\n\nWhen a user is deactivated (`activeStatus=false`), Rocket.Chat revokes all of the user's login tokens and OAuth access tokens, refresh tokens, and authorization codes. The user can no longer call the REST API with previously issued OAuth credentials.\n\n### Changelog\n| Version      | Description |\n| ---------------- | ------------|\n|8.5.0            | Added OAuth access token, refresh token, and authorization code revocation on deactivation. |\n|3.7.0            | Added `confirmRelinquish` to the payload.       |\n|0.75.0            | Added       |",
        "parameters": [
          {
            "$ref": "#/components/parameters/UserId"
          },
          {
            "$ref": "#/components/parameters/Auth-Token"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "x-examples": {
                  "Example 1": {
                    "activeStatus": "false",
                    "userId": "5HmCfpoB7jp2uibTC"
                  }
                },
                "properties": {
                  "activeStatus": {
                    "type": "boolean",
                    "description": "The value of the active status.",
                    "default": "true"
                  },
                  "userId": {
                    "type": "string",
                    "description": "The user ID whose status value is to be changed.",
                    "example": "5HmCfpoB7jp2uibTC"
                  },
                  "confirmRelinquish": {
                    "type": "boolean",
                    "default": "false",
                    "description": "Allows the user to be deactivated even if it is the last owner of a room. If `activeStatus=false` & `confirmRelinquish=true` and the user is the last remaining owner of a room, the oldest member of that room will be chosen as the new owner."
                  }
                },
                "required": [
                  "activeStatus",
                  "userId"
                ]
              }
            }
          },
          "description": "If `activeStatus=false` & `confirmRelinquish=true` and the user is the last remaining owner of a room, the oldest member of that room will be chosen as the new owner."
        },
        "tags": [
          "Users"
        ]
      }
    }
  },
  "components": {
    "responses": {
      "authorizationError": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "Authorization Error": {
                "value": {
                  "status": "error",
                  "message": "You must be logged in to do this."
                }
              }
            }
          }
        }
      }
    },
    "parameters": {
      "UserId": {
        "name": "X-User-Id",
        "in": "header",
        "description": "The authenticated user ID.",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "rbAXPnMktTFbNpwtJ"
      },
      "Auth-Token": {
        "name": "X-Auth-Token",
        "in": "header",
        "description": "The authenticated user token.",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "RScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f"
      }
    }
  }
}
````

