Description
Creates a new user account with the provided credentials. Upon successful registration, returns authentication tokens and user information.
Authentication
No authentication required.
Request Body
Username for the new account. Maximum 100 characters.
Valid email address for the account. Must be a valid email format. Maximum 256 characters.
Account password. Must be at least 8 characters long, maximum 128 characters.
Response
JWT access token for authenticating subsequent requests. Typically expires in 15 minutes.
Refresh token used to obtain new access tokens. Typically expires in 7 days.
ISO 8601 timestamp indicating when the access token expires.
User information object containing:
Id (guid): Unique user identifier
Username (string): The username
Email (string): The user’s email address
CreatedAt (datetime): Account creation timestamp
Status Codes
- 201 Created: User successfully registered
- 400 Bad Request: Invalid request data (validation failed)
- 409 Conflict: Email address already registered
Example Request
curl -X POST http://localhost:5000/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"Username": "johndoe",
"Email": "[email protected]",
"Password": "SecureP@ss123"
}'
Example Response
{
"AccessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"RefreshToken": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
"AccessTokenExpiry": "2026-03-10T15:45:00Z",
"User": {
"Id": "123e4567-e89b-12d3-a456-426614174000",
"Username": "johndoe",
"Email": "[email protected]",
"CreatedAt": "2026-03-10T15:30:00Z"
}
}
{
"message": "Ya existe una cuenta con ese email."
}