Admin API Reference

API endpoints for admin dashboard and user management

Overview

Admin-specific API endpoints require the admin role and use assertAdmin() from @zooly/util-srv for authentication. This page covers the user management endpoint. For offer admin endpoints (bouncer queue, approve, reject), see Offers API Reference.


List Users

Lists accounts with optional search, pagination, and brand limits (blocked status).

Endpoint: GET /api/admin/users

Auth: Admin role required

Query Parameters:

ParamTypeDefaultDescription
searchstringFilter by display name or slug (case-insensitive)
limitnumber50Max accounts to return (max: 100)
offsetnumber0Pagination offset

Response (200):

FieldTypeDescription
accountsAccount[]Matching accounts
totalnumberTotal count for pagination
brandLimitsRecord<string, { isBlocked, blockedReason }>Blocked status per account

Implementation: apps/zooly-app/app/api/admin/users/route.ts


Block / Unblock User

Blocks or unblocks a user account. Blocked users cannot create or accept offers.

Endpoint: POST /api/admin/users

Auth: Admin role required

Request Body:

FieldTypeRequiredDescription
accountIdstringYesAccount to block/unblock
action"block" or "unblock"YesAction to perform
reasonstringWhen blockingReason for block (stored in brand_limits)

Response (200): { success: true, accountId, action }

Errors:

  • 400 — missing accountId or action
  • 403 — not an admin

DB access:

FunctionLocationDescription
blockAccount(accountId, reason, adminAccountId)packages/db/src/access/brandLimits.tsUpserts brand_limits with isBlocked = true
unblockAccount(accountId, adminAccountId)packages/db/src/access/brandLimits.tsSets isBlocked = false

Implementation: apps/zooly-app/app/api/admin/users/route.ts


Resolve Dispute (Admin)

Resolves a disputed offer. See Dispute Resolution for full details.

Endpoint: POST /api/offers/admin/resolve-dispute

Implementation: apps/zooly-app/app/api/offers/admin/resolve-dispute/route.ts