Skip to main content
POST
/
api
/
auth
/
register
Register
curl --request POST \
  --url https://api.example.com/api/auth/register \
  --header 'Content-Type: application/json' \
  --data '
{
  "Username": "<string>",
  "Email": "<string>",
  "Password": "<string>"
}
'
{
  "AccessToken": "<string>",
  "RefreshToken": "<string>",
  "AccessTokenExpiry": {},
  "User": {}
}

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
string
required
Username for the new account. Maximum 100 characters.
Email
string
required
Valid email address for the account. Must be a valid email format. Maximum 256 characters.
Password
string
required
Account password. Must be at least 8 characters long, maximum 128 characters.

Response

AccessToken
string
JWT access token for authenticating subsequent requests. Typically expires in 15 minutes.
RefreshToken
string
Refresh token used to obtain new access tokens. Typically expires in 7 days.
AccessTokenExpiry
datetime
ISO 8601 timestamp indicating when the access token expires.
User
object
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
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

201 Created
{
  "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"
  }
}
409 Conflict
{
  "message": "Ya existe una cuenta con ese email."
}

Build docs developers (and LLMs) love