Create an account
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",
"togaiAccountId": "account.safdla.c234ds",
"customerId": "ACME",
"togaiCustomerId": "customer.savass.11e1a",
"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",
"billingInformation": {
"emailRecipients": [
"admin@example.com",
"acme@acme.com",
"acmeacme@acme.com"
],
"additionalEmailRecipients": [
"admin@acme.com"
]
},
"aliases": [
{
"alias": "account2@acme.com"
},
{
"alias": "+1234567890"
}
],
"status": "ACTIVE"
}Accounts
Create an account
This API let’s you to create an account for a customer using customer_id.
POST
/
accounts
Create an account
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",
"togaiAccountId": "account.safdla.c234ds",
"customerId": "ACME",
"togaiCustomerId": "customer.savass.11e1a",
"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",
"billingInformation": {
"emailRecipients": [
"admin@example.com",
"acme@acme.com",
"acmeacme@acme.com"
],
"additionalEmailRecipients": [
"admin@acme.com"
]
},
"aliases": [
{
"alias": "account2@acme.com"
},
{
"alias": "+1234567890"
}
],
"status": "ACTIVE"
}Authorizations
Body
application/json
Payload to create account
Payload to create account
Use ISO 4217 currency code in which the account must be invoiced.
For example: AED is the currency code for United Arab Emirates dirham.
Required string length:
3Response
Response for Create and Get account requests
Structure of an account
ISO_4217 code of the currency in which the account must be invoiced Defaults to Base currency.
Required string length:
3Example:
"USD"
