Ban user (from report)
curl --request POST \
--url https://api.example.com/api/v1/admin/reports/:id/banimport requests
url = "https://api.example.com/api/v1/admin/reports/:id/ban"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/v1/admin/reports/:id/ban', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/admin/reports/:id/ban",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/admin/reports/:id/ban"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/admin/reports/:id/ban")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/admin/reports/:id/ban")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyReports
Ban user (from report)
Terminally ban the accused user. Revokes refresh tokens, sets bannedAt + status=BANNED, transitions report OPEN → BANNED.
POST
/
api
/
v1
/
admin
/
reports
/
:id
/
ban
Ban user (from report)
curl --request POST \
--url https://api.example.com/api/v1/admin/reports/:id/banimport requests
url = "https://api.example.com/api/v1/admin/reports/:id/ban"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/v1/admin/reports/:id/ban', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/admin/reports/:id/ban",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/admin/reports/:id/ban"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/admin/reports/:id/ban")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/admin/reports/:id/ban")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyOverview
Terminally bans the user named as the accused on this report. Internally this delegates to the same code path asPOST /admin/users/:id/ban — there is exactly one ban implementation:
- Sets
users.bannedAt = now,users.bannedReason = banReason,users.status = BANNED. - Revokes all active refresh tokens for the user (the user is logged out of every device on next API call).
- Transitions the report from
OPEN→BANNEDwithresolvedBy,resolvedAt,resolutionReason = banReason.
BANNED report returns the row unchanged. Re-banning a user who is already banned is a no-op (no double-stamp).
See Ban user for the user-side ban semantics and admin auth and MFA for how revoked refresh tokens propagate.
Authentication
Bearer <accessToken> with scope: 'admin' required.
Role-gated: SUPER or MODERATOR.
FINANCE admins are read-only on the reports surface. Ban is destructive and immediately locks the user out — handle with care.Path parameters
| Field | Type | Required | Notes | Example |
|---|---|---|---|---|
id | string | yes | The report id from the list endpoint. 1..64 chars. | 665a3f1e9c2b0a0001a4d201 |
Query parameters
None.Request body
| Field | Type | Required | Notes | Example |
|---|---|---|---|---|
banReason | string | yes | 1..500 chars. Stored on both users.bannedReason AND reports.resolutionReason. Surfaced to the user as ACCOUNT_BANNED detail on their next API call. | Repeated harassment after prior warning. |
Example payload
{
"banReason": "Repeated harassment after prior warning."
}
Response — 200 OK
Returns the full updated report row.
| Field | Type | Notes |
|---|---|---|
id | string | Report id. |
status | string | Always "BANNED". |
resolvedBy | string | The admin id (from the bearer token). |
resolvedAt | string (ISO 8601) | Server clock at the moment of resolution. |
resolutionReason | string | Echo of banReason. |
{
"id": "665a3f1e9c2b0a0001a4d201",
"status": "BANNED",
"resolvedBy": "664f99...",
"resolvedAt": "2026-05-23T09:14:11.412Z",
"resolutionReason": "Repeated harassment after prior warning.",
"...": "...remaining report fields per /api-reference/admin/reports/list..."
}
Error responses
| Status | Code | Meaning |
|---|---|---|
| 400 | VALIDATION_FAILED | banReason missing, empty, or longer than 500 chars. |
| 401 | UNAUTHENTICATED | Missing / malformed / expired admin token, or non-admin scope. |
| 403 | FORBIDDEN | Caller is a FINANCE admin. SUPER or MODERATOR required. |
| 404 | NOT_FOUND | No report exists with that id, or the accused user no longer exists. |
| 409 | STATE_CONFLICT | Report is in DISMISSED or WARNED — terminal states never transition. |
Example error — 403 FORBIDDEN
{
"type": "https://api.swappr.co.uk/errors/forbidden",
"title": "Forbidden",
"status": 403,
"code": "FORBIDDEN",
"detail": "Admin role FINANCE is not permitted for this action",
"instance": "/api/v1/admin/reports/665a.../ban",
"requestId": "01HZQ7K3M4N5P6Q7R8S9T0V1W2"
}
Side effects
| Effect | Notes |
|---|---|
| User row | bannedAt, bannedReason, status = BANNED set. |
| Refresh tokens | All active refresh tokens revoked. The user is logged out of every device on next API call. |
| Report row | status = BANNED, resolvedBy, resolvedAt, resolutionReason set. |
| Audit row | action: report.ban, targetType: report, targetId: <reportId>. The downstream ban path also writes its own user.ban audit row. |
Unlike warn, ban does not send a push or email to the banned user. They will discover the ban on their next API call (which returns
403 ACCOUNT_BANNED with the banReason in detail).See also
- Ban user (direct) — the underlying ban path.
- Unban user — reverse a ban (does NOT reopen the report).
- Dismiss report / Warn user — milder resolutions.
curl
curl -X POST https://api.swappr.co.uk/api/v1/admin/reports/665a3f1e9c2b0a0001a4d201/ban \
-H "Authorization: Bearer $ADMIN_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"banReason":"Repeated harassment after prior warning."}'
Postman
Seedocs/postman/swappr.postman_collection.json → Admin Reports → Ban.