<!-- Generated by scripts/build-docs.js. Edit docs/swagger.yaml or docs/guides/, then run `npm run docs:build`. -->

# Dismiss a worker or undo a dismissal

`POST https://marketplace-api.sequifi.com/v1/users/termination`

Module: Users · operationId: `toggleUserDismissal` · Auth: `Authorization: Bearer <token>`
Web page: https://apidocs.sequifi.com/#/api/toggle-user-dismissal

Dismisses a worker, or undoes the dismissal if they already have one on file. There is no parameter to choose: each call flips the state, so a retried call undoes the first one. Check the worker's `status_id` with `GET /v1/users/{id}` before you call, and never retry this call automatically.

Dismissal does not block login. A dismissed worker can still sign in to the app. Login is controlled only by Suspend access in the web app, which this API does not change.

**Before you call:**

- Take `user_id` from `GET /v1/users`.
- Read `GET /v1/users/{id}` and decide from `status_id` whether the call should dismiss or undo a dismissal. A dismissal made through this endpoint sets `status_id` to `2`.

**What happens:**

- No dismissal on file: a dismissal dated today (UTC) is recorded and `status_id` becomes `2`. Sign-in is not changed. `message` is `Employee dismissed successfully`.
- A dismissal on file (made here or in the app): every dismissal record for the worker is deleted and `status_id` becomes `1` (active). Sign-in is not changed, so a worker whose access was suspended stays suspended until someone uses Restore access in the web app. `message` is `Employee enabled successfully`. This happens whatever the reason the worker was inactive.
- Any existing worker is accepted, whatever their status.
- Both outcomes return `201`. Only `message` tells you which one happened.
- This endpoint records no last working day. To record an effective-dated dismissal, including a past date, use `POST /v1/users/{id}/terminate`.

**Idempotency and retries:**

- Not safe to retry. If a call times out or the response is lost, read `GET /v1/users/{id}` and check `status_id` before deciding whether to call again.

**Formats:**

- `user_id` is an integer. A numeric string also works.
- The dismissal date is today's date in UTC. In US time zones that is already tomorrow from 5 pm Pacific (8 pm Eastern) during daylight saving time, an hour earlier in winter.

**Errors:**

- `400` `user_id is required` (missing, `0` or empty) or `Invalid JSON body`.
- `404` `User not found`.
- `401` when the token is missing, malformed, expired or revoked. It is rejected before the request is processed, so the body is only `{"message":"Unauthorized"}`, with no `status` or `data`.

**Related:**

- `GET /v1/users/{id}` to check the state before and after.
- `POST /v1/users/{id}/terminate` to record an effective-dated dismissal.

## Request body

- `user_id` (integer, **required**): Id of the worker to dismiss or whose dismissal to undo, from `GET /v1/users`. Minimum: 1. Example: `4821`.

Example

```json
{
  "user_id": 4821
}
```

## Example request

```bash
curl -X POST "https://marketplace-api.sequifi.com/v1/users/termination" \
  -H "Authorization: Bearer $SEQUIFI_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"user_id":4821}'
```

## Responses

### 201: Worker dismissed or dismissal undone. Read `message` to see which.

- `status` (integer): Always 201.
- `message` (string): The only indication of which way the toggle went. One of: `Employee dismissed successfully`, `Employee enabled successfully`.
- `data` (object)
  - `requestedBy` (string): Name of the API credential your token belongs to.

Example (dismissed): Worker dismissed

```json
{
  "status": 201,
  "message": "Employee dismissed successfully",
  "data": {
    "requestedBy": "acme"
  }
}
```

Example (enabled): Dismissal undone

```json
{
  "status": 201,
  "message": "Employee enabled successfully",
  "data": {
    "requestedBy": "acme"
  }
}
```

### 400: Missing user_id or malformed JSON

Example (missing_user_id): user_id missing, 0 or empty

```json
{
  "status": 400,
  "message": "user_id is required",
  "data": {}
}
```

### 401: Missing, malformed, expired or revoked token. Rejected before processing, so the body has only `message`.

```json
{
  "message": "Unauthorized"
}
```

### 404: No user with that id

```json
{
  "status": 404,
  "message": "User not found",
  "data": {}
}
```

### 500: Internal server error

```json
{
  "status": 500,
  "message": "Internal Server Error",
  "data": {}
}
```
