BIO.RE
User

Unblock a User

Remove a previously blocked user from the caller's block list. Returns 404 if no block row exists for this pair.

DELETE /api/v1/users/block/:userId — 🔑 Bearer

Removes the BlockList row for the (ownerId, blockedId) pair. Not idempotent — if no row exists, returns 404 user.block.not_blocked so the caller knows nothing changed. The opposite direction (other user blocking this user) is unaffected.

The path mirrors POST /users/block/:userId exactly — same param, same auth. Method (POST vs DELETE) is the only differentiator.

Request

Path parameters

ParamTypeValidationNotes
userIdstring (UUID)ParseUUIDPipeThe user to unblock

No body.

HeaderRequiredNotes
Authorization: Bearer <accessToken>JWT from POST /auth/login

Response

200 OKSuccessOnlyResponseDto

{
  "success": true
}
FieldTypeNotes
successbooleanAlways true on 200

Errors

HTTPcode / i18nKeyReason
400(validation)userId not a valid UUID
401(guard)Missing / invalid bearer token
404user.block.not_blockedNo BlockList row exists for this owner/blocked pair

Side effects

  1. prisma.blockList.findFirst({ where: { ownerId, blockedId } }). If absent → not_blocked.
  2. prisma.blockList.delete({ where: { id: existing.id } }).
  3. Audit log (info level): [block] User {ownerId} unblocked {blockedId}.

Code samples

curl -X DELETE https://api.bio.re/api/v1/users/block/f0e1d2c3-b4a5-6789-0123-456789abcdef \
  -H "Authorization: Bearer $ACCESS_TOKEN"
async function unblockUser(accessToken: string, blockedUserId: string): Promise<void> {
  const res = await fetch(`https://api.bio.re/api/v1/users/block/${blockedUserId}`, {
    method: 'DELETE',
    headers: { Authorization: `Bearer ${accessToken}` },
  });
  const json = await res.json();
  if (!res.ok || !json.success) {
    throw Object.assign(new Error(json?.error?.message ?? 'Unblock failed'), {
      code: json?.error?.code,
    });
  }
}
import { useMutation, useQueryClient } from '@tanstack/react-query';

export function useUnblockUser() {
  const qc = useQueryClient();
  return useMutation({
    mutationFn: async (blockedUserId: string) => {
      const res = await fetch(`/api/v1/users/block/${blockedUserId}`, { method: 'DELETE' });
      const json = await res.json();
      if (!res.ok || !json.success) {
        throw Object.assign(new Error(json?.error?.message ?? 'Unblock failed'), {
          code: json?.error?.code,
          i18nKey: json?.error?.i18nKey,
        });
      }
    },
    onSuccess: () => {
      qc.invalidateQueries({ queryKey: ['users', 'blocked'] });
    },
  });
}

Try it

DELETE
/api/v1/users/block/{userId}
AuthorizationBearer <token>

In: header

Path Parameters

userId*string

Response Body

application/json

application/json

application/json

curl -X DELETE "https://loading/api/v1/users/block/string"
{
  "success": true
}
{
  "success": false,
  "error": {
    "code": "AUTH_UNAUTHORIZED",
    "message": "Invalid credentials",
    "i18nKey": "auth.login.invalid_credentials",
    "i18nVars": {
      "field": "email"
    },
    "details": [
      {
        "message": "email must be an email"
      }
    ],
    "correlationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
}
{
  "success": false,
  "error": {
    "code": "AUTH_UNAUTHORIZED",
    "message": "Invalid credentials",
    "i18nKey": "auth.login.invalid_credentials",
    "i18nVars": {
      "field": "email"
    },
    "details": [
      {
        "message": "email must be an email"
      }
    ],
    "correlationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
}

Source

SourcePathLines
Controllerapps/api-core/src/modules/user/user.controller.ts298–306 (unblockUser)
DTO (response)apps/api-core/src/common/dto/common-response.dto.tsSuccessOnlyResponseDto
Serviceapps/api-core/src/modules/user/user.service.ts779–786 (unblockUser)
Prisma modelpackages/prisma/prisma/schema.prismaBlockList

On this page