---
title: Activate/Deactivate a User
slug: activatedeactivate-a-user
docTags: 
createdAt: 2024-10-09T15:25:48.855Z
---

### API Endpoint Documentation: `/api/users/manage-status`

This endpoint allows you to manage the status of a user in the system by sending a POST request. It is typically used for administrative purposes to update user statuses, such as activating or deactivating a user.

`POST`

:::BlockQuote
https\://admin.\<your-site>.com/api/users/manage-status
:::

- **accept**: application/json
  Specifies that the request expects a JSON response.
- **accept-language**: en-US,en;q=0.9
  Sets the preferred language for the response.
- **authorization**: Bearer \<JWT Token>
  A JSON Web Token (JWT) that authenticates the request. Replace \<JWT Token> with a valid token.
- **content-type**: application/json
  Specifies the format of the request body, which is JSON.

The request body should be in JSON format, containing the following fields:

- **id**: string
  The ID of the user whose status is being managed.
- **token**: string
  A valid authentication token (JWT) that provides permission for this operation.

`JSON`

:::BlockQuote
\{
&#x20; "id": "634441cecbb5901d133039f8",
&#x20; "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
:::

`POST`: Sends a request to update the user's status.

:::BlockQuote
fetch("https\://admin.\<your-site>.com/api/users/manage-status", \{
&#x20; "headers": \{
&#x20;   "accept": "application/json",
&#x20;   "accept-language": "en-US,en;q=0.9",
&#x20;   "authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
&#x20;   "content-type": "application/json"
&#x20; },
&#x20; "body": "\{\\"id\\":\\"634441cecbb5901d133039f8\\",\\"token\\":\\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\\"}",
&#x20; "method": "POST"
});
:::

The API will return a JSON response indicating the success or failure of the operation.

`[Success] 200`

:::BlockQuote
\{
&#x20; "message": "User status updated successfully",
&#x20; "status": "success"
}
:::

`[Failure] 401`

:::BlockQuote
\{
&#x20; "message": "Invalid token or user ID",
&#x20; "status": "error"
}
:::

This API requires a valid JWT token for authentication. Ensure that the token is included in the authorization header as Bearer \<JWT Token>.

- Ensure that the id in the request body matches the user whose status you want to manage.
- The request must include a valid JWT token for authentication. Without it, the request will be rejected with a 401 Unauthorized error.

