Base URL
The Portfolio Hub API is accessible at:Most API endpoints are prefixed with
/api. For example, to access portfolios, use /api/portfolios.Health Check
To verify that the API is online and accessible, use the root endpoint:Example Response
Request Format
The API accepts JSON-formatted request bodies for POST, PUT, and PATCH requests. Always include theContent-Type header:
Response Format
All API responses follow a consistent structure wrapped in anApiResponse object:
Response Fields
Indicates whether the request was successful
Human-readable message describing the result
The response payload.
null for error responses or operations without return dataISO 8601 timestamp of when the response was generated
HTTP Status Codes
The API uses standard HTTP status codes to indicate the success or failure of requests:| Status Code | Description |
|---|---|
200 OK | Request successful |
201 Created | Resource created successfully |
400 Bad Request | Invalid request format or validation error |
401 Unauthorized | Authentication required or invalid credentials |
403 Forbidden | Insufficient permissions |
404 Not Found | Resource not found |
409 Conflict | Request conflicts with current state (e.g., duplicate email) |
500 Internal Server Error | Server error |
Error Handling
Validation Errors
When validation fails (400 Bad Request), the response includes field-specific error details:Authentication Errors
Invalid credentials return a 401 status:Resource Not Found
404 errors provide context about the missing resource:Conflict Errors
409 errors occur when operations conflict with existing data:CORS Configuration
The API supports Cross-Origin Resource Sharing (CORS) with the following configuration:- Allowed Methods:
GET,POST,PUT,DELETE,OPTIONS,PATCH - Allowed Headers:
Authorization,Content-Type,Cache-Control,ngrok-skip-browser-warning - Credentials: Allowed
- Origins: Configured via environment variable
CORS_ALLOWED_ORIGINS
Pagination
Currently, the Portfolio Hub API does not implement pagination for list endpoints. All results are returned in a single response. This may change in future versions for endpoints with large datasets.
Rate Limiting
The Portfolio Hub API does not currently enforce rate limiting. However, please use the API responsibly to ensure optimal performance for all users.
Public vs Authenticated Endpoints
The API has two types of endpoints:Public Endpoints (No Authentication Required)
GET /api/portfolios- List all public portfoliosGET /api/portfolios/{slug}- Get portfolio detailsGET /api/portfolios/{profileSlug}/projects/{projectSlug}- Get project detailsPOST /api/portfolios/{slug}/contact- Send contact messageGET /api/skills- List all global skillsPOST /api/auth/register- Register new accountPOST /api/auth/login- Login to account
Authenticated Endpoints
/api/me/**- User profile and portfolio management (requires authentication)/api/admin/**- Administrative functions (requiresROLE_ADMINauthority)
API Versioning
The current API does not use explicit versioning. Breaking changes will be communicated in advance, and a versioning strategy may be introduced in future releases.
Best Practices
- Always check the
successfield before processing thedatafield - Handle all documented HTTP status codes in your client application
- Use HTTPS in production environments
- Store JWT tokens securely - never expose them in URLs or logs
- Validate data on the client side before sending requests to reduce errors
- Implement exponential backoff for retrying failed requests
- Parse timestamps as ISO 8601 format with timezone support
OpenAPI Documentation
Interactive API documentation is available via Swagger UI:Swagger UI provides an interactive interface to explore and test all API endpoints.