# Update user status

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

Enable or disable the specified user's workspace membership. When disabled, the user can no longer access the current workspace.

```text
POST https://moi.matrixorigin.cn/newmoi/user/update_status
```

## Preparation before calling

First [select the user](list-users.md#select-a-user) and confirm the membership to enable or disable.

Prepare a [personal access token](../../../../../guides/genesis/api-keys.md#manage-api-keys) and [target workspace ID](../../../../../guides/ai-studio/resource-center/workspace.md#copy-a-workspace-id) with the required permissions for the target workspace.

## Request parameters

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Input example

```bash
curl -X POST "https://moi.matrixorigin.cn/newmoi/user/update_status" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "user-001"
  }'
```

:::::
:::::{tab-item} Parameter description

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | User ID. |
| `action` | string | Yes | Status action. It must be `enable` or `disable`. |

:::::
::::::
:::::::
## Successful response

On success, the user has been enabled or disabled and `data` is `null`.

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": "OK",
  "msg": "OK",
  "data": null
}
```

:::::
:::::{tab-item} Field details

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | `OK` on success. |
| `msg` | string | `OK` on success. |
| `data` | null | Always `null` on success. |

:::::
::::::
:::::::

## Error response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": "INVALID_ARGUMENT",
  "msg": "请求参数无效",
  "data": null
}
```

:::::
:::::{tab-item} Field details

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | Error code. |
| `msg` | string | Error message. |
| `data` | null | — |

:::::
::::::
:::::::
