Skip to main content

Endpoint

POST /api/users/{username}/block

Authentication

This endpoint requires authentication.

Path Parameters

username
string
required
The username of the user to block

Request Body

userName
string
required
The username of the account initiating the block action

Request Example

curl -X POST https://api.example.com/api/users/johndoe/block \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "userName": "yourUsername"
  }'

Response

status
number
Returns 204 No Content on successful block

BlockedAccount Object

The block action creates a BlockedAccount record with a composite key:
BlockingUserID
integer
The user ID of the account initiating the block
BlockedAccountId
integer
The user ID of the blocked account

Error Responses

404 Not Found
error
  • "This account does not exist" - The initiating account was not found
  • "This user does not exist" - The target username was not found
403 Forbidden
error
Returned when attempting to block yourself
409 Conflict
error
"Account already blocked this user" - The user is already blocked

Build docs developers (and LLMs) love