POST
Block a user

Overview

Records a directed block (callerUserId → blockedUserId) in the blocks collection. Block is directed, but every server-side gate uses areBlockedEither — a single block in either direction is enough to prevent contact. Consequences:
  • The handshake endpoint (create conversation from match) returns 403 CONVERSATION_BLOCKED for any existing match between the two users.
  • Send message (and the equivalent chat:message:send socket event) returns 403 CONVERSATION_BLOCKED if either side of an existing conversation tries to send.
  • The matcher (Phase 3+) treats a blocks row as a hard filter so no new match between the two users is ever produced.
Block is idempotent: calling it twice for the same blockedUserId is a no-op on the second call. The unique (blockerId, blockedId) index collapses the second insert into an update; the response is identical.

Authentication

Bearer <accessToken> required. requireOnboarded middleware applied.

Path parameters

None.

Query parameters

None.

Request body

Example payload

Response — 200 OK

Example response

Error responses

Example error — 400 (self-block)

Side effects

  • A blocks row is upserted with blockerId = caller, blockedId = blockedUserId. Re-calling with the same pair is a no-op.
  • Future calls to send message between the two users return 403 CONVERSATION_BLOCKED.
  • The matcher will not produce new matches between the two users.
Phase 4 does not automatically archive existing conversations on block — the conversation row remains, but every send is rejected at the gate. A future iteration may flip the conversation’s status to BLOCKED for clarity in admin tooling; mobile clients should NOT rely on status as the block signal — CONVERSATION_BLOCKED from a send attempt is the authoritative answer.

See also

curl