Skip to main content

API Modules โ€” Frontpics Image Marketplace

All routes are served under /api/v1. Authentication uses JWT access tokens and role guards. Request validation is primarily handled with shared Zod schemas from packages/shared.

Response Conventionsโ€‹

Most list endpoints return an envelope:

{
"data": [],
"meta": { "page": 1, "total": 50, "limit": 20 }
}

Some older endpoints return a plain object or array. Check the controller/service before changing a client call.

Auth โ€” /authโ€‹

MethodPathAuthDescription
POST/auth/registerPublicRegister buyer, photographer, moderator, payroll, or admin as permitted by the current registration flow. Creates wallet and role profile where applicable.
POST/auth/loginPublicReturns access token and sets refresh cookie.
POST/auth/refreshCookieRotates refresh token and returns a new access token.
POST/auth/logoutJWT/cookieInvalidates refresh token and clears cookie.
POST/auth/verify-emailPublicVerifies email with token.
POST/auth/forgot-passwordPublicSends reset link.
POST/auth/reset-passwordPublicResets password with token.

JWT validation returns { id, email, role }. Use user.id in services and controllers.

Users โ€” /usersโ€‹

MethodPathAuthDescription
GET/users/meJWTCurrent user with role profile.
PATCH/users/meJWTUpdate account fields.
PATCH/users/me/passwordJWTChange password.
GET/users/me/billingJWT buyerBuyer billing/profile details used for purchase references.

Use firstName and lastName; the User model has no displayName.

Images โ€” /imagesโ€‹

MethodPathAuthDescription
GET/imagesPublic/JWT optionalBrowse active images. Supports search, filters, sorting, pagination, purchase flags for authenticated buyers, and location filtering.
GET/images/:idPublic/JWT optionalImage detail with files, tags, location, photographer, purchase state, and download metadata where allowed.
GET/images/map-pinsPublic/JWT optionalMap pin data for images with coordinates.
GET/images/minePhotographerPhotographer's own images.
PATCH/images/:idPhotographer owner/adminEdit metadata where allowed.
DELETE/images/:idPhotographer owner/adminSoft-delete where allowed.
POST/images/:id/submitPhotographer ownerSubmit draft for review.
GET/images/:id/download/:orderItemIdBuyer owner/admin/moderatorReturn signed download URL and agency brand data.

Important fields:

  • Image.basePriceCredits
  • Image.imageTags
  • Image.status
  • ImageFile.cdnUrl
  • ImageFile.fileSizeBytes
  • Location.latitude / Location.longitude

Upload โ€” /uploadโ€‹

MethodPathAuthDescription
POST/upload/presignedPhotographer/admin/moderatorCreate presigned upload URLs for files.
POST/upload/check-duplicatesPhotographer/admin/moderatorCheck SHA-256 hashes against existing images.
POST/upload/confirmPhotographer/admin/moderatorCreate image records, locations, tags, and queue processing jobs.
GET/upload/status/:jobIdJWTPoll processing status.

The web upload UI uses EXIF GPS, reverse geocoding, address autocomplete, and manual coordinate fields. Location metadata is stored on Location and used by search/map.

Orders โ€” /ordersโ€‹

MethodPathAuthDescription
POST/ordersBuyerPurchase one or more images atomically.
GET/ordersBuyerOwn order history.
GET/orders/:idBuyer ownerOrder detail and download links.

Create request:

{
"items": [{ "imageId": "uuid" }],
"buyerReference": "Listing or invoice reference"
}

Business rules:

  • Buyer must have enough credits.
  • Duplicate active purchases for the same image are rejected.
  • Buyer wallet spend and photographer earnings happen in one transaction.
  • Purchased image access is represented by OrderItem.

Wallets โ€” /walletsโ€‹

MethodPathAuthDescription
GET/wallets/meJWTWallet balance and totals.
GET/wallets/me/transactionsJWTPaginated transaction history.

Payouts โ€” /payoutsโ€‹

MethodPathAuthDescription
POST/payouts/requestPhotographerRequest a manual bank-transfer payout.
GET/payoutsPhotographerOwn payout history.

Request body:

{
"amountCredits": 100,
"paymentMethod": "bank_transfer",
"note": "Invoice 123"
}

reference and billingReference are accepted as aliases for note.

Rules:

  • Minimum payout is 50 credits.
  • Photographer profile must have bankIban and bankAccountHolder.
  • Only one pending or processing payout is allowed per photographer.
  • Requesting a payout deducts/reserves credits immediately and creates a linked CreditTransaction.
  • Admin processing records the final payment reference in Payout.paymentRef.

Shooting Requests โ€” /shooting-requestsโ€‹

MethodPathAuthDescription
POST/shooting-requestsBuyerCreate a photoshoot request and reserve the configured fixed cost.
GET/shooting-requests/openPhotographer/adminList open jobs for available photoshoots.
GET/shooting-requests/my-ordersBuyerBuyer's own requests.
GET/shooting-requests/my-claimsPhotographerPhotographer's claimed jobs.
GET/shooting-requests/costBuyer/adminCurrent configured request cost.
GET/shooting-requests/:idJWTRequest detail.
POST/shooting-requests/:id/claimPhotographerClaim an open request.
POST/shooting-requests/:id/completeClaimed photographerMark claimed request completed.

Create requests accept address fields plus optional latitude and longitude. If coordinates are missing, the API uses the same Nominatim-style structured lookup as upload. Existing locations with missing coordinates are backfilled when possible.

Completing a shooting request credits the photographer wallet, but does not create a completed Payout by default.

Admin โ€” /adminโ€‹

All admin routes require Role.admin unless explicitly widened to moderator.

MethodPathDescription
GET/admin/statsDashboard stats including pending payouts and storage totals.
GET/admin/action-countsBadge counts: pending images, unread incoming emails, open feedback, pending payouts. Admin and moderator can call it.
GET/admin/usersUser list with filters.
PATCH/admin/users/:id/suspendSuspend user.
PATCH/admin/users/:id/activateActivate user.
PATCH/admin/users/:id/roleChange role.
POST/admin/users/:id/creditsManual credit adjustment.
PATCH/admin/users/:id/passwordAdmin password reset.
DELETE/admin/users/:idSoft-delete user.
GET/admin/images/pendingModeration queue.
GET/admin/imagesAll images with filters.
PATCH/admin/images/:id/approveApprove image.
PATCH/admin/images/:id/rejectReject image.
DELETE/admin/images/:idDelete/soft-delete image and storage objects where allowed.
GET/admin/payoutsPayout list, optionally filtered by status. Includes bank details and photographer request reference.
PATCH/admin/payouts/:id/processMark payout completed with admin payment reference.
PATCH/admin/payouts/:id/rejectReject payout and refund credits.
GET/admin/auditAudit log list.
GET/admin/brandsAgency brand list.
POST/PATCH/DELETE/admin/brandsManage centralized agency branding.
GET/PATCH/admin/settings/*Storage, image, credit, page, and processing settings.

Incoming Emails, Feedback, and Invoicesโ€‹

Additional modules support admin inboxes, feedback handling, and payroll/invoice reporting. These are implemented as separate Nest modules and web routes. Check the module controller before changing response assumptions.