Skip to main content
POST
/
auth
/
register
Register
curl --request POST \
  --url https://api.example.com/auth/register \
  --header 'Content-Type: application/json' \
  --data '
{
  "nombre": "<string>",
  "apellidos": "<string>",
  "password": "<string>",
  "dni": "<string>",
  "direccion": "<string>",
  "CP": "<string>",
  "provincia": "<string>",
  "poblacion": "<string>",
  "pais": "<string>",
  "email": "<string>",
  "telefono": "<string>",
  "fechaalta": "<string>",
  "fechabaja": "<string>",
  "formadepago": "<string>",
  "cuota": 123,
  "categoria": "<string>",
  "socio": "<string>"
}
'
{
  "message": "<string>"
}

Description

Creates a new user account in the system. After successful registration, a verification code is sent to the provided email address. The user must verify their email within 15 minutes before they can log in.
This endpoint is protected by rate limiting (ThrottlerGuard) to prevent brute force attacks and mass registration.

Request Body

nombre
string
required
User’s first name
apellidos
string
required
User’s last name
password
string
required
User’s password (will be hashed with bcrypt)
dni
string
required
User’s national identification number (DNI)
direccion
string
required
User’s street address
CP
string
required
Postal code
provincia
string
required
Province or state
poblacion
string
required
City or town
pais
string
required
Country
email
string
required
User’s email address (must be valid email format)
telefono
string
required
User’s phone number
fechaalta
string
required
Registration date (ISO 8601 date string)
fechabaja
string
Account deactivation date (ISO 8601 date string, optional)
formadepago
string
required
Payment method
cuota
number
required
Membership fee amount
categoria
string
required
User category
socio
string
required
Membership status: Socio or NoSocio

Request Example

curl -X POST https://api.sociapp.com/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Juan",
    "apellidos": "García López",
    "password": "SecurePassword123!",
    "dni": "12345678A",
    "direccion": "Calle Mayor 123",
    "CP": "28001",
    "provincia": "Madrid",
    "poblacion": "Madrid",
    "pais": "España",
    "email": "[email protected]",
    "telefono": "+34600123456",
    "fechaalta": "2026-03-04T00:00:00.000Z",
    "formadepago": "Tarjeta",
    "cuota": 50,
    "categoria": "Senior",
    "socio": "Socio"
  }'

Response

Success Response

message
string
Confirmation message indicating successful registration and email verification requirement
{
  "message": "User registered successfully. Please check your email for verification code."
}

Error Responses

{
  "statusCode": 409,
  "message": "Email already exists",
  "error": "Conflict"
}

Notes

  • The password is hashed using bcrypt with a salt round of 12 before storage
  • A 6-digit verification code is generated and sent to the user’s email
  • The verification code expires after 15 minutes
  • If the user doesn’t verify their email within the expiration period, the registration will be deleted when they attempt to log in
  • Rate limiting is applied to prevent abuse and mass registration attempts

Next Steps

After successful registration:
  1. Check email for verification code (6 digits)
  2. Call Verify Email endpoint with code
  3. If code expired, use Resend Code to get a new one
  4. Once verified, you can login with your credentials

Build docs developers (and LLMs) love