curl --request POST \
--url https://api.togai.com/accounts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "ACC00001",
"name": "Primary Account",
"customerId": "C1234qwd",
"aliases": [
"acme_primary",
"acme_1"
],
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina",
"country": "US"
},
"primaryEmail": "admin@example.com",
"settings": [
{
"id": "accountSettingId",
"value": "INR",
"namespace": "USER",
"name": "Settings Name",
"dataType": "STRING"
}
],
"netTermDays": 45
}
'import requests
url = "https://api.togai.com/accounts"
payload = {
"id": "ACC00001",
"name": "Primary Account",
"customerId": "C1234qwd",
"aliases": ["acme_primary", "acme_1"],
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina",
"country": "US"
},
"primaryEmail": "admin@example.com",
"settings": [
{
"id": "accountSettingId",
"value": "INR",
"namespace": "USER",
"name": "Settings Name",
"dataType": "STRING"
}
],
"netTermDays": 45
}
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: 'ACC00001',
name: 'Primary Account',
customerId: 'C1234qwd',
aliases: ['acme_primary', 'acme_1'],
address: {
phoneNumber: '+919876543210',
line1: '2281 Broadway Street',
line2: 'G-31',
postalCode: '29501',
city: 'Florence',
state: 'South Carolina',
country: 'US'
},
primaryEmail: 'admin@example.com',
settings: [
{
id: 'accountSettingId',
value: 'INR',
namespace: 'USER',
name: 'Settings Name',
dataType: 'STRING'
}
],
netTermDays: 45
})
};
fetch('https://api.togai.com/accounts', 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/accounts",
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' => 'ACC00001',
'name' => 'Primary Account',
'customerId' => 'C1234qwd',
'aliases' => [
'acme_primary',
'acme_1'
],
'address' => [
'phoneNumber' => '+919876543210',
'line1' => '2281 Broadway Street',
'line2' => 'G-31',
'postalCode' => '29501',
'city' => 'Florence',
'state' => 'South Carolina',
'country' => 'US'
],
'primaryEmail' => 'admin@example.com',
'settings' => [
[
'id' => 'accountSettingId',
'value' => 'INR',
'namespace' => 'USER',
'name' => 'Settings Name',
'dataType' => 'STRING'
]
],
'netTermDays' => 45
]),
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/accounts"
payload := strings.NewReader("{\n \"id\": \"ACC00001\",\n \"name\": \"Primary Account\",\n \"customerId\": \"C1234qwd\",\n \"aliases\": [\n \"acme_primary\",\n \"acme_1\"\n ],\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 \"primaryEmail\": \"admin@example.com\",\n \"settings\": [\n {\n \"id\": \"accountSettingId\",\n \"value\": \"INR\",\n \"namespace\": \"USER\",\n \"name\": \"Settings Name\",\n \"dataType\": \"STRING\"\n }\n ],\n \"netTermDays\": 45\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/accounts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"ACC00001\",\n \"name\": \"Primary Account\",\n \"customerId\": \"C1234qwd\",\n \"aliases\": [\n \"acme_primary\",\n \"acme_1\"\n ],\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 \"primaryEmail\": \"admin@example.com\",\n \"settings\": [\n {\n \"id\": \"accountSettingId\",\n \"value\": \"INR\",\n \"namespace\": \"USER\",\n \"name\": \"Settings Name\",\n \"dataType\": \"STRING\"\n }\n ],\n \"netTermDays\": 45\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.togai.com/accounts")
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\": \"ACC00001\",\n \"name\": \"Primary Account\",\n \"customerId\": \"C1234qwd\",\n \"aliases\": [\n \"acme_primary\",\n \"acme_1\"\n ],\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 \"primaryEmail\": \"admin@example.com\",\n \"settings\": [\n {\n \"id\": \"accountSettingId\",\n \"value\": \"INR\",\n \"namespace\": \"USER\",\n \"name\": \"Settings Name\",\n \"dataType\": \"STRING\"\n }\n ],\n \"netTermDays\": 45\n}"
response = http.request(request)
puts response.read_body{
"id": "G234DZZKBKACATFFGVGEMERFI",
"name": "ACME Enterprise - Account2",
"invoiceCurrency": "USD",
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina",
"country": "US"
},
"primaryEmail": "admin@example.com",
"aliases": [
{
"alias": "account2@acme.com",
"status": "ACTIVE"
},
{
"alias": "+1234567890",
"status": "ACTIVE"
}
],
"status": "ACTIVE"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}Create an account
This API let’s you to create an account for a customer using customer_id.
curl --request POST \
--url https://api.togai.com/accounts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "ACC00001",
"name": "Primary Account",
"customerId": "C1234qwd",
"aliases": [
"acme_primary",
"acme_1"
],
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina",
"country": "US"
},
"primaryEmail": "admin@example.com",
"settings": [
{
"id": "accountSettingId",
"value": "INR",
"namespace": "USER",
"name": "Settings Name",
"dataType": "STRING"
}
],
"netTermDays": 45
}
'import requests
url = "https://api.togai.com/accounts"
payload = {
"id": "ACC00001",
"name": "Primary Account",
"customerId": "C1234qwd",
"aliases": ["acme_primary", "acme_1"],
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina",
"country": "US"
},
"primaryEmail": "admin@example.com",
"settings": [
{
"id": "accountSettingId",
"value": "INR",
"namespace": "USER",
"name": "Settings Name",
"dataType": "STRING"
}
],
"netTermDays": 45
}
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: 'ACC00001',
name: 'Primary Account',
customerId: 'C1234qwd',
aliases: ['acme_primary', 'acme_1'],
address: {
phoneNumber: '+919876543210',
line1: '2281 Broadway Street',
line2: 'G-31',
postalCode: '29501',
city: 'Florence',
state: 'South Carolina',
country: 'US'
},
primaryEmail: 'admin@example.com',
settings: [
{
id: 'accountSettingId',
value: 'INR',
namespace: 'USER',
name: 'Settings Name',
dataType: 'STRING'
}
],
netTermDays: 45
})
};
fetch('https://api.togai.com/accounts', 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/accounts",
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' => 'ACC00001',
'name' => 'Primary Account',
'customerId' => 'C1234qwd',
'aliases' => [
'acme_primary',
'acme_1'
],
'address' => [
'phoneNumber' => '+919876543210',
'line1' => '2281 Broadway Street',
'line2' => 'G-31',
'postalCode' => '29501',
'city' => 'Florence',
'state' => 'South Carolina',
'country' => 'US'
],
'primaryEmail' => 'admin@example.com',
'settings' => [
[
'id' => 'accountSettingId',
'value' => 'INR',
'namespace' => 'USER',
'name' => 'Settings Name',
'dataType' => 'STRING'
]
],
'netTermDays' => 45
]),
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/accounts"
payload := strings.NewReader("{\n \"id\": \"ACC00001\",\n \"name\": \"Primary Account\",\n \"customerId\": \"C1234qwd\",\n \"aliases\": [\n \"acme_primary\",\n \"acme_1\"\n ],\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 \"primaryEmail\": \"admin@example.com\",\n \"settings\": [\n {\n \"id\": \"accountSettingId\",\n \"value\": \"INR\",\n \"namespace\": \"USER\",\n \"name\": \"Settings Name\",\n \"dataType\": \"STRING\"\n }\n ],\n \"netTermDays\": 45\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/accounts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"ACC00001\",\n \"name\": \"Primary Account\",\n \"customerId\": \"C1234qwd\",\n \"aliases\": [\n \"acme_primary\",\n \"acme_1\"\n ],\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 \"primaryEmail\": \"admin@example.com\",\n \"settings\": [\n {\n \"id\": \"accountSettingId\",\n \"value\": \"INR\",\n \"namespace\": \"USER\",\n \"name\": \"Settings Name\",\n \"dataType\": \"STRING\"\n }\n ],\n \"netTermDays\": 45\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.togai.com/accounts")
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\": \"ACC00001\",\n \"name\": \"Primary Account\",\n \"customerId\": \"C1234qwd\",\n \"aliases\": [\n \"acme_primary\",\n \"acme_1\"\n ],\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 \"primaryEmail\": \"admin@example.com\",\n \"settings\": [\n {\n \"id\": \"accountSettingId\",\n \"value\": \"INR\",\n \"namespace\": \"USER\",\n \"name\": \"Settings Name\",\n \"dataType\": \"STRING\"\n }\n ],\n \"netTermDays\": 45\n}"
response = http.request(request)
puts response.read_body{
"id": "G234DZZKBKACATFFGVGEMERFI",
"name": "ACME Enterprise - Account2",
"invoiceCurrency": "USD",
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina",
"country": "US"
},
"primaryEmail": "admin@example.com",
"aliases": [
{
"alias": "account2@acme.com",
"status": "ACTIVE"
},
{
"alias": "+1234567890",
"status": "ACTIVE"
}
],
"status": "ACTIVE"
}{
"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
Payload to create account
Payload to create account
Identifier of the account
50"ACC00001"
Name of the Account
3 - 255"Primary Account"
Customer Identifier for whom the account is being created
1 - 255"C1234ewf"
Aliases are tags that are associated with an account. Multiple aliases are allowed for a single account.
103 - 50"acme_primary"
Aliases which effective range
Show child attributes
Show child attributes
billing address of the customer
Show child attributes
Show child attributes
Primary email of the account
255"admin@example.com"
10Show child attributes
Show child attributes
Net term for the invoices of the account
45
Additional information associated with the account. Example: GSTN, VATN
Show child attributes
Show child attributes
Response
Response for Create and Get account requests
Structure of an account
Identifier of the account
50Name of the Account
3 - 255Identifier of the customer
Status of the account
ACTIVE, ARCHIVED "ACTIVE"
list of aliases of the account
10Show child attributes
Show child attributes
billing address of the customer
Show child attributes
Show child attributes
Primary email of the customer
255"admin@example.com"
10Show child attributes
Show child attributes
Invoice group details
Show child attributes
Show child attributes
Additional information associated with the account. Example: GSTN, VATN
Show child attributes
Show child attributes
