Skip to content

API Reference

_david edited this page Aug 21, 2026 · 1 revision

API Reference

All /api/v1/* routes require a JWT (Authorization: Bearer <token>) except /auth/*. Interactive docs: GET /api-docs (Swagger UI), raw spec at GET /api-docs.json.

Auth — /api/v1/auth (rate limit: 150 req/15min)

Method Path Description
POST /register Create account. Body: { email, password, repassword }
POST /login Returns access + refresh tokens. GET /login also works (deprecated)
POST /logout Blacklist the current access token
POST /refresh Rotate tokens; blacklists the old refresh token

All responses honor Accept-Language: en (default: Vietnamese) as of v1.1.0 — see Authentication.

⚠️ POST /api/v2/auth/register and /login exist but run a separate, less-maintained code path — see Architecture.

Candidate — /api/v1/candidate

Method Path Description
GET /:email Get profile by email (password field is stripped)
PUT /update Full update — self only (req.user._id, ignores any _id in the body)
PATCH /update Partial update — same self-only rule
DELETE / Delete own account and cascade-delete all 7 CV section collections. Self only, no confirmation step. Added 2026-08-21.

CV Sections — all 7 follow the same shape

Sections: education, experience, award, certificate, project, reference, generalInformation (mounted as general-information in the URL, despite the doc/model name using camelCase).

Method Path Description
GET / List all entries for the authenticated candidate
POST /create Create entry
PUT /update Update entry — ownership checked against the existing document's candidateId
DELETE /delete/:id Delete by ID — ownership checked

generalInformation additionally has PATCH /update for partial updates.

Free-text fields (description on education/experience/award/certificate/project, generalInformation.career/careerGoal) are { vi: string, en: string } objects on create/update — see Data Models.

Public / misc

Method Path Auth Description
GET /health none Health check, exempt from rate limiting
GET /api/me/:email none Aggregated public profile (candidate + generalInformation + all CV sections). Accepts ?lang=vi|en to resolve localized fields to a single string (default vi, falls back to whichever language has content).
GET /api/v1/download-pdf token via ?token= query param Export CV as PDF. Also accepts ?lang=vi|en.
GET /api-docs none Swagger UI
GET /api-docs.json none Raw OpenAPI spec

Example: register → login → create an education entry

curl -X POST https://nodejs-resume-api-ts.onrender.com/api/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email":"me@example.com","password":"MyPass123!","repassword":"MyPass123!"}'

TOKEN=$(curl -s -X POST https://nodejs-resume-api-ts.onrender.com/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"me@example.com","password":"MyPass123!"}' | jq -r .data.token)

curl -X POST https://nodejs-resume-api-ts.onrender.com/api/v1/education/create \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"_id":null,"school":"My University","major":"Computer Science","startDate":1600000000000,"endDate":1700000000000,"isCurrent":false,"description":{"vi":"Mô tả","en":"Description"}}'

Clone this wiki locally