Create a customer
curl --request POST \
--url https://api.togai.com/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "01BX5ZZKBKACTAV9WEVGEMMVRZ",
"name": "ACME Enterprise",
"primaryEmail": "admin@example.com",
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina",
"country": "US"
},
"settings": [
{
"id": "customerSettingId",
"value": "INR",
"namespace": "USER",
"name": "Settings Name",
"dataType": "STRING"
}
],
"account": {
"id": "ACC00001",
"name": "Primary Account",
"invoiceCurrency": "USD",
"aliases": [
"acme_primary",
"admin@example.com"
],
"settings": [
{
"id": "accountSettingId",
"value": "INR",
"namespace": "USER",
"name": "Settings Name",
"dataType": "STRING"
}
]
}
}
'import requests
url = "https://api.togai.com/customers"
payload = {
"id": "01BX5ZZKBKACTAV9WEVGEMMVRZ",
"name": "ACME Enterprise",
"primaryEmail": "admin@example.com",
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina",
"country": "US"
},
"settings": [
{
"id": "customerSettingId",
"value": "INR",
"namespace": "USER",
"name": "Settings Name",
"dataType": "STRING"
}
],
"account": {
"id": "ACC00001",
"name": "Primary Account",
"invoiceCurrency": "USD",
"aliases": ["acme_primary", "admin@example.com"],
"settings": [
{
"id": "accountSettingId",
"value": "INR",
"namespace": "USER",
"name": "Settings Name",
"dataType": "STRING"
}
]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: '01BX5ZZKBKACTAV9WEVGEMMVRZ',
name: 'ACME Enterprise',
primaryEmail: 'admin@example.com',
address: {
phoneNumber: '+919876543210',
line1: '2281 Broadway Street',
line2: 'G-31',
postalCode: '29501',
city: 'Florence',
state: 'South Carolina',
country: 'US'
},
settings: [
{
id: 'customerSettingId',
value: 'INR',
namespace: 'USER',
name: 'Settings Name',
dataType: 'STRING'
}
],
account: {
id: 'ACC00001',
name: 'Primary Account',
invoiceCurrency: 'USD',
aliases: ['acme_primary', 'admin@example.com'],
settings: [
{
id: 'accountSettingId',
value: 'INR',
namespace: 'USER',
name: 'Settings Name',
dataType: 'STRING'
}
]
}
})
};
fetch('https://api.togai.com/customers', 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.togai.com/customers",
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([
'id' => '01BX5ZZKBKACTAV9WEVGEMMVRZ',
'name' => 'ACME Enterprise',
'primaryEmail' => 'admin@example.com',
'address' => [
'phoneNumber' => '+919876543210',
'line1' => '2281 Broadway Street',
'line2' => 'G-31',
'postalCode' => '29501',
'city' => 'Florence',
'state' => 'South Carolina',
'country' => 'US'
],
'settings' => [
[
'id' => 'customerSettingId',
'value' => 'INR',
'namespace' => 'USER',
'name' => 'Settings Name',
'dataType' => 'STRING'
]
],
'account' => [
'id' => 'ACC00001',
'name' => 'Primary Account',
'invoiceCurrency' => 'USD',
'aliases' => [
'acme_primary',
'admin@example.com'
],
'settings' => [
[
'id' => 'accountSettingId',
'value' => 'INR',
'namespace' => 'USER',
'name' => 'Settings Name',
'dataType' => 'STRING'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.togai.com/customers"
payload := strings.NewReader("{\n \"id\": \"01BX5ZZKBKACTAV9WEVGEMMVRZ\",\n \"name\": \"ACME Enterprise\",\n \"primaryEmail\": \"admin@example.com\",\n \"address\": {\n \"phoneNumber\": \"+919876543210\",\n \"line1\": \"2281 Broadway Street\",\n \"line2\": \"G-31\",\n \"postalCode\": \"29501\",\n \"city\": \"Florence\",\n \"state\": \"South Carolina\",\n \"country\": \"US\"\n },\n \"settings\": [\n {\n \"id\": \"customerSettingId\",\n \"value\": \"INR\",\n \"namespace\": \"USER\",\n \"name\": \"Settings Name\",\n \"dataType\": \"STRING\"\n }\n ],\n \"account\": {\n \"id\": \"ACC00001\",\n \"name\": \"Primary Account\",\n \"invoiceCurrency\": \"USD\",\n \"aliases\": [\n \"acme_primary\",\n \"admin@example.com\"\n ],\n \"settings\": [\n {\n \"id\": \"accountSettingId\",\n \"value\": \"INR\",\n \"namespace\": \"USER\",\n \"name\": \"Settings Name\",\n \"dataType\": \"STRING\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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.togai.com/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"01BX5ZZKBKACTAV9WEVGEMMVRZ\",\n \"name\": \"ACME Enterprise\",\n \"primaryEmail\": \"admin@example.com\",\n \"address\": {\n \"phoneNumber\": \"+919876543210\",\n \"line1\": \"2281 Broadway Street\",\n \"line2\": \"G-31\",\n \"postalCode\": \"29501\",\n \"city\": \"Florence\",\n \"state\": \"South Carolina\",\n \"country\": \"US\"\n },\n \"settings\": [\n {\n \"id\": \"customerSettingId\",\n \"value\": \"INR\",\n \"namespace\": \"USER\",\n \"name\": \"Settings Name\",\n \"dataType\": \"STRING\"\n }\n ],\n \"account\": {\n \"id\": \"ACC00001\",\n \"name\": \"Primary Account\",\n \"invoiceCurrency\": \"USD\",\n \"aliases\": [\n \"acme_primary\",\n \"admin@example.com\"\n ],\n \"settings\": [\n {\n \"id\": \"accountSettingId\",\n \"value\": \"INR\",\n \"namespace\": \"USER\",\n \"name\": \"Settings Name\",\n \"dataType\": \"STRING\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.togai.com/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"01BX5ZZKBKACTAV9WEVGEMMVRZ\",\n \"name\": \"ACME Enterprise\",\n \"primaryEmail\": \"admin@example.com\",\n \"address\": {\n \"phoneNumber\": \"+919876543210\",\n \"line1\": \"2281 Broadway Street\",\n \"line2\": \"G-31\",\n \"postalCode\": \"29501\",\n \"city\": \"Florence\",\n \"state\": \"South Carolina\",\n \"country\": \"US\"\n },\n \"settings\": [\n {\n \"id\": \"customerSettingId\",\n \"value\": \"INR\",\n \"namespace\": \"USER\",\n \"name\": \"Settings Name\",\n \"dataType\": \"STRING\"\n }\n ],\n \"account\": {\n \"id\": \"ACC00001\",\n \"name\": \"Primary Account\",\n \"invoiceCurrency\": \"USD\",\n \"aliases\": [\n \"acme_primary\",\n \"admin@example.com\"\n ],\n \"settings\": [\n {\n \"id\": \"accountSettingId\",\n \"value\": \"INR\",\n \"namespace\": \"USER\",\n \"name\": \"Settings Name\",\n \"dataType\": \"STRING\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "01BX5ZZKBKACTAV9WEVGEMMVRZ",
"togaiCustomerId": "customer.dsvvre314.dcs314",
"name": "ACME Enterprise",
"primaryEmail": "admin@example.com",
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina",
"country": "US"
},
"settings": [
{
"id": "customerSettingId",
"value": "INR",
"namespace": "USER",
"name": "Settings Name",
"dataType": "STRING"
}
],
"account": {
"id": "G234DZZKBKACATFFGVGEMERFH",
"togaiAccountId": "account.safdla.c234ds",
"customerId": "01BX5ZZKBKACTAV9WEVGEMMVRZ",
"togaiCustomerId": "customer.savass.11e1a",
"name": "ACME Enterprise - Account",
"invoiceCurrency": "USD",
"status": "ACTIVE",
"aliases": [
{
"alias": "G234DZZKBKACATFFGVGEMERFH",
"status": "ACTIVE"
}
],
"settings": [
{
"id": "accountSettingId",
"value": "INR",
"namespace": "USER",
"name": "Settings Name",
"dataType": "STRING"
}
]
}
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}Customers
Create a customer
This API let’s you to create customers and corresponding accounts.
POST
/
customers
Create a customer
curl --request POST \
--url https://api.togai.com/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "01BX5ZZKBKACTAV9WEVGEMMVRZ",
"name": "ACME Enterprise",
"primaryEmail": "admin@example.com",
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina",
"country": "US"
},
"settings": [
{
"id": "customerSettingId",
"value": "INR",
"namespace": "USER",
"name": "Settings Name",
"dataType": "STRING"
}
],
"account": {
"id": "ACC00001",
"name": "Primary Account",
"invoiceCurrency": "USD",
"aliases": [
"acme_primary",
"admin@example.com"
],
"settings": [
{
"id": "accountSettingId",
"value": "INR",
"namespace": "USER",
"name": "Settings Name",
"dataType": "STRING"
}
]
}
}
'import requests
url = "https://api.togai.com/customers"
payload = {
"id": "01BX5ZZKBKACTAV9WEVGEMMVRZ",
"name": "ACME Enterprise",
"primaryEmail": "admin@example.com",
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina",
"country": "US"
},
"settings": [
{
"id": "customerSettingId",
"value": "INR",
"namespace": "USER",
"name": "Settings Name",
"dataType": "STRING"
}
],
"account": {
"id": "ACC00001",
"name": "Primary Account",
"invoiceCurrency": "USD",
"aliases": ["acme_primary", "admin@example.com"],
"settings": [
{
"id": "accountSettingId",
"value": "INR",
"namespace": "USER",
"name": "Settings Name",
"dataType": "STRING"
}
]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: '01BX5ZZKBKACTAV9WEVGEMMVRZ',
name: 'ACME Enterprise',
primaryEmail: 'admin@example.com',
address: {
phoneNumber: '+919876543210',
line1: '2281 Broadway Street',
line2: 'G-31',
postalCode: '29501',
city: 'Florence',
state: 'South Carolina',
country: 'US'
},
settings: [
{
id: 'customerSettingId',
value: 'INR',
namespace: 'USER',
name: 'Settings Name',
dataType: 'STRING'
}
],
account: {
id: 'ACC00001',
name: 'Primary Account',
invoiceCurrency: 'USD',
aliases: ['acme_primary', 'admin@example.com'],
settings: [
{
id: 'accountSettingId',
value: 'INR',
namespace: 'USER',
name: 'Settings Name',
dataType: 'STRING'
}
]
}
})
};
fetch('https://api.togai.com/customers', 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.togai.com/customers",
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([
'id' => '01BX5ZZKBKACTAV9WEVGEMMVRZ',
'name' => 'ACME Enterprise',
'primaryEmail' => 'admin@example.com',
'address' => [
'phoneNumber' => '+919876543210',
'line1' => '2281 Broadway Street',
'line2' => 'G-31',
'postalCode' => '29501',
'city' => 'Florence',
'state' => 'South Carolina',
'country' => 'US'
],
'settings' => [
[
'id' => 'customerSettingId',
'value' => 'INR',
'namespace' => 'USER',
'name' => 'Settings Name',
'dataType' => 'STRING'
]
],
'account' => [
'id' => 'ACC00001',
'name' => 'Primary Account',
'invoiceCurrency' => 'USD',
'aliases' => [
'acme_primary',
'admin@example.com'
],
'settings' => [
[
'id' => 'accountSettingId',
'value' => 'INR',
'namespace' => 'USER',
'name' => 'Settings Name',
'dataType' => 'STRING'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.togai.com/customers"
payload := strings.NewReader("{\n \"id\": \"01BX5ZZKBKACTAV9WEVGEMMVRZ\",\n \"name\": \"ACME Enterprise\",\n \"primaryEmail\": \"admin@example.com\",\n \"address\": {\n \"phoneNumber\": \"+919876543210\",\n \"line1\": \"2281 Broadway Street\",\n \"line2\": \"G-31\",\n \"postalCode\": \"29501\",\n \"city\": \"Florence\",\n \"state\": \"South Carolina\",\n \"country\": \"US\"\n },\n \"settings\": [\n {\n \"id\": \"customerSettingId\",\n \"value\": \"INR\",\n \"namespace\": \"USER\",\n \"name\": \"Settings Name\",\n \"dataType\": \"STRING\"\n }\n ],\n \"account\": {\n \"id\": \"ACC00001\",\n \"name\": \"Primary Account\",\n \"invoiceCurrency\": \"USD\",\n \"aliases\": [\n \"acme_primary\",\n \"admin@example.com\"\n ],\n \"settings\": [\n {\n \"id\": \"accountSettingId\",\n \"value\": \"INR\",\n \"namespace\": \"USER\",\n \"name\": \"Settings Name\",\n \"dataType\": \"STRING\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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.togai.com/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"01BX5ZZKBKACTAV9WEVGEMMVRZ\",\n \"name\": \"ACME Enterprise\",\n \"primaryEmail\": \"admin@example.com\",\n \"address\": {\n \"phoneNumber\": \"+919876543210\",\n \"line1\": \"2281 Broadway Street\",\n \"line2\": \"G-31\",\n \"postalCode\": \"29501\",\n \"city\": \"Florence\",\n \"state\": \"South Carolina\",\n \"country\": \"US\"\n },\n \"settings\": [\n {\n \"id\": \"customerSettingId\",\n \"value\": \"INR\",\n \"namespace\": \"USER\",\n \"name\": \"Settings Name\",\n \"dataType\": \"STRING\"\n }\n ],\n \"account\": {\n \"id\": \"ACC00001\",\n \"name\": \"Primary Account\",\n \"invoiceCurrency\": \"USD\",\n \"aliases\": [\n \"acme_primary\",\n \"admin@example.com\"\n ],\n \"settings\": [\n {\n \"id\": \"accountSettingId\",\n \"value\": \"INR\",\n \"namespace\": \"USER\",\n \"name\": \"Settings Name\",\n \"dataType\": \"STRING\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.togai.com/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"01BX5ZZKBKACTAV9WEVGEMMVRZ\",\n \"name\": \"ACME Enterprise\",\n \"primaryEmail\": \"admin@example.com\",\n \"address\": {\n \"phoneNumber\": \"+919876543210\",\n \"line1\": \"2281 Broadway Street\",\n \"line2\": \"G-31\",\n \"postalCode\": \"29501\",\n \"city\": \"Florence\",\n \"state\": \"South Carolina\",\n \"country\": \"US\"\n },\n \"settings\": [\n {\n \"id\": \"customerSettingId\",\n \"value\": \"INR\",\n \"namespace\": \"USER\",\n \"name\": \"Settings Name\",\n \"dataType\": \"STRING\"\n }\n ],\n \"account\": {\n \"id\": \"ACC00001\",\n \"name\": \"Primary Account\",\n \"invoiceCurrency\": \"USD\",\n \"aliases\": [\n \"acme_primary\",\n \"admin@example.com\"\n ],\n \"settings\": [\n {\n \"id\": \"accountSettingId\",\n \"value\": \"INR\",\n \"namespace\": \"USER\",\n \"name\": \"Settings Name\",\n \"dataType\": \"STRING\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "01BX5ZZKBKACTAV9WEVGEMMVRZ",
"togaiCustomerId": "customer.dsvvre314.dcs314",
"name": "ACME Enterprise",
"primaryEmail": "admin@example.com",
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina",
"country": "US"
},
"settings": [
{
"id": "customerSettingId",
"value": "INR",
"namespace": "USER",
"name": "Settings Name",
"dataType": "STRING"
}
],
"account": {
"id": "G234DZZKBKACATFFGVGEMERFH",
"togaiAccountId": "account.safdla.c234ds",
"customerId": "01BX5ZZKBKACTAV9WEVGEMMVRZ",
"togaiCustomerId": "customer.savass.11e1a",
"name": "ACME Enterprise - Account",
"invoiceCurrency": "USD",
"status": "ACTIVE",
"aliases": [
{
"alias": "G234DZZKBKACATFFGVGEMERFH",
"status": "ACTIVE"
}
],
"settings": [
{
"id": "accountSettingId",
"value": "INR",
"namespace": "USER",
"name": "Settings Name",
"dataType": "STRING"
}
]
}
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Payload to create customer
Payload to create customer
Customer identifier
Maximum string length:
50Example:
"01BX5ZZKBKACTAV9WEVGEMMVRZ"
Name of the Customer
Required string length:
3 - 255Example:
"ACME Enterprise"
Primary email of the customer
Maximum string length:
320Example:
"admin@example.com"
billing address of the customer
Show child attributes
Show child attributes
Maximum array length:
10Show child attributes
Show child attributes
Payload to create account
Show child attributes
Show child attributes
Response
Response for Create customer request
Identifier of customer
Maximum string length:
50Unique identifier of customer
Name of the Customer
Required string length:
3 - 255Primary email of the customer
Maximum string length:
320billing address of the customer
Show child attributes
Show child attributes
Maximum array length:
10Show child attributes
Show child attributes
Structure of an account
Show child attributes
Show child attributes
⌘I
