API Reference
Detailed API endpoint documentation
API Reference
The backend provides a comprehensive RESTful API for accessing portfolio data.
Authentication
Admin endpoints require a Bearer token.
Authorization: Bearer <your_jwt_token>
Endpoints
Health Check
GET /api/health
Check API health status.
Response:
{
"status": "ok",
"timestamp": "2025-11-23T...",
"version": "3.0.0"
}
Auth
POST /api/auth/login
Login to get an access token.
Body:
{
"email": "[email protected]",
"password": "password"
}
Response:
{
"success": true,
"data": {
"token": "jwt_token_here",
"user": {
"id": 1,
"email": "[email protected]",
"name": "User Name"
}
}
}
Blog
GET /api/blog/posts
Get a paginated list of blog posts.
Query Params:
page: Page number (default: 1)limit: Items per page (default: 10)status:published|draft(default:published)tag: Filter by tag slug
GET /api/blog/posts/:slug
Get a single blog post by slug.
POST /api/blog/posts (Admin)
Create a new blog post.
PUT /api/blog/posts/:id (Admin)
Update a blog post.
DELETE /api/blog/posts/:id (Admin)
Delete a blog post.
Portfolio
GET /api/portfolio/projects
Get all portfolio projects.
Query Params:
featured:true|falsecategory: Filter by category
GET /api/portfolio/projects/:slug
Get a single project by slug.
POST /api/portfolio/projects (Admin)
Create a new project.
PUT /api/portfolio/projects/:id (Admin)
Update a project.
DELETE /api/portfolio/projects/:id (Admin)
Delete a project.
Resume
GET /api/resume
Get resume data.
PUT /api/resume (Admin)
Update resume information.
POST /api/resume/experience (Admin)
Add work experience.
PUT /api/resume/experience/:id (Admin)
Update work experience.
DELETE /api/resume/experience/:id (Admin)
Delete work experience.
POST /api/resume/education (Admin)
Add education.
PUT /api/resume/education/:id (Admin)
Update education.
DELETE /api/resume/education/:id (Admin)
Delete education.
POST /api/resume/skills (Admin)
Add skill.
PUT /api/resume/skills/:id (Admin)
Update skill.
DELETE /api/resume/skills/:id (Admin)
Delete skill.
Resources
GET /api/resources
Get all resources.
Query Params:
type: Filter by typecategory: Filter by categoryfeatured:true|false
GET /api/resources/:id
Get a single resource.
POST /api/resources (Admin)
Create a new resource.
PUT /api/resources/:id (Admin)
Update a resource.
DELETE /api/resources/:id (Admin)
Delete a resource.
Testimonials
GET /api/testimonials
Get all testimonials.
Query Params:
status:active|inactive(default:active)
GET /api/testimonials/:id
Get a single testimonial.
POST /api/testimonials (Admin)
Create a new testimonial.
PUT /api/testimonials/:id (Admin)
Update a testimonial.
DELETE /api/testimonials/:id (Admin)
Delete a testimonial.
Contact
POST /api/contact
Submit a contact form message.
Body:
{
"name": "John Doe",
"email": "[email protected]",
"subject": "Hello",
"message": "I want to hire you."
}
GET /api/contact (Admin)
Get all contact submissions.
PUT /api/contact/:id (Admin)
Update contact submission status.
DELETE /api/contact/:id (Admin)
Delete contact submission.
Newsletter
POST /api/newsletter/subscribe
Subscribe to the newsletter.
Body:
{
"email": "[email protected]"
}
GET /api/newsletter/subscribers (Admin)
Get all newsletter subscribers.
DELETE /api/newsletter/subscribers/:id (Admin)
Delete a subscriber.
Tags
GET /api/tags
Get all tags.
POST /api/tags (Admin)
Create a new tag.
PUT /api/tags/:id (Admin)
Update a tag.
DELETE /api/tags/:id (Admin)
Delete a tag.
Users (Admin Only)
GET /api/admin/users
Get all users.
POST /api/admin/users
Create a new user.
PUT /api/admin/users/:id
Update a user.
DELETE /api/admin/users/:id
Delete a user.