List blocked users
curl --request GET \
--url https://api.example.com/api/v1/chat/blocksimport requests
url = "https://api.example.com/api/v1/chat/blocks"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/chat/blocks', 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/chat/blocks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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/chat/blocks"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/chat/blocks")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/chat/blocks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyChat
List blocked users
List the users the caller has blocked, newest-first, enriched with name + avatar so a client can render the block list and unblock from it.
GET
/
api
/
v1
/
chat
/
blocks
List blocked users
curl --request GET \
--url https://api.example.com/api/v1/chat/blocksimport requests
url = "https://api.example.com/api/v1/chat/blocks"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/chat/blocks', 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/chat/blocks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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/chat/blocks"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/chat/blocks")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/chat/blocks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyOverview
Returns the users the authenticated caller has directed-blocked (callerUserId → blockedUserId), newest block first. Each entry is enriched with the blocked user’s display info (firstName, lastName, avatarUrl) using the same user-profile lookup the conversation inbox uses, so the block list renders without a per-row follow-up call.
Use each entry’s userId to unblock via DELETE /api/v1/chat/blocks/:userId.
The list is directed: it only contains blocks the caller created. Blocks that other users created against the caller are not returned.
Authentication
Bearer <accessToken> required. requireOnboarded middleware applied.
Path parameters
None.Query parameters
None. The endpoint returns the caller’s full block list (no pagination).Request body
None.Response — 200 OK
| Field | Type | Notes |
|---|---|---|
blockedUsers | array | The blocked users, newest block first. Empty array [] when the caller has blocked no one. |
blockedUsers[].userId | string | 24-char hex ObjectId of the blocked user. Pass this to DELETE /api/v1/chat/blocks/:userId to unblock. |
blockedUsers[].firstName | string | null | Blocked user’s first name. null if unset or the user record is gone. |
blockedUsers[].lastName | string | null | Blocked user’s last name. null if unset or the user record is gone. |
blockedUsers[].avatarUrl | string | null | Blocked user’s avatar URL. null if unset or the user record is gone. |
blockedUsers[].blockedAt | string | ISO-8601 timestamp the block was created. |
Example response (two blocks)
{
"blockedUsers": [
{
"userId": "66400a8f1c2b4d5e6f7a8b01",
"firstName": "Carol",
"lastName": "Clark",
"avatarUrl": "https://cdn.swappr.co.uk/avatars/carol.jpg",
"blockedAt": "2026-06-14T10:32:11.482Z"
},
{
"userId": "66400a8f1c2b4d5e6f7a8b02",
"firstName": "Bob",
"lastName": "Brown",
"avatarUrl": null,
"blockedAt": "2026-06-13T18:04:57.219Z"
}
]
}
Example response (no blocks)
{
"blockedUsers": []
}
Example response (blocked user record removed)
If a blocked user’s account is gone, the row is still returned (so the caller can still unblock) withnull profile fields:
{
"blockedUsers": [
{
"userId": "66400a8f1c2b4d5e6f7a8b03",
"firstName": null,
"lastName": null,
"avatarUrl": null,
"blockedAt": "2026-06-12T09:15:00.000Z"
}
]
}
Error responses
| Status | Code | Meaning |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, malformed, or expired access token. |
| 403 | ONBOARDING_INCOMPLETE | Caller has not finished onboarding. |
See also
- Block user — create a block.
- Unblock user — remove a block via
userIdfrom this list.
curl
curl https://api.swappr.co.uk/api/v1/chat/blocks \
-H "Authorization: Bearer $ACCESS_TOKEN"