curl --request PATCH \
--url https://api.togai.com/accounts/{account_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "New Account Name",
"primaryEmail": "admin@example.com",
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina"
}
}
'import requests
url = "https://api.togai.com/accounts/{account_id}"
payload = {
"name": "New Account Name",
"primaryEmail": "admin@example.com",
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'New Account Name',
primaryEmail: 'admin@example.com',
address: {
phoneNumber: '+919876543210',
line1: '2281 Broadway Street',
line2: 'G-31',
postalCode: '29501',
city: 'Florence',
state: 'South Carolina'
}
})
};
fetch('https://api.togai.com/accounts/{account_id}', 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/{account_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'New Account Name',
'primaryEmail' => 'admin@example.com',
'address' => [
'phoneNumber' => '+919876543210',
'line1' => '2281 Broadway Street',
'line2' => 'G-31',
'postalCode' => '29501',
'city' => 'Florence',
'state' => 'South Carolina'
]
]),
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/{account_id}"
payload := strings.NewReader("{\n \"name\": \"New Account Name\",\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 }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.togai.com/accounts/{account_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"New Account Name\",\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 }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.togai.com/accounts/{account_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"New Account Name\",\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 }\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"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}Update an account
This API let’s you to update an account’s information using customer_id and account_id.
curl --request PATCH \
--url https://api.togai.com/accounts/{account_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "New Account Name",
"primaryEmail": "admin@example.com",
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina"
}
}
'import requests
url = "https://api.togai.com/accounts/{account_id}"
payload = {
"name": "New Account Name",
"primaryEmail": "admin@example.com",
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'New Account Name',
primaryEmail: 'admin@example.com',
address: {
phoneNumber: '+919876543210',
line1: '2281 Broadway Street',
line2: 'G-31',
postalCode: '29501',
city: 'Florence',
state: 'South Carolina'
}
})
};
fetch('https://api.togai.com/accounts/{account_id}', 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/{account_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'New Account Name',
'primaryEmail' => 'admin@example.com',
'address' => [
'phoneNumber' => '+919876543210',
'line1' => '2281 Broadway Street',
'line2' => 'G-31',
'postalCode' => '29501',
'city' => 'Florence',
'state' => 'South Carolina'
]
]),
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/{account_id}"
payload := strings.NewReader("{\n \"name\": \"New Account Name\",\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 }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.togai.com/accounts/{account_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"New Account Name\",\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 }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.togai.com/accounts/{account_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"New Account Name\",\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 }\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"
}{
"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.
Path Parameters
account_id corresponding to an account
50"ACC00001"
Body
Payload to update account
Payload to update account
Name of the Account
3 - 255"ACME Enterprise"
ACTIVE, DRAFT Primary email of the account
320"admin@example.com"
Billing information of an account
Show child attributes
Show child attributes
billing address of the customer
Show child attributes
Show child attributes
Additional information associated with the account. Example: GSTN, VATN NOTE: This replaces the existing metadata if the metadata in the request is not null. To remove all existing metadata, use empty object
Show child attributes
Show child attributes
Tag for accounts are stored in lowercase
Response
Response for Create and Get account requests
Structure of an account
Identifier of the account
50Unique identifier of the account
Unique identifier of the customer
Name of the Account
3 - 255Identifier of the customer
Status of the account
ACTIVE, DRAFT, 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
320"admin@example.com"
Billing information of an account
Show child attributes
Show child attributes
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
Tag for accounts are stored in lowercase
