Tutorial: Create a New User¶
This tutorial shows how to create a new user using the public API wrapper in People Cloud. The public endpoint forwards the request to the internal user creation logic and will preserve platform behaviour such as company resolution and validations.
Step 1: Make a POST Request to create a User¶
Send a POST request to the following public API endpoint:
POST /api/v1/user/new
Authorization¶
This endpoint requires authentication. Use a Bearer token from an authenticated user.
Request Headers¶
Authorization: Bearer <your_token_here>
Accept: application/json
Content-Type: application/json
Request Body Structure¶
Below are the commonly used fields accepted by the user creation endpoint. Many fields are optional but some (name, email, password) are typically required by your business rules.
type: User type (e.g.client,vendor,admin).name: Full name of the user.email: User email address (must be unique).company_name: Company name — public wrapper will attempt to resolve or create this company for you.password: Password for the new account.confirm_password: Repeat ofpassword(must match).phone: Optional phone number.
Example JSON¶
{
"type":"client",
"name":"Alice Developer",
"email":"alice@example.com",
"company_name":"Example Oy",
"password":"securepassword",
"confirm_password":"securepassword",
"phone":"+358401234567"
}
Step 2: Create the User (cURL example)¶
curl -X POST 'https://api.sbox2.peoplecloudpro.com/api/v1/user/new' \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"type":"client",
"name":"Alice Developer",
"email":"alice@example.com",
"company_name":"Example Oy",
"password":"securepassword",
"confirm_password":"securepassword",
"phone":"+358401234567"
}'
Step 3: Evaluate response¶
If successful, the API returns a JSON response with a success message. The public wrapper returns a short message such as {"message":"New user added"}.
| Status | Meaning | Description |
|---|---|---|
| 200 | OK | New user added successfully |
| 201 | Created | User created (alternate success code) |
| 401 | Unauthorized | The API token is invalid or missing |
| 403 | Conflict | Email already exists |
| 422 | Validation error | One or more fields failed validation (e.g. password mismatch) |
| 500 | Server error | Unexpected server-side error |
Notes & Tips¶
- Provide
company_namewhen you want the API to resolve or create the company record. passwordandconfirm_passwordmust match; the API enforces this and returns422on mismatch.- The API checks
emailuniqueness and returns403if the email is already in use. - This endpoint requires a valid Bearer token — it is protected by
auth:apiandisVerifiedmiddleware on the public wrapper. - For
phone, provide an international-format string if possible (e.g.+358401234567).