curl --request POST \
--url https://api.nuwebgroup.com/v1/partner/users \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-NU-RESELLER-ID: <x-nu-reseller-id>' \
--data '
{
"name": "John Doe",
"email": "email@example.com",
"companies": [],
"password": "Password123"
}
'import requests
url = "https://api.nuwebgroup.com/v1/partner/users"
payload = {
"name": "John Doe",
"email": "email@example.com",
"companies": [],
"password": "Password123"
}
headers = {
"X-NU-RESELLER-ID": "<x-nu-reseller-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-NU-RESELLER-ID': '<x-nu-reseller-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'John Doe',
email: 'email@example.com',
companies: [],
password: 'Password123'
})
};
fetch('https://api.nuwebgroup.com/v1/partner/users', 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://api.nuwebgroup.com/v1/partner/users",
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([
'name' => 'John Doe',
'email' => 'email@example.com',
'companies' => [
],
'password' => 'Password123'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-NU-RESELLER-ID: <x-nu-reseller-id>"
],
]);
$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://api.nuwebgroup.com/v1/partner/users"
payload := strings.NewReader("{\n \"name\": \"John Doe\",\n \"email\": \"email@example.com\",\n \"companies\": [],\n \"password\": \"Password123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-NU-RESELLER-ID", "<x-nu-reseller-id>")
req.Header.Add("Authorization", "Bearer <token>")
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://api.nuwebgroup.com/v1/partner/users")
.header("X-NU-RESELLER-ID", "<x-nu-reseller-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"John Doe\",\n \"email\": \"email@example.com\",\n \"companies\": [],\n \"password\": \"Password123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nuwebgroup.com/v1/partner/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-NU-RESELLER-ID"] = '<x-nu-reseller-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"John Doe\",\n \"email\": \"email@example.com\",\n \"companies\": [],\n \"password\": \"Password123\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"type": "users",
"id": 1,
"attributes": {
"name": "John Doe",
"email": "john.doe@example.com",
"phone": null,
"phone_code": null,
"createdAt": "2021-11-22T11:59:00.000000Z",
"updatedAt": "2021-11-22T11:59:00.000000Z"
},
"relationships": {
"companyUsers": {
"data": [
{
"type": "companyUsers",
"id": 1
}
]
},
"visibilityGroups": {
"data": [
{
"type": "visibilityGroups",
"id": 1
}
]
}
}
},
"included": [
{
"type": "companyUsers",
"id": 1,
"atributes": {
"isSelected": true,
"locale": null,
"acceptedTermsAt": null,
"acceptedPrivacyAt": null,
"acceptedEmailOptInAt": null,
"createdAt": "2021-11-22T11:59:00.000000Z",
"updatedAt": "2021-11-22T11:59:00.000000Z"
}
},
{
"type": "visibilityGroups",
"id": 1,
"atributes": {
"name": "Bristol Office",
"createdAt": "2021-11-22T11:59:00.000000Z",
"updatedAt": "2021-11-22T11:59:00.000000Z"
}
}
]
}{
"message": "Unauthenticated."
}{
"message": "This action is unauthorized."
}{
"message": "No query results for model [ModelName]."
}{
"message": "The given data was invalid.",
"errors": {
"field_name": [
"The field_name field is required"
]
}
}Create Company User
Create a new company user.
curl --request POST \
--url https://api.nuwebgroup.com/v1/partner/users \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-NU-RESELLER-ID: <x-nu-reseller-id>' \
--data '
{
"name": "John Doe",
"email": "email@example.com",
"companies": [],
"password": "Password123"
}
'import requests
url = "https://api.nuwebgroup.com/v1/partner/users"
payload = {
"name": "John Doe",
"email": "email@example.com",
"companies": [],
"password": "Password123"
}
headers = {
"X-NU-RESELLER-ID": "<x-nu-reseller-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-NU-RESELLER-ID': '<x-nu-reseller-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'John Doe',
email: 'email@example.com',
companies: [],
password: 'Password123'
})
};
fetch('https://api.nuwebgroup.com/v1/partner/users', 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://api.nuwebgroup.com/v1/partner/users",
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([
'name' => 'John Doe',
'email' => 'email@example.com',
'companies' => [
],
'password' => 'Password123'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-NU-RESELLER-ID: <x-nu-reseller-id>"
],
]);
$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://api.nuwebgroup.com/v1/partner/users"
payload := strings.NewReader("{\n \"name\": \"John Doe\",\n \"email\": \"email@example.com\",\n \"companies\": [],\n \"password\": \"Password123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-NU-RESELLER-ID", "<x-nu-reseller-id>")
req.Header.Add("Authorization", "Bearer <token>")
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://api.nuwebgroup.com/v1/partner/users")
.header("X-NU-RESELLER-ID", "<x-nu-reseller-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"John Doe\",\n \"email\": \"email@example.com\",\n \"companies\": [],\n \"password\": \"Password123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nuwebgroup.com/v1/partner/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-NU-RESELLER-ID"] = '<x-nu-reseller-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"John Doe\",\n \"email\": \"email@example.com\",\n \"companies\": [],\n \"password\": \"Password123\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"type": "users",
"id": 1,
"attributes": {
"name": "John Doe",
"email": "john.doe@example.com",
"phone": null,
"phone_code": null,
"createdAt": "2021-11-22T11:59:00.000000Z",
"updatedAt": "2021-11-22T11:59:00.000000Z"
},
"relationships": {
"companyUsers": {
"data": [
{
"type": "companyUsers",
"id": 1
}
]
},
"visibilityGroups": {
"data": [
{
"type": "visibilityGroups",
"id": 1
}
]
}
}
},
"included": [
{
"type": "companyUsers",
"id": 1,
"atributes": {
"isSelected": true,
"locale": null,
"acceptedTermsAt": null,
"acceptedPrivacyAt": null,
"acceptedEmailOptInAt": null,
"createdAt": "2021-11-22T11:59:00.000000Z",
"updatedAt": "2021-11-22T11:59:00.000000Z"
}
},
{
"type": "visibilityGroups",
"id": 1,
"atributes": {
"name": "Bristol Office",
"createdAt": "2021-11-22T11:59:00.000000Z",
"updatedAt": "2021-11-22T11:59:00.000000Z"
}
}
]
}{
"message": "Unauthenticated."
}{
"message": "This action is unauthorized."
}{
"message": "No query results for model [ModelName]."
}{
"message": "The given data was invalid.",
"errors": {
"field_name": [
"The field_name field is required"
]
}
}Authorizations
The 'Bearer' token can be obtained from the token management interface or via the login endpoint using your hub user credentials.
Headers
The ID of the reseller this operation should be performed against.
Body
Request body for creating a company user.
An array of company ID's to associate the new user to.
An array of roles to assign to this user on creation. By default the first user in a company will receive the super_user role if no other roles are provided. Subsequent users will receive no roles unless specified. Available role keys can be copied from the role management section within hub.
This field is optional, allowing you to create a user without a password. This user will be able to set their own password using the forgot password functionality when logging in.
This field is optional, allowing you to specify the users registration source. If left empty it will default to api.
web, api, app If provided, an API key will be generated for the user and returned in the response. Note: the API key will only be returned in this request. Subsequent lookups of the user via the company API will not yield this value.
