Customers Admin API
Create a customer
POST
/api/v1/customers
Creates the customer and its first user, and answers with that user's API token. Allowed only when creating customers through the API is turned on in the settings, and only for an admin allowed to create customers.
Request body application/x-www-form-urlencoded
name
string
required
The customer's name.
email
string (email)
required
The first user's email address. No other user may have it.
password
string
required
The first user's password: 5 to 255 characters.
first_name
string
last_name
string
timezone
string
required
language_id
integer
required
Responses
200
The customer was created.
401
The token is missing or wrong (
Unauthenticated.), or its user may not act on
this object (Unauthorized). Without the Accept: application/json header, a
missing or wrong token answers with a redirect to the sign-in page instead.
403
Creating customers through the API is turned off (
{"status": 0, "message": …}), or a
field is missing or wrong (each field that failed, with its messages).
404
No language has this
language_id.
Create a customer
1
2
3
4
5
6
7
8
9
10
curl -X POST 'https://your-domain/api/v1/customers' \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
--data-urlencode 'name=Awesome Solutions' \
--data-urlencode 'email=emma@example.com' \
--data-urlencode 'password=a-long-password' \
--data-urlencode 'first_name=Emma' \
--data-urlencode 'last_name=Tanaka' \
--data-urlencode 'timezone=UTC' \
--data-urlencode 'language_id=1'
1
2
3
4
5
6
7
8
$client = new Acelle\Client('https://your-domain/api/v1', 'YOUR_API_TOKEN');
$client->customer()->create([
'name' => 'Awesome Solutions',
'email' => 'emma@example.com',
'password' => 'a-long-password',
'timezone' => 'UTC',
'language_id' => 1,
]);
Response
{
"status": 1,
"message": "Customer was successfully created",
"customer_uid": "6adaabb568fda",
"api_token": "YOUR_API_TOKEN"
}