Create User
POST
/users
Create new user.
Roles
Users with the following roles may access this endoint:
Public
Breaking Changes
No breaking changes.
Request
- Sample Request
- Sample Response
POST /users/
Content-Type: application/json
x-tenant-id: {your-tenant-id}
{
"password": "PassWorD100100",
"recaptcha": "asdf1234",
"user_type": "ClientCustomer",
"username": "test_new_user@crosoftware.net"
}
Access-Control-Allow-Headers: Authorization, Accept, X-TENANT-ID, Content-Type
Access-Control-Allow-Methods: POST
Access-Control-Allow-Origin: *
Allow: POST
Content-Length: 191
Content-Type: application/json
Date: Sat, 20 Aug 2022 01:46:42 GMT
Server: WSGIServer/0.2 CPython/3.9.5
X-API-VERSION: 2019/02/08
X-REQUEST-ID: b0ec1774-6727-4a59-9ce6-7d041d2e6498
{
"dispatcher_id": null,
"id": 10000001,
"roles": [
"ClientCustomer"
],
"third_party_hauler_id": null,
"uid": "ebaaf3a8-6e54-4db8-b0ef-dc235a51a960",
"username": "test_new_user@crosoftware.net"
}
Path Parameters
No path parameters.
Query Parameters
No query parameters.
Request Headers
Refer to StandardPublicRequestHeadersModel for more details.
Content-Type
String, Optional
Default Value: application/json
One of the following MIME types:
- "application/json" Refer to the JSON Spec.
x-api-version
String, Optional
Request identifier.
- At least 1 and no more than 64 characters.
- Must be a valid API version string (2019/02/08, 2021/04/07, 2021/05/07, 2021/08/02, 2021/11/04, 2023/04/19).
Request Body
Refer to CreateUserRequestModel for more details.
password
String, Required
New password.
- Passwords must be at least 6 chars long, contain at least 1 capital letters, and at least 1 numbers.
recaptcha
String, Required
Recaptcha answer.
- At least 8 and no more than 512 characters.
third_party_hauler_id
String, Optional
Third party hauler identifier.
- Valid UUID.
user_type
String, Required
User type.
- One of: 'ClientCustomer', 'ThirdPartyDispatcher'.
username
String, Required
New password.
- Must be a valid email address.
Response
Response Headers
Refer to StandardResponseHeadersModel for more details.
Content-Type
String, Optional
Default Value: application/json
One of the following MIME types:
- "application/json" Refer to the JSON Spec.
x-api-version
String
Request identifier.
- At least 1 and no more than 64 characters.
- Must be a valid API version string (2019/02/08, 2021/04/07, 2021/05/07, 2021/08/02, 2021/11/04, 2023/04/19).
x-request-id
String
Request identifier.
- Valid UUID.
Response Body
Refer to UserModel for more details.
dispatcher_id
Integer
Resource identifier.
id
String
User identifier.
roles
Array[role]
role
String
User role.
- Valid role (one of Public, ClientCustomer, CrmUser, Admin, ThirdPartyDispatcher, Driver, ThirdPartyDriver, Dispatcher).
third_party_hauler_id
String
Third party hauler identifier.
- Valid UUID.
uid
String
Identity UUID.
- Valid UUID.
username
String
Username.
- No longer than 64 characters.
- At least 1 characters long.
Code Samples
- cURL
- Python
- CSharp 2.0
curl --request POST --include \
--header "Content-Type: application/json" \
--header "x-tenant-id: {your-tenant-id}" \
--data '{"password": "PassWorD100100", "recaptcha": "asdf1234", "user_type": "ClientCustomer", "username": "test_new_user@crosoftware.net"}' \
127.0.0.1:8003/users
import requests, json
body = '''
{
"password": "PassWorD100100",
"recaptcha": "asdf1234",
"user_type": "ClientCustomer",
"username": "test_new_user@crosoftware.net"
}
'''
response = requests.post(
'http://localhost:8003/users',
headers={
'Content-Type': 'application/json',
'x-tenant-id': '{your-tenant-id}'
},
params={
},
data=body
)
results = json.loads(response.text)
print(results)
using System;
using System.Net;
using System.Collections.Specialized;
namespace CROSoftware
{
public class DemoClient
{
static public void Main ()
{
WebClient client = new WebClient();
// URL
String url = "/users";
// Headers
client.Headers.Add("Content-Type", "application/json");
client.Headers.Add("x-tenant-id", "{your-tenant-id}");
// Body
String body = "{\"password\": \"PassWorD100100\", \"recaptcha\": \"asdf1234\", \"user_type\": \"ClientCustomer\", \"username\": \"test_new_user@crosoftware.net\"}";
String json = client.UploadString(url, "post", body);
Console.WriteLine(json);
}
}
}