DELETE
/
api
/
v1
/
chat
/
blocks
/
:userId
Unblock a user
curl --request DELETE \
  --url https://api.example.com/api/v1/chat/blocks/:userId
import requests

url = "https://api.example.com/api/v1/chat/blocks/:userId"

response = requests.delete(url)

print(response.text)
const options = {method: 'DELETE'};

fetch('https://api.example.com/api/v1/chat/blocks/:userId', 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/:userId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);

$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/:userId"

req, _ := http.NewRequest("DELETE", url, nil)

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.delete("https://api.example.com/api/v1/chat/blocks/:userId")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/api/v1/chat/blocks/:userId")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)

response = http.request(request)
puts response.read_body

Overview

Removes the directed block callerUserId → :userId. Because block is directed, calling unblock only removes the row the caller created. If the other user has also blocked the caller, that other block remains and areBlockedEither still returns true — so the chat surface stays sealed from the caller’s perspective. The endpoint is idempotent: calling unblock when no block exists is a no-op and returns unblocked: false. The status code is still 200 — the resource is in the desired state.

Authentication

Bearer <accessToken> required. requireOnboarded middleware applied.

Path parameters

NameTypeRequiredNotesExample
userIdstringyes24-char hex ObjectId of the user to unblock.66400a8f1c2b4d5e6f7a8b01

Query parameters

None.

Request body

None.

Response — 200 OK

FieldTypeNotesExample
unblockedbooleantrue if a row was removed by this call. false if there was no block to remove (idempotent no-op).true

Example response (block removed)

{
  "unblocked": true
}

Example response (no-op — no block existed)

{
  "unblocked": false
}

Error responses

StatusCodeMeaning
400VALIDATION_FAILED:userId is missing from the path. (Mongoose ObjectId validation is forgiving here — non-hex values return unblocked: false rather than 400.)
401UNAUTHENTICATEDMissing, malformed, or expired access token.
403ONBOARDING_INCOMPLETECaller has not finished onboarding.

Side effects

  • If a blocks row existed for (caller, :userId), it is deleted.
  • Future contact between the two users is permitted only if there is no remaining block in either direction.
Unblocking does NOT automatically re-open a previously-closed conversation. If the conversation was created before either block, it still exists and status is unchanged; the gates simply stop firing.

See also

curl

curl -X DELETE https://api.swappr.co.uk/api/v1/chat/blocks/66400a8f1c2b4d5e6f7a8b01 \
  -H "Authorization: Bearer $ACCESS_TOKEN"