curl --request POST \
--url https://api.grainfinance.co/v1/customers/{customerId}/update \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"contactEmail": "customer@company.com",
"contactFullName": "Garrick Ollivander",
"contactPhoneNumber": "+12125551234",
"companyName": "Ollivander's Wand Shop",
"companyAddress": "12 Diagon Alley",
"companyCity": "London",
"companyState": "London",
"companyCountry": "GB",
"companyTaxId": "123-45-6789",
"externalCustomerId": "630231b3ae0d7e9e5097ad35",
"extraFields": {
"field_a": "value_a",
"field_b": "value_b"
}
}
EOFimport requests
url = "https://api.grainfinance.co/v1/customers/{customerId}/update"
payload = {
"contactEmail": "customer@company.com",
"contactFullName": "Garrick Ollivander",
"contactPhoneNumber": "+12125551234",
"companyName": "Ollivander's Wand Shop",
"companyAddress": "12 Diagon Alley",
"companyCity": "London",
"companyState": "London",
"companyCountry": "GB",
"companyTaxId": "123-45-6789",
"externalCustomerId": "630231b3ae0d7e9e5097ad35",
"extraFields": {
"field_a": "value_a",
"field_b": "value_b"
}
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contactEmail: 'customer@company.com',
contactFullName: 'Garrick Ollivander',
contactPhoneNumber: '+12125551234',
companyName: 'Ollivander\'s Wand Shop',
companyAddress: '12 Diagon Alley',
companyCity: 'London',
companyState: 'London',
companyCountry: 'GB',
companyTaxId: '123-45-6789',
externalCustomerId: '630231b3ae0d7e9e5097ad35',
extraFields: {field_a: 'value_a', field_b: 'value_b'}
})
};
fetch('https://api.grainfinance.co/v1/customers/{customerId}/update', 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.grainfinance.co/v1/customers/{customerId}/update",
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([
'contactEmail' => 'customer@company.com',
'contactFullName' => 'Garrick Ollivander',
'contactPhoneNumber' => '+12125551234',
'companyName' => 'Ollivander\'s Wand Shop',
'companyAddress' => '12 Diagon Alley',
'companyCity' => 'London',
'companyState' => 'London',
'companyCountry' => 'GB',
'companyTaxId' => '123-45-6789',
'externalCustomerId' => '630231b3ae0d7e9e5097ad35',
'extraFields' => [
'field_a' => 'value_a',
'field_b' => 'value_b'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.grainfinance.co/v1/customers/{customerId}/update"
payload := strings.NewReader("{\n \"contactEmail\": \"customer@company.com\",\n \"contactFullName\": \"Garrick Ollivander\",\n \"contactPhoneNumber\": \"+12125551234\",\n \"companyName\": \"Ollivander's Wand Shop\",\n \"companyAddress\": \"12 Diagon Alley\",\n \"companyCity\": \"London\",\n \"companyState\": \"London\",\n \"companyCountry\": \"GB\",\n \"companyTaxId\": \"123-45-6789\",\n \"externalCustomerId\": \"630231b3ae0d7e9e5097ad35\",\n \"extraFields\": {\n \"field_a\": \"value_a\",\n \"field_b\": \"value_b\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.grainfinance.co/v1/customers/{customerId}/update")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"contactEmail\": \"customer@company.com\",\n \"contactFullName\": \"Garrick Ollivander\",\n \"contactPhoneNumber\": \"+12125551234\",\n \"companyName\": \"Ollivander's Wand Shop\",\n \"companyAddress\": \"12 Diagon Alley\",\n \"companyCity\": \"London\",\n \"companyState\": \"London\",\n \"companyCountry\": \"GB\",\n \"companyTaxId\": \"123-45-6789\",\n \"externalCustomerId\": \"630231b3ae0d7e9e5097ad35\",\n \"extraFields\": {\n \"field_a\": \"value_a\",\n \"field_b\": \"value_b\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.grainfinance.co/v1/customers/{customerId}/update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contactEmail\": \"customer@company.com\",\n \"contactFullName\": \"Garrick Ollivander\",\n \"contactPhoneNumber\": \"+12125551234\",\n \"companyName\": \"Ollivander's Wand Shop\",\n \"companyAddress\": \"12 Diagon Alley\",\n \"companyCity\": \"London\",\n \"companyState\": \"London\",\n \"companyCountry\": \"GB\",\n \"companyTaxId\": \"123-45-6789\",\n \"externalCustomerId\": \"630231b3ae0d7e9e5097ad35\",\n \"extraFields\": {\n \"field_a\": \"value_a\",\n \"field_b\": \"value_b\"\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}Update Customer
Updates an existing customer’s information.
curl --request POST \
--url https://api.grainfinance.co/v1/customers/{customerId}/update \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"contactEmail": "customer@company.com",
"contactFullName": "Garrick Ollivander",
"contactPhoneNumber": "+12125551234",
"companyName": "Ollivander's Wand Shop",
"companyAddress": "12 Diagon Alley",
"companyCity": "London",
"companyState": "London",
"companyCountry": "GB",
"companyTaxId": "123-45-6789",
"externalCustomerId": "630231b3ae0d7e9e5097ad35",
"extraFields": {
"field_a": "value_a",
"field_b": "value_b"
}
}
EOFimport requests
url = "https://api.grainfinance.co/v1/customers/{customerId}/update"
payload = {
"contactEmail": "customer@company.com",
"contactFullName": "Garrick Ollivander",
"contactPhoneNumber": "+12125551234",
"companyName": "Ollivander's Wand Shop",
"companyAddress": "12 Diagon Alley",
"companyCity": "London",
"companyState": "London",
"companyCountry": "GB",
"companyTaxId": "123-45-6789",
"externalCustomerId": "630231b3ae0d7e9e5097ad35",
"extraFields": {
"field_a": "value_a",
"field_b": "value_b"
}
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contactEmail: 'customer@company.com',
contactFullName: 'Garrick Ollivander',
contactPhoneNumber: '+12125551234',
companyName: 'Ollivander\'s Wand Shop',
companyAddress: '12 Diagon Alley',
companyCity: 'London',
companyState: 'London',
companyCountry: 'GB',
companyTaxId: '123-45-6789',
externalCustomerId: '630231b3ae0d7e9e5097ad35',
extraFields: {field_a: 'value_a', field_b: 'value_b'}
})
};
fetch('https://api.grainfinance.co/v1/customers/{customerId}/update', 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.grainfinance.co/v1/customers/{customerId}/update",
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([
'contactEmail' => 'customer@company.com',
'contactFullName' => 'Garrick Ollivander',
'contactPhoneNumber' => '+12125551234',
'companyName' => 'Ollivander\'s Wand Shop',
'companyAddress' => '12 Diagon Alley',
'companyCity' => 'London',
'companyState' => 'London',
'companyCountry' => 'GB',
'companyTaxId' => '123-45-6789',
'externalCustomerId' => '630231b3ae0d7e9e5097ad35',
'extraFields' => [
'field_a' => 'value_a',
'field_b' => 'value_b'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.grainfinance.co/v1/customers/{customerId}/update"
payload := strings.NewReader("{\n \"contactEmail\": \"customer@company.com\",\n \"contactFullName\": \"Garrick Ollivander\",\n \"contactPhoneNumber\": \"+12125551234\",\n \"companyName\": \"Ollivander's Wand Shop\",\n \"companyAddress\": \"12 Diagon Alley\",\n \"companyCity\": \"London\",\n \"companyState\": \"London\",\n \"companyCountry\": \"GB\",\n \"companyTaxId\": \"123-45-6789\",\n \"externalCustomerId\": \"630231b3ae0d7e9e5097ad35\",\n \"extraFields\": {\n \"field_a\": \"value_a\",\n \"field_b\": \"value_b\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.grainfinance.co/v1/customers/{customerId}/update")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"contactEmail\": \"customer@company.com\",\n \"contactFullName\": \"Garrick Ollivander\",\n \"contactPhoneNumber\": \"+12125551234\",\n \"companyName\": \"Ollivander's Wand Shop\",\n \"companyAddress\": \"12 Diagon Alley\",\n \"companyCity\": \"London\",\n \"companyState\": \"London\",\n \"companyCountry\": \"GB\",\n \"companyTaxId\": \"123-45-6789\",\n \"externalCustomerId\": \"630231b3ae0d7e9e5097ad35\",\n \"extraFields\": {\n \"field_a\": \"value_a\",\n \"field_b\": \"value_b\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.grainfinance.co/v1/customers/{customerId}/update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contactEmail\": \"customer@company.com\",\n \"contactFullName\": \"Garrick Ollivander\",\n \"contactPhoneNumber\": \"+12125551234\",\n \"companyName\": \"Ollivander's Wand Shop\",\n \"companyAddress\": \"12 Diagon Alley\",\n \"companyCity\": \"London\",\n \"companyState\": \"London\",\n \"companyCountry\": \"GB\",\n \"companyTaxId\": \"123-45-6789\",\n \"externalCustomerId\": \"630231b3ae0d7e9e5097ad35\",\n \"extraFields\": {\n \"field_a\": \"value_a\",\n \"field_b\": \"value_b\"\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}{
"message": "Can't perform this action",
"reason": "Supplied object is in *Cancelled* state, which prevents performing this action"
}Authorizations
Basic authentication using the partner API keys from https://console.grainfinance.co/keys
Path Parameters
Body
The payload required in order to update a customer
The payload required in order to update a customer
The email for the company's primary contact
"customer@company.com"
The name of the company's primary contact
"Garrick Ollivander"
The phone number of the company's primary contact
"+12125551234"
The legal name of the customer's company
"Ollivander's Wand Shop"
The address of the company
"12 Diagon Alley"
The city of the company
"London"
The state the company is in (US based)
"London"
The alpha-2 ISO 3166 country code of the entity's country.
^[A-Za-z]{2}$"GB"
The tax identification or registration number of the company
"123-45-6789"
The id used to identify the customer within your platform
"630231b3ae0d7e9e5097ad35"
Additional fields that provide further details about the customer. These fields should be specified as a valid JSON object.
Show child attributes
Show child attributes
{
"field_a": "value_a",
"field_b": "value_b"
}Response
Customer has been Updated