cURL
curl --request GET \
--url https://api.grainfinance.co/v1/customers \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.grainfinance.co/v1/customers"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.grainfinance.co/v1/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.grainfinance.co/v1/customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.grainfinance.co/v1/customers"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.grainfinance.co/v1/customers")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.grainfinance.co/v1/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"customers": [
{
"id": "1b0ada1e-fa1b-4cfe-a553-01b340c5650e",
"companyName": "Ollivander's Wand Shop",
"companyCountry": "GB",
"externalCustomerId": "630231b3ae0d7e9e5097ad35",
"companyAddress": "12 Diagon Alley",
"companyCity": "London",
"companyState": "London",
"contactEmail": "customer@company.com",
"contactFullName": "Garrick Ollivander",
"contactPhoneNumber": "+12125551234",
"companyTaxId": "123-45-6789",
"extraFields": {
"field_a": "value_a",
"field_b": "value_b"
}
}
],
"pagination": {
"page": 2,
"perPage": 50.5,
"totalResults": 123
}
}Customers
List Customers
Retrieves a list of all existing customers.
GET
/
customers
cURL
curl --request GET \
--url https://api.grainfinance.co/v1/customers \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.grainfinance.co/v1/customers"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.grainfinance.co/v1/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.grainfinance.co/v1/customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.grainfinance.co/v1/customers"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.grainfinance.co/v1/customers")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.grainfinance.co/v1/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"customers": [
{
"id": "1b0ada1e-fa1b-4cfe-a553-01b340c5650e",
"companyName": "Ollivander's Wand Shop",
"companyCountry": "GB",
"externalCustomerId": "630231b3ae0d7e9e5097ad35",
"companyAddress": "12 Diagon Alley",
"companyCity": "London",
"companyState": "London",
"contactEmail": "customer@company.com",
"contactFullName": "Garrick Ollivander",
"contactPhoneNumber": "+12125551234",
"companyTaxId": "123-45-6789",
"extraFields": {
"field_a": "value_a",
"field_b": "value_b"
}
}
],
"pagination": {
"page": 2,
"perPage": 50.5,
"totalResults": 123
}
}Authorizations
Basic authentication using the partner API keys from https://console.grainfinance.co/keys
Query Parameters
external_customer_id is the customer id, as identified within your system
page number indicating which set of items to return The page indicating which set of items are returned
Required range:
x >= 1number of items in a page
Required range:
1 <= x <= 100Response
200 - application/json
Customer Found
⌘I