Skip to main content
POST
/
api
/
auth
/
register
Register User
curl --request POST \
  --url https://api.example.com/api/auth/register \
  --header 'Content-Type: application/json' \
  --data '
{
  "fullName": "<string>",
  "email": "<string>",
  "password": "<string>"
}
'
{
  "success": true,
  "message": "<string>",
  "data": {
    "token": "<string>"
  },
  "timestamp": "<string>"
}

Endpoint

POST /api/auth/register
Registers a new user in the Portfolio Hub system. Upon successful registration, returns an authentication token that can be used for subsequent authenticated requests.

Request Body

fullName
string
required
The full name of the user.Validations:
  • Must not be blank
  • Minimum length: 3 characters
  • Maximum length: 120 characters
email
string
required
The email address of the user. Must be unique in the system.Validations:
  • Must not be blank
  • Must be a valid email format
  • Maximum length: 150 characters
password
string
required
The password for the user account.Validations:
  • Must not be blank
  • Minimum length: 8 characters
  • Maximum length: 100 characters

Response

success
boolean
Indicates whether the request was successful.
message
string
A human-readable message describing the result. Returns “Usuario registrado exitosamente” on success.
data
object
The authentication response data.
token
string
JWT authentication token to be used in subsequent requests.
timestamp
string
ISO 8601 timestamp of when the response was generated.

Examples

curl -X POST https://api.portfoliohub.com/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "fullName": "John Doe",
    "email": "[email protected]",
    "password": "securePassword123"
  }'

Success Response (200 OK)

{
  "success": true,
  "message": "Usuario registrado exitosamente",
  "data": {
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
  },
  "timestamp": "2026-03-09T14:30:00.123Z"
}

Error Responses

Validation Error (400 Bad Request)

Returned when request body fails validation constraints.
{
  "success": false,
  "message": "Error de validación",
  "data": {
    "email": "must be a well-formed email address",
    "password": "size must be between 8 and 100",
    "fullName": "must not be blank"
  },
  "timestamp": "2026-03-09T14:30:00.123Z"
}

Email Already Exists (409 Conflict)

Returned when attempting to register with an email that already exists in the system.
{
  "success": false,
  "message": "Email already registered",
  "data": null,
  "timestamp": "2026-03-09T14:30:00.123Z"
}

Status Codes

Status CodeDescription
200User successfully registered and token generated
400Invalid request body or validation errors
409Email address already exists in the system
500Internal server error

Build docs developers (and LLMs) love