---
title: "Convict user"
method: POST
path: "/api/admin/v1/user/convict"
tags: ["Admin Utils"]
---

# Convict user

`POST /api/admin/v1/user/convict`

Mark a user as convicted/banned by setting their trust level. Requires admin write permissions and authority to change the target user trust level.

## Request body

- object
  - `user_id` integer, required — Target user ID. id is also accepted as an alias.
  - `reason` string, required — Required justification; a blank reason returns 422.
  - `trust_level` 'blue' | 'red' | 'green' | 'yellow', required — Required. New trust level; must be a valid trust level key or a 422 is returned.
  - `notes` string — Optional notes stored on the audit log.

## Response `200`

successful

- object
  - `success` boolean
  - `message` string
  - `user` object
    - `id` integer
    - `username` string
    - `trust_level` string
    - `updated_at` string, date_time
  - `audit_log` object
    - `changed_by` string
    - `reason` string
    - `notes` string, nullable
    - `timestamp` string, date_time

## Other responses

- `403` — forbidden — Returned when the authenticated admin lacks write access (e.g. a viewer-level key) or is not permitted to change the target user's trust level.
- `404` — user not found
- `422` — invalid request — Returned when reason is blank, when trust_level is not a valid trust level, or when the change fails to apply.

---

[API](https://skmtc.net/hackclub/apis/hackatime-admin-api.md) · [All operations](https://skmtc.net/hackclub/apis/hackatime-admin-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/hackclub/hackatime-admin-api/versions/6ba07170a777/schema)
