Suspend user

POSThttps://app.speybooks.com/api/v1/admin/users/{id}/suspend

Suspend or permanently ban a user account.

The account is made inactive and the reason and time are recorded against it. Any active sessions are ended immediately, so the user is logged out at once. A suspension can be reversed; a ban is the permanent form of the same action.

Two protections apply: an admin cannot suspend their own account, and admin accounts cannot be suspended through this endpoint.

Request Body

  • reason: minimum 5 characters, required
  • permanent: boolean (default false). True records a ban, false a reversible suspension

Records a USER_SUSPENDED or USER_BANNED action in the audit log.

Error responses:

  • 400 { code: "SELF_SUSPEND" }: cannot suspend yourself
  • 400 { code: "CANNOT_SUSPEND_ADMIN" }: admin users are protected
  • 404 { code: "NOT_FOUND" }: user not found

Path parameters

idstringrequired
User ID.

Body parameters

reasonstringrequired
Suspension reason (audit trail). Min 5 characters.
min length: 5
permanentbooleanoptional
True for permanent ban, false for temporary suspension. Default false.

Response

200User suspended (or banned if permanent). All sessions invalidated.
Show response fields
messagestring

Error codes

400Cannot suspend yourself or admin users.
404User not found.