Ugrás a fő tartalomhoz

API Reference

All API routes are located under src/app/api/. Authentication is handled via Auth.js JWT sessions.

Seller APIs

Membership & Dashboard

MethodEndpointDescription
GET/api/seller/membershipGet current user's organisation membership status
GET/api/seller/dashboardGet dashboard stats (active orders, pending requests, earnings, rating)
GET/api/seller/requestsGet cake requests matching seller's organisation capabilities
GET/api/seller/ordersGet seller's orders (query: ?filter=all|active|completed|cancelled)

Profile

MethodEndpointDescription
GET/api/profileGet current user profile
PATCH/api/profileUpdate profile (name, phone, imageUrl)

Organisation APIs

MethodEndpointDescription
POST/api/organisationsCreate new organisation
GET/api/organisations/{id}Get organisation details
GET/api/organisations/{id}/fullGet organisation with portfolio count and setup status
PATCH/api/organisations/{id}Update organisation settings or toggle active status
GET/api/organisations/searchSearch organisations (query: ?q=searchTerm)

Portfolio

MethodEndpointDescription
GET/api/organisations/{id}/portfolioList portfolio items
POST/api/organisations/{id}/portfolioAdd portfolio item (imageUrl, caption)
PUT/api/organisations/{id}/portfolioReorder portfolio items
DELETE/api/organisations/{id}/portfolio/{itemId}Delete portfolio item

Members

MethodEndpointDescription
GET/api/organisations/{id}/membersList organisation members
POST/api/organisations/{id}/membersRequest to join organisation
PATCH/api/organisations/{id}/members/{userId}Member action: approve, reject, remove, transfer_admin

Offer APIs

MethodEndpointDescription
POST/api/offersCreate offer for a request
PATCH/api/offers/{id}/withdrawWithdraw a pending offer

Order APIs

MethodEndpointDescription
PATCH/api/orders/{id}/statusUpdate order status (ready, delivered — in_progress is set automatically by the start-work cron)
PATCH/api/orders/{id}/mark-paid-offlineMark balance paid offline (body: { method: 'cash' | 'card_at_pickup' })
PATCH/api/orders/{id}/cancelCancel order (body: { reason: string })

Payment APIs

MethodEndpointDescription
GET/api/payments/org/{id}/earningsGet earnings summary (this month, last month, all time, pending)
GET/api/payments/org/{id}/historyGet payment history (query: ?type=all|deposit|balance|refund)
POST/api/payments/stripe-connect/onboardStart Stripe Connect onboarding (returns redirect URL)

Message APIs

MethodEndpointDescription
GET/api/messages/order/{orderId}Get messages for an order
GET/api/messages/offer/{offerId}Get messages for an offer
POST/api/messagesSend a message

Review APIs

MethodEndpointDescription
POST/api/reviewsCreate a review (rating + comment)

Image APIs

MethodEndpointDescription
POST/api/images/generate-sellerGenerate AI cake images for seller offers

Guest APIs

MethodEndpointDescription
POST/api/guest/convertConvert guest session to full user account

Admin APIs

MethodEndpointDescription
GET/api/admin/statsGet platform-wide statistics
GET/api/admin/ordersGet all orders (filterable)

Cron Endpoints

These should be called periodically by an external scheduler:

MethodEndpointFrequencyDescription
POST/api/requests/expireEvery few minutesExpire active requests past 24 hours
POST/api/offers/expire-holdsEvery few minutesClear expired 10-minute hold timers
POST/api/orders/start-workHourlyMove deposit_paid orders to in_progress 3 days before the desired date; notify buyer and seller
POST/api/orders/escrow-releaseEvery few minutesAuto-release escrow after 3 days