curl --request POST \
--url https://your-instance.example.com/api/auth/register \
--header 'Content-Type: application/json' \
--data '
{
"email": "sam.patel@acme.example",
"password": "CorrectHorseBatteryStaple!",
"fullName": "Sam Patel",
"organizationId": "5f7b1c2e8a1d4e0012c3b4a5",
"accessRole": "AGENT",
"phoneNumber": "+14165550100",
"designation": "Customer Success Lead",
"departmentId": "6a8c2d3f9b1e5a0023d4c5b6"
}
'import requests
url = "https://your-instance.example.com/api/auth/register"
payload = {
"email": "sam.patel@acme.example",
"password": "CorrectHorseBatteryStaple!",
"fullName": "Sam Patel",
"organizationId": "5f7b1c2e8a1d4e0012c3b4a5",
"accessRole": "AGENT",
"phoneNumber": "+14165550100",
"designation": "Customer Success Lead",
"departmentId": "6a8c2d3f9b1e5a0023d4c5b6"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'sam.patel@acme.example',
password: 'CorrectHorseBatteryStaple!',
fullName: 'Sam Patel',
organizationId: '5f7b1c2e8a1d4e0012c3b4a5',
accessRole: 'AGENT',
phoneNumber: '+14165550100',
designation: 'Customer Success Lead',
departmentId: '6a8c2d3f9b1e5a0023d4c5b6'
})
};
fetch('https://your-instance.example.com/api/auth/register', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-instance.example.com/api/auth/register",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'sam.patel@acme.example',
'password' => 'CorrectHorseBatteryStaple!',
'fullName' => 'Sam Patel',
'organizationId' => '5f7b1c2e8a1d4e0012c3b4a5',
'accessRole' => 'AGENT',
'phoneNumber' => '+14165550100',
'designation' => 'Customer Success Lead',
'departmentId' => '6a8c2d3f9b1e5a0023d4c5b6'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-instance.example.com/api/auth/register"
payload := strings.NewReader("{\n \"email\": \"sam.patel@acme.example\",\n \"password\": \"CorrectHorseBatteryStaple!\",\n \"fullName\": \"Sam Patel\",\n \"organizationId\": \"5f7b1c2e8a1d4e0012c3b4a5\",\n \"accessRole\": \"AGENT\",\n \"phoneNumber\": \"+14165550100\",\n \"designation\": \"Customer Success Lead\",\n \"departmentId\": \"6a8c2d3f9b1e5a0023d4c5b6\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-instance.example.com/api/auth/register")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"sam.patel@acme.example\",\n \"password\": \"CorrectHorseBatteryStaple!\",\n \"fullName\": \"Sam Patel\",\n \"organizationId\": \"5f7b1c2e8a1d4e0012c3b4a5\",\n \"accessRole\": \"AGENT\",\n \"phoneNumber\": \"+14165550100\",\n \"designation\": \"Customer Success Lead\",\n \"departmentId\": \"6a8c2d3f9b1e5a0023d4c5b6\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/auth/register")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"sam.patel@acme.example\",\n \"password\": \"CorrectHorseBatteryStaple!\",\n \"fullName\": \"Sam Patel\",\n \"organizationId\": \"5f7b1c2e8a1d4e0012c3b4a5\",\n \"accessRole\": \"AGENT\",\n \"phoneNumber\": \"+14165550100\",\n \"designation\": \"Customer Success Lead\",\n \"departmentId\": \"6a8c2d3f9b1e5a0023d4c5b6\"\n}"
response = http.request(request)
puts response.read_body{
"message": "User registered successfully"
}{
"error": "Password does not meet WorkOS requirements",
"message": "Password must include at least one number and one special character.",
"suggestions": [
"Add a digit",
"Add a punctuation mark"
],
"passwordRequirements": {
"minLength": 8,
"requireNumber": true,
"requireSpecial": true
}
}{
"error": "Invalid or expired token",
"code": "TOKEN_EXPIRED"
}{
"error": "Invalid or expired token",
"code": "TOKEN_EXPIRED"
}Register user
Create a new user account. When WorkOS is enabled the user is also provisioned in WorkOS; otherwise the password is validated locally and hashed before persistence.
curl --request POST \
--url https://your-instance.example.com/api/auth/register \
--header 'Content-Type: application/json' \
--data '
{
"email": "sam.patel@acme.example",
"password": "CorrectHorseBatteryStaple!",
"fullName": "Sam Patel",
"organizationId": "5f7b1c2e8a1d4e0012c3b4a5",
"accessRole": "AGENT",
"phoneNumber": "+14165550100",
"designation": "Customer Success Lead",
"departmentId": "6a8c2d3f9b1e5a0023d4c5b6"
}
'import requests
url = "https://your-instance.example.com/api/auth/register"
payload = {
"email": "sam.patel@acme.example",
"password": "CorrectHorseBatteryStaple!",
"fullName": "Sam Patel",
"organizationId": "5f7b1c2e8a1d4e0012c3b4a5",
"accessRole": "AGENT",
"phoneNumber": "+14165550100",
"designation": "Customer Success Lead",
"departmentId": "6a8c2d3f9b1e5a0023d4c5b6"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'sam.patel@acme.example',
password: 'CorrectHorseBatteryStaple!',
fullName: 'Sam Patel',
organizationId: '5f7b1c2e8a1d4e0012c3b4a5',
accessRole: 'AGENT',
phoneNumber: '+14165550100',
designation: 'Customer Success Lead',
departmentId: '6a8c2d3f9b1e5a0023d4c5b6'
})
};
fetch('https://your-instance.example.com/api/auth/register', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-instance.example.com/api/auth/register",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'sam.patel@acme.example',
'password' => 'CorrectHorseBatteryStaple!',
'fullName' => 'Sam Patel',
'organizationId' => '5f7b1c2e8a1d4e0012c3b4a5',
'accessRole' => 'AGENT',
'phoneNumber' => '+14165550100',
'designation' => 'Customer Success Lead',
'departmentId' => '6a8c2d3f9b1e5a0023d4c5b6'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-instance.example.com/api/auth/register"
payload := strings.NewReader("{\n \"email\": \"sam.patel@acme.example\",\n \"password\": \"CorrectHorseBatteryStaple!\",\n \"fullName\": \"Sam Patel\",\n \"organizationId\": \"5f7b1c2e8a1d4e0012c3b4a5\",\n \"accessRole\": \"AGENT\",\n \"phoneNumber\": \"+14165550100\",\n \"designation\": \"Customer Success Lead\",\n \"departmentId\": \"6a8c2d3f9b1e5a0023d4c5b6\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-instance.example.com/api/auth/register")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"sam.patel@acme.example\",\n \"password\": \"CorrectHorseBatteryStaple!\",\n \"fullName\": \"Sam Patel\",\n \"organizationId\": \"5f7b1c2e8a1d4e0012c3b4a5\",\n \"accessRole\": \"AGENT\",\n \"phoneNumber\": \"+14165550100\",\n \"designation\": \"Customer Success Lead\",\n \"departmentId\": \"6a8c2d3f9b1e5a0023d4c5b6\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/auth/register")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"sam.patel@acme.example\",\n \"password\": \"CorrectHorseBatteryStaple!\",\n \"fullName\": \"Sam Patel\",\n \"organizationId\": \"5f7b1c2e8a1d4e0012c3b4a5\",\n \"accessRole\": \"AGENT\",\n \"phoneNumber\": \"+14165550100\",\n \"designation\": \"Customer Success Lead\",\n \"departmentId\": \"6a8c2d3f9b1e5a0023d4c5b6\"\n}"
response = http.request(request)
puts response.read_body{
"message": "User registered successfully"
}{
"error": "Password does not meet WorkOS requirements",
"message": "Password must include at least one number and one special character.",
"suggestions": [
"Add a digit",
"Add a punctuation mark"
],
"passwordRequirements": {
"minLength": 8,
"requireNumber": true,
"requireSpecial": true
}
}{
"error": "Invalid or expired token",
"code": "TOKEN_EXPIRED"
}{
"error": "Invalid or expired token",
"code": "TOKEN_EXPIRED"
}Body
New user email; must be unique across the platform.
Plain-text password; validated against WorkOS policy when enabled, otherwise against the local 8+ char / mixed-case / number / special-char rule. Hashed with bcrypt before persistence.
Display name; split into first/last when provisioning the WorkOS user.
Mongo _id of the org the user belongs to. Department Leads are forced to their own org and cannot override this.
Role assigned to the new user — defaults to SALES_REP when omitted. Department Leads may only create SALES_REP users.
User's personal phone number. Rejected when it collides with one of the org's provisioned SMS numbers.
Sinch-provisioned outbound number assigned to this user, if any.
Free-form job title shown in the UI (e.g. "Customer Success Lead").
Mongo _id of the department the user joins; auto-populated for Department Leads and used to add the user to the department's userIds/managerIds array.
Response
User registered
Minimal envelope returned after a user is registered.