# Suspend a user

`POST https://api.mothership.com/beta/users/{userId}/suspend`

Sandbox: `https://sandbox.api.mothership.com/beta/users/{userId}/suspend`

Suspends a user in your organization, as removing them from the People page does. They lose access to your organization right away, their status becomes `inactive`, and their past shipments and history stay. Suspending a user who is already inactive changes nothing. You can't suspend yourself, and an account Mothership suspended can't be changed. Only your organization's owners and managers can suspend users. Requires the `organization:user.suspend` permission.

## Authorization

Send your API token as a Bearer token: `Authorization: Bearer <token>`.

## Path parameters

- `userId` (string, required): ID of the user, from List users.

## Responses

### 200

The suspended user is wrapped inside an object named "data"

- `data` (object, required)
  - `id` (string, required): ID of the user.
  - `email` (string, required): Email address the user signs in with.
  - `firstName` (string, required)
  - `lastName` (string, required)
  - `role` (string, required, nullable): The highest role the user holds in the organization. `owner` can't be granted through the API. One of: `owner`, `manager`, `accountant`, `shipper`, `viewer`.
  - `status` (string, required): `active` users can sign in. Suspending a user through this API sets `inactive`. `suspended` means Mothership suspended the account, and it can't be changed through the API. One of: `active`, `inactive`, `suspended`.

### 400

The user is the token owner, or Mothership refused the status change. The message says which

- `code` (number, required) One of: `100`, `101`, `200`, `201`, `202`, `203`, `204`, `205`, `206`, `300`, `301`, `302`, `303`, `304`, `305`, `307`, `400`, `401`, `402`, `403`, `404`, `405`, `406`, `407`, `408`, `409`, `410`, `411`, `412`, `413`, `414`, `415`, `416`, `417`, `422`, `429`, `500`, `501`, `502`, `503`, `504`, `505`.
- `type` (string, required) One of: `UNKNOWN`, `NOT_FOUND`, `SERVER_ERROR`, `UNAUTHENTICATED`, `MISSING_PERMISSION`, `INVALID_REQUEST`, `RATE_LIMIT_EXCEEDED`, `CARGO_TOO_LARGE`, `NO_RATES_FOUND`, `QUOTE_NOT_PURCHASABLE`, `PAYMENT_REQUIRED`, `PAYMENT_FAILED`.
- `message` (string, required)
- `metadata` (object, optional)

### 404

No user with the given id exists in the caller organization

- `code` (number, required) One of: `100`, `101`, `200`, `201`, `202`, `203`, `204`, `205`, `206`, `300`, `301`, `302`, `303`, `304`, `305`, `307`, `400`, `401`, `402`, `403`, `404`, `405`, `406`, `407`, `408`, `409`, `410`, `411`, `412`, `413`, `414`, `415`, `416`, `417`, `422`, `429`, `500`, `501`, `502`, `503`, `504`, `505`.
- `type` (string, required) One of: `UNKNOWN`, `NOT_FOUND`, `SERVER_ERROR`, `UNAUTHENTICATED`, `MISSING_PERMISSION`, `INVALID_REQUEST`, `RATE_LIMIT_EXCEEDED`, `CARGO_TOO_LARGE`, `NO_RATES_FOUND`, `QUOTE_NOT_PURCHASABLE`, `PAYMENT_REQUIRED`, `PAYMENT_FAILED`.
- `message` (string, required)
- `metadata` (object, optional)

### 409

Mothership suspended the account, so it stays as it is

- `code` (number, required) One of: `100`, `101`, `200`, `201`, `202`, `203`, `204`, `205`, `206`, `300`, `301`, `302`, `303`, `304`, `305`, `307`, `400`, `401`, `402`, `403`, `404`, `405`, `406`, `407`, `408`, `409`, `410`, `411`, `412`, `413`, `414`, `415`, `416`, `417`, `422`, `429`, `500`, `501`, `502`, `503`, `504`, `505`.
- `type` (string, required) One of: `UNKNOWN`, `NOT_FOUND`, `SERVER_ERROR`, `UNAUTHENTICATED`, `MISSING_PERMISSION`, `INVALID_REQUEST`, `RATE_LIMIT_EXCEEDED`, `CARGO_TOO_LARGE`, `NO_RATES_FOUND`, `QUOTE_NOT_PURCHASABLE`, `PAYMENT_REQUIRED`, `PAYMENT_FAILED`.
- `message` (string, required)
- `metadata` (object, optional)

## Example request

```bash
curl --request POST \
  --url 'https://sandbox.api.mothership.com/beta/users/userId/suspend' \
  --header "Authorization: Bearer $MOTHERSHIP_API_TOKEN" \
  --header 'Accept: application/json'
```

## Example response (200)

```json
{
  "data": {
    "id": "3f1c2a9e-5b7d-4e8a-9c61-2d4f8b0e7a15",
    "email": "logistics@example.com",
    "firstName": "Dana",
    "lastName": "Reyes",
    "role": "owner",
    "status": "active"
  }
}
```