Register a user
Register a user; invalid fields return 422 problem+json.
Rules: <list type="bullet"><item><description>username: 3-20 letters, digits or underscores; admin, root, apibee and test_user are taken</description></item><item><description>email: must be a valid address</description></item><item><description>password: 8+ characters with an uppercase letter, a lowercase letter, a digit and a special character</description></item><item><description>confirmPassword: if present, must match password</description></item><item><description>age: integer, 18-120</description></item><item><description>country: one of US, GB, IN, DE, FR, JP, CA, AU, BR</description></item><item><description>phone: optional, E.164 format</description></item><item><description>acceptTerms: must be true</description></item></list> Errors come back as RFC 7807 application/problem+json, with an errors map of field to messages. Nothing is stored, so the same payload always gets the same answer.
Request body
Optional. application/json, text/json, application/*+json, application/xml, text/xml, application/*+xml. JSON object with username, email, password, optional confirmPassword, age, country, optional phone and acceptTerms.
{
"username": "ava_t",
"email": "ava@example.com",
"password": "Str0ng!Pass",
"confirmPassword": "Str0ng!Pass",
"age": 29,
"country": "us",
"phone": "+15550101",
"acceptTerms": true
}Responses
- 200
- OK
- 201
- User registered (the password is never echoed back).
- 400
- Body is not a JSON object.
- 422
- One or more fields failed validation.
Example
curl -X POST "https://api.testingapis.com/api/validation/register" \
-H "Content-Type: application/json" \
-d '{"username": "ava_t", "email": "ava@example.com", "password": "Str0ng!Pass", "confirmPassword": "Str0ng!Pass", "age": 29, "country": "us", "phone": "+15550101", "acceptTerms": true}' \
-H "X-TestingApis-Key: YOUR_API_KEY"{
"message": "User registered successfully",
"data": {
"id": 1001,
"username": "ava_t",
"email": "ava@example.com",
"age": 29,
"country": "US",
"createdAt": "2026-09-30T18:26:45Z"
}
}Sign in to see the details
The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.