Get an Access Token
curl --request POST \
--url https://api.sandbox.lead.bank/v1/oauth/token \
--header 'Content-Type: application/json' \
--data '
{
"grant_type": "client_credentials",
"client_id": "<client_id>",
"client_secret": "<client_secret>",
"scope": "ach/read"
}
'import requests
url = "https://api.sandbox.lead.bank/v1/oauth/token"
payload = {
"grant_type": "client_credentials",
"client_id": "<client_id>",
"client_secret": "<client_secret>",
"scope": "ach/read"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
grant_type: 'client_credentials',
client_id: '<client_id>',
client_secret: '<client_secret>',
scope: 'ach/read'
})
};
fetch('https://api.sandbox.lead.bank/v1/oauth/token', 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.sandbox.lead.bank/v1/oauth/token",
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([
'grant_type' => 'client_credentials',
'client_id' => '<client_id>',
'client_secret' => '<client_secret>',
'scope' => 'ach/read'
]),
CURLOPT_HTTPHEADER => [
"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.sandbox.lead.bank/v1/oauth/token"
payload := strings.NewReader("{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"<client_id>\",\n \"client_secret\": \"<client_secret>\",\n \"scope\": \"ach/read\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.sandbox.lead.bank/v1/oauth/token")
.header("Content-Type", "application/json")
.body("{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"<client_id>\",\n \"client_secret\": \"<client_secret>\",\n \"scope\": \"ach/read\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.lead.bank/v1/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"<client_id>\",\n \"client_secret\": \"<client_secret>\",\n \"scope\": \"ach/read\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "AN_ACCESS_TOKEN",
"token_type": "Bearer",
"scope": "ach/read account_number/read",
"expires_in": 86400
}{
"status": 400,
"code": "parameters_invalid",
"title": "Your request body did not parse.",
"detail": "Invalid grant type."
}OAuth
Get an Access Token
Exchange your client credentials for an access code.
POST
/
v1
/
oauth
/
token
Get an Access Token
curl --request POST \
--url https://api.sandbox.lead.bank/v1/oauth/token \
--header 'Content-Type: application/json' \
--data '
{
"grant_type": "client_credentials",
"client_id": "<client_id>",
"client_secret": "<client_secret>",
"scope": "ach/read"
}
'import requests
url = "https://api.sandbox.lead.bank/v1/oauth/token"
payload = {
"grant_type": "client_credentials",
"client_id": "<client_id>",
"client_secret": "<client_secret>",
"scope": "ach/read"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
grant_type: 'client_credentials',
client_id: '<client_id>',
client_secret: '<client_secret>',
scope: 'ach/read'
})
};
fetch('https://api.sandbox.lead.bank/v1/oauth/token', 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.sandbox.lead.bank/v1/oauth/token",
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([
'grant_type' => 'client_credentials',
'client_id' => '<client_id>',
'client_secret' => '<client_secret>',
'scope' => 'ach/read'
]),
CURLOPT_HTTPHEADER => [
"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.sandbox.lead.bank/v1/oauth/token"
payload := strings.NewReader("{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"<client_id>\",\n \"client_secret\": \"<client_secret>\",\n \"scope\": \"ach/read\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.sandbox.lead.bank/v1/oauth/token")
.header("Content-Type", "application/json")
.body("{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"<client_id>\",\n \"client_secret\": \"<client_secret>\",\n \"scope\": \"ach/read\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.lead.bank/v1/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"<client_id>\",\n \"client_secret\": \"<client_secret>\",\n \"scope\": \"ach/read\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "AN_ACCESS_TOKEN",
"token_type": "Bearer",
"scope": "ach/read account_number/read",
"expires_in": 86400
}{
"status": 400,
"code": "parameters_invalid",
"title": "Your request body did not parse.",
"detail": "Invalid grant type."
}Body
application/json
The type of access token you want to request.
Available options:
client_credentials Your client ID.
Example:
"<client_id>"
Your client secret.
Example:
"<client_secret>"
A space delimited list of scopes your access token should be provisioned to allow.
Available options:
account_number/read, account_number/read_write, ach/read, ach/read_write, wire/read, wire/read_write, instant_payment/read, instant_payment/read_write, event/read, internal_transfer/read, internal_transfer/read_write, lending/read, lending/read_write, entity/read, entity/read_write, funding/read, funding/read_write, subledger_balance/read, subledger_balance/read_write, account/read, account/read_write, application/read, application/read_write, blockchain_payment/read, blockchain_payment/read_write, card/read, card/read_write Example:
"ach/read"
Response
Successful token exchange
A Base64 access token.
Example:
"AN_ACCESS_TOKEN"
The token type.
Example:
"Bearer"
A space delimited list of scopes your access token is provisioned for.
Example:
"ach/read account_number/read"
The number of seconds the access token will expire in.
Example:
86400
Was this page helpful?

