---
title: "Ban / Unban"
icon : "api"
description: "Set or clear a user's blacklist on a project."
---

# Ban / Unban

Both endpoints flip the `status` field on a user row. Both are idempotent.

## Ban a user

<Endpoint
  method="POST"
  path  ="https://api.envyauth.my.id/api/v3/projects/:project_uuid/users/:identifier/ban"
/>

Mark the user as banned. Optional body with a reason and an expiry.

```json
{
  "ban_reason": "Refund chargeback",
  "ban_until":  1764057600
}
```

| Field | Type | Notes |
|---|---|---|
| `ban_reason` | string | Optional, capped at 256 characters. The text is shown to the user on their loader kick dialog. |
| `ban_until` | number | Optional Unix timestamp in seconds. Omit or pass `null` for a permanent ban. Negative or non-finite values are silently treated as permanent. |

### Response

<CodeGroup tabs={[
  {
    title: '200 OK · Banned',
    lang : 'json',
    code : '{\n  "success": true,\n  "data": {\n    "banned":  true,\n    "already": false,\n    "user_id": "uuid"\n  },\n  "requestid": "uuid"\n}',
  },
  {
    title: '200 OK · Already',
    lang : 'json',
    code : '{\n  "success": true,\n  "data": {\n    "banned":  true,\n    "already": true,\n    "user_id": "uuid"\n  },\n  "requestid": "uuid"\n}',
  },
  {
    title: '404 Not Found',
    lang : 'json',
    code : '{\n  "success": false,\n  "error": "No user matches this identifier in this project",\n  "code":  "NOT_FOUND",\n  "requestid": "uuid"\n}',
  },
]} />

## Unban a user

<Endpoint
  method="POST"
  path  ="https://api.envyauth.my.id/api/v3/projects/:project_uuid/users/:identifier/unban"
/>

Clear the ban and remove the HWID-level block the ban created. No body required.

### Response

<CodeGroup tabs={[
  {
    title: '200 OK · Unbanned',
    lang : 'json',
    code : '{\n  "success": true,\n  "data": {\n    "unbanned": true,\n    "already":  false,\n    "user_id":  "uuid"\n  },\n  "requestid": "uuid"\n}',
  },
  {
    title: '200 OK · Already',
    lang : 'json',
    code : '{\n  "success": true,\n  "data": {\n    "unbanned": true,\n    "already":  true,\n    "user_id":  "uuid"\n  },\n  "requestid": "uuid"\n}',
  },
  {
    title: '404 Not Found',
    lang : 'json',
    code : '{\n  "success": false,\n  "error": "No user matches this identifier in this project",\n  "code":  "NOT_FOUND",\n  "requestid": "uuid"\n}',
  },
]} />

Unbanning restores `status` to `active` (or `no_hwid` if the user has no bound fingerprint) and removes the HWID-level block the original ban created.
