This endpoint allows visitors to send contact messages to portfolio owners. No authentication is required. The portfolio owner will receive an email notification with the message details.
Path Parameters
The portfolio owner’s unique slug identifier (e.g., “john-doe”)
Request Body
Sender’s full name (max 120 characters)
Sender’s email address (max 160 characters, must be valid email format)
The contact message content (max 5000 characters)
Response
Indicates if the message was sent successfully
A descriptive message about the response
ISO 8601 timestamp of when the response was generated
Always null for this endpoint
Example Request
cURL
JavaScript
Python
Java
TypeScript
curl -X POST https://api.portfoliohub.com/api/portfolios/john-doe/contact \
-H "Content-Type: application/json" \
-d '{
"name": "Jane Smith",
"email": "[email protected] ",
"message": "Hi John, I came across your portfolio and would love to discuss a potential collaboration on a React project. Are you available for freelance work?"
}'
Example Response
Success Response
{
"success" : true ,
"message" : "Mensaje enviado exitosamente" ,
"timestamp" : "2026-03-09T10:30:00Z" ,
"data" : null
}
Error Responses
Portfolio Not Found
{
"success" : false ,
"message" : "Profile not found with slug: invalid-slug" ,
"timestamp" : "2026-03-09T10:30:00Z" ,
"data" : null
}
Validation Errors
{
"success" : false ,
"message" : "Validation failed" ,
"timestamp" : "2026-03-09T10:30:00Z" ,
"data" : {
"name" : "Name cannot be empty" ,
"email" : "Must be a valid email address" ,
"message" : "Message cannot be empty"
}
}
{
"success" : false ,
"message" : "Validation failed" ,
"timestamp" : "2026-03-09T10:30:00Z" ,
"data" : {
"email" : "Must be a valid email address"
}
}
Message Too Long
{
"success" : false ,
"message" : "Validation failed" ,
"timestamp" : "2026-03-09T10:30:00Z" ,
"data" : {
"message" : "Message must not exceed 5000 characters"
}
}
Validation Rules
Name Field
Required: Yes
Max length: 120 characters
Cannot be blank
Email Field
Required: Yes
Max length: 160 characters
Must be valid email format
Cannot be blank
Message Field
Required: Yes
Max length: 5000 characters
Cannot be blank
Behavior
When a message is successfully submitted:
The message is saved to the database with status “NEW”
An email notification is sent to the portfolio owner’s registered email
The sender receives a success response
The portfolio owner receives an email containing:
Sender’s name and email
The complete message
A link to view the message in their dashboard
Messages are stored and can be managed through the authenticated API endpoints
Use Cases
Contact forms on portfolio websites
Inquiry submission for freelance work
Collaboration requests
General networking and outreach
Job opportunities and recruitment
Rate Limiting
While this endpoint doesn’t require authentication, it’s recommended to implement client-side rate limiting to prevent abuse:
Disable submit button for 5-10 seconds after successful submission
Show confirmation message to user
Clear form fields after successful submission
Security Notes
No authentication required (public endpoint)
All fields are validated on the server side
Email addresses are validated for proper format
Messages are sanitized before storage
Portfolio owners are notified via email automatically
Consider implementing CAPTCHA on the frontend to prevent spam
Best Practices
Frontend Validation : Implement client-side validation matching server rules for better UX
Error Handling : Display user-friendly error messages for validation failures
Success Feedback : Show clear confirmation when message is sent successfully
Form Reset : Clear the form after successful submission
Loading States : Show loading indicator during submission
Spam Prevention : Consider adding CAPTCHA or honeypot fields