/api/auth/registerCreate a member account and receive a JWT for mobile storage.
- Body
- { email, username, password }
- Returns
- 201 { token, user }
- Errors
- 400 invalid JSON; 409 email or username taken; 422 validation
Quesday REST API
These endpoints are the stable REST contract exposed by the Next.js backend for the Expo app. The web client should keep using Server Actions for in-app workflows.
Base URL
/api
Auth
JWT bearer
Response format
JSON
Register or login, then store token from { token, user } in Expo SecureStore.
Send Authorization: Bearer <token> on authenticated calls. On any 401, clear the token and route to login.
Load communities with GET /api/communities, then GET /api/communities/[slug] for detail tabs.
Use GET /api/communities/[slug]/questions for archives and GET /api/communities/[slug]/questions/[id] before answering.
Submit answers with POST /api/communities/[slug]/questions/[id]/answers, then show result, explanation, and unlocked comments.
Use cursor pagination for comments and broadcasts; use offset pagination for communities and questions.
Headers
Content-Type: application/json
Authorization: Bearer <token>Dynamic path segments use square brackets to match the Next.js route names. All timestamps are ISO 8601 strings.
/api/auth/registerCreate a member account and receive a JWT for mobile storage.
/api/auth/loginAuthenticate by email and password.
/api/auth/meResolve the current JWT into the signed-in user.
/api/communitiesList discoverable communities with viewer membership flags when signed in.
/api/communitiesCreate a community. This is exposed in REST, though creator-heavy flows live on web.
/api/communities/[slug]Fetch one community by slug.
/api/communities/[slug]/joinJoin a community as a member.
/api/communities/[slug]/joinLeave a joined community.
/api/communities/[slug]/questionsList scheduled and published questions for a community with viewer answer summaries.
/api/communities/[slug]/questionsCreate a question as a community creator.
/api/communities/[slug]/questions/[id]Fetch answer-state-aware question detail for the signed-in member.
/api/communities/[slug]/questions/[id]/answersSubmit one multiple-choice answer and receive grading plus explanation.
/api/communities/[slug]/questions/[id]/commentsList unlocked question comments with one reply level.
/api/communities/[slug]/questions/[id]/commentsPost a top-level comment or one-level reply after answering.
/api/communities/[slug]/questions/[id]/comments/[commentId]Soft-delete a comment. Authors and same-community creators can delete.
/api/communities/[slug]/broadcastsList community broadcast posts. Some communities may require membership.
/api/communities/[slug]/broadcastsCreate a creator broadcast post.
/api/communities/[slug]/broadcasts/[postId]Fetch one broadcast post.
/api/communities/[slug]/broadcasts/[postId]Edit an existing broadcast post as its author or an allowed creator.
/api/communities/[slug]/broadcasts/[postId]Soft-delete a broadcast post.
/api/communities/[slug]/leaderboardFetch the community leaderboard and signed-in viewer rank when available.
/api/users/[username]Fetch a public user profile for mobile profile screens.
/api/uploads/presignCreate a signed R2 upload target for images and attachments.
{ id, email, username, role: 'member' | 'admin', status: 'active' | 'suspended', createdAt }
{ id, slug, name, description, emoji, coverImageUrl, cadence, status, creatorUserId, category, isFeatured, featuredRank, directoryRank, memberCount, liveQuestionCount, unansweredQuestionCount, newBroadcastCount, currentUserRole, createdAt, updatedAt }
{ id, label, imageUrl, position, isCorrect }. isCorrect may be hidden as null until the solution is visible.
{ id, communityId, creatorUserId, prompt, explanation, imageUrl, scheduledFor, publishedAt, closesAt, timeZone, points, choiceCount, choices, viewerAnswer, createdAt, updatedAt }
QuestionSummary plus { currentUserRole, canAnswer, canSeeSolution, isClosed, isScheduled, result }.
{ id, questionId, selectedChoiceId, correctChoiceId, isCorrect, isLate, pointsAwarded, answeredAt, selectedChoice, correctChoice }
{ id, questionId, parentCommentId, author, body, deletedAt, createdAt, updatedAt, canDelete, replies }
{ id, communityId, author, body, imageUrl, publishedAt, createdAt, updatedAt, canEdit, canDelete }
{ rank, userId, username, points, lastScoringAnswerAt }
{ user: { id, username, joinedAt }, stats: { totalPoints, communityCount }, communities: [{ id, slug, name, role, joinedAt }] }
Error responses use JSON with an errorstring. Validation responses may also include fieldErrors keyed by field name.
REST routes support OPTIONS and return CORS headers through the shared API utility, so Expo web export and native clients can call the backend from configured origins.
{
"error": "Validation failed.",
"fieldErrors": {
"email": "Enter a valid email address."
}
}