Skip to main content

Client API Endpoints

Client-facing API endpoints serve authenticated end-users (non-admin). These routes handle the client dashboard, item submissions, favorites management, and public item interactions such as comments, votes, and views.

Client Dashboard & Items (/api/client)

All /api/client/* routes require an authenticated session with a valid clientProfileId.

Dashboard

MethodPathDescription
GET/api/client/dashboard/statsClient dashboard statistics (items count, views, engagement)

Client Items

MethodPathDescription
GET/api/client/itemsList items submitted by the current client
POST/api/client/itemsSubmit a new item for review
GET/api/client/items/statsClient item statistics (published, pending, rejected)
GET/api/client/items/coordinatesGet coordinates for client's items
GET/api/client/items/[id]Get item details
PUT/api/client/items/[id]Update own item
DELETE/api/client/items/[id]Delete own item (soft delete)
POST/api/client/items/[id]/restoreRestore a soft-deleted item

Geo Stats

MethodPathDescription
GET/api/client/geo-statsGeographic statistics for client items

Public Item Interactions (/api/items)

These endpoints handle public-facing item features. Some require authentication (e.g., voting), while others are fully public (e.g., viewing).

Comments

MethodPathDescriptionAuth
GET/api/items/[slug]/commentsList comments for an itemPublic
POST/api/items/[slug]/commentsAdd a commentRequired
GET/api/items/[slug]/comments/[commentId]Get comment detailsPublic
PUT/api/items/[slug]/comments/[commentId]Update own commentRequired
DELETE/api/items/[slug]/comments/[commentId]Delete own commentRequired

Comment Ratings

MethodPathDescriptionAuth
GET/api/items/[slug]/comments/ratingGet rating summaryPublic
POST/api/items/[slug]/comments/ratingSubmit a ratingRequired
GET/api/items/[slug]/comments/rating/[commentId]Get rating for a commentPublic

Votes

MethodPathDescriptionAuth
GET/api/items/[slug]/votes/countGet vote countPublic
GET/api/items/[slug]/votes/statusGet current user's vote statusRequired
POST/api/items/[slug]/votesVote on an item (upvote/downvote)Required

Views

MethodPathDescriptionAuth
POST/api/items/[slug]/viewsRecord a page viewPublic

Engagement & Popularity

MethodPathDescriptionAuth
GET/api/items/engagementGet engagement metrics for itemsPublic
GET/api/items/popularity-scoresGet calculated popularity scoresPublic

Company

MethodPathDescriptionAuth
GET/api/items/[slug]/companyGet company info for an itemPublic

Favorites (/api/favorites)

Manage user's favorite items. All favorites endpoints require authentication.

MethodPathDescription
GET/api/favoritesList current user's favorite items
POST/api/favorites/[itemSlug]Toggle favorite status for an item
DELETE/api/favorites/[itemSlug]Remove item from favorites

User Profile (/api/user)

User profile and subscription management endpoints.

MethodPathDescription
GET/api/user/profile/locationGet user's detected location
GET/api/user/currencyGet user's detected/preferred currency
GET/api/user/plan-statusGet current subscription plan status
GET/api/user/subscriptionGet subscription details
GET/api/user/paymentsGet payment history

Current User (/api/current-user)

MethodPathDescription
GET/api/current-userGet authenticated user session data

Endpoints for users managing their own sponsored advertisements.

MethodPathDescription
GET/api/sponsor-ads/userList user's sponsor ads
GET/api/sponsor-ads/user/statsUser ad performance statistics
GET/api/sponsor-ads/user/[id]Get ad details
PUT/api/sponsor-ads/user/[id]Update own ad
POST/api/sponsor-ads/user/[id]/cancelCancel own ad
POST/api/sponsor-ads/user/[id]/renewRenew expired ad

Surveys (/api/surveys)

Survey management and response collection.

MethodPathDescriptionAuth
GET/api/surveysList published surveysPublic
GET/api/surveys/[surveyId]Get survey detailsPublic
POST/api/surveys/[surveyId]/responsesSubmit a survey responsePublic
GET/api/surveys/responses/[responseId]Get response detailsRequired

Reports (/api/reports)

MethodPathDescriptionAuth
POST/api/reportsSubmit a content reportRequired

Public Data Endpoints

These endpoints require no authentication:

MethodPathDescription
GET/api/categories/existsCheck if a category slug exists
GET/api/collections/existsCheck if a collection slug exists
GET/api/featured-itemsList featured items
GET/api/sponsor-adsGet active sponsor ads for display
POST/api/sponsor-ads/checkoutInitiate sponsor ad checkout

Pagination Patterns

Client-facing list endpoints support the standard pagination parameters:

GET /api/client/items?page=1&limit=10&sort=createdAt&order=desc
GET /api/items/[slug]/comments?page=1&limit=20
GET /api/favorites?page=1&limit=50

Responses include pagination metadata:

{
"success": true,
"data": [...],
"pagination": {
"page": 1,
"limit": 10,
"total": 45,
"totalPages": 5
}
}