curl --request POST \
--url https://api.sandbox.lead.bank/v0/accounts/{id}/close \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"status_reason": "client_closed"
}
'import requests
url = "https://api.sandbox.lead.bank/v0/accounts/{id}/close"
payload = { "status_reason": "client_closed" }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({status_reason: 'client_closed'})
};
fetch('https://api.sandbox.lead.bank/v0/accounts/{id}/close', 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/v0/accounts/{id}/close",
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([
'status_reason' => 'client_closed'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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/v0/accounts/{id}/close"
payload := strings.NewReader("{\n \"status_reason\": \"client_closed\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.sandbox.lead.bank/v0/accounts/{id}/close")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status_reason\": \"client_closed\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.lead.bank/v0/accounts/{id}/close")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status_reason\": \"client_closed\"\n}"
response = http.request(request)
puts response.read_body{
"id": "account_xyz123",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"application_id": "application_xyz123",
"status": "active",
"status_reason": "client_closed",
"capabilities": [
"deposit"
],
"entities": {
"account_holder_type": "consumer"
},
"details": {
"product_name": "<string>",
"closed_at": "2023-11-07T05:31:56Z",
"credit": {
"is_secured": true,
"is_mla": true,
"underwriting_grade": "<string>",
"currency": "USD",
"available_credit": 123,
"limit": 123,
"max_limit": 123,
"scra": {
"start_date": "2023-12-25",
"end_date": "2023-12-25"
},
"report": {
"pulled_at": "2023-11-07T05:31:56Z",
"source": "equifax",
"score": 575,
"non_score_value": "unestablished"
}
},
"adverse_action_notice": {
"delivered_at": "2023-11-07T05:31:56Z",
"reason": "<string>",
"delivery_method": "email"
}
},
"metadata": {},
"documents": [
{
"document_id": "document_2N5Hk8xYmQpL9rBvC3jD",
"type": "aan",
"displayed_at": "2023-11-07T05:31:56Z",
"consented_at": "2023-11-07T05:31:56Z",
"version": "v1"
}
],
"client_account_id": "<string>"
}{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"status": "<string>",
"invalid_parameters": [
{
"parameter": "transaction_type",
"reason": "<string>"
}
],
"instance": "<string>"
}{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"status": "<string>",
"invalid_parameters": [
{
"parameter": "transaction_type",
"reason": "<string>"
}
],
"instance": "<string>"
}{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"status": "<string>",
"invalid_parameters": [
{
"parameter": "transaction_type",
"reason": "<string>"
}
],
"instance": "<string>"
}{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"status": "<string>",
"invalid_parameters": [
{
"parameter": "transaction_type",
"reason": "<string>"
}
],
"instance": "<string>"
}{
"code": "invalid_status_transition",
"title": "Invalid status transition.",
"detail": "Account cannot be closed from current status.",
"invalid_parameters": []
}{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"status": "<string>",
"invalid_parameters": [
{
"parameter": "transaction_type",
"reason": "<string>"
}
],
"instance": "<string>"
}{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"status": "<string>",
"invalid_parameters": [
{
"parameter": "transaction_type",
"reason": "<string>"
}
],
"instance": "<string>"
}Close an Account
Transitions an account to closed status (terminal state).
This action cannot be undone.
Idempotency
The Idempotency-Key header is required.
curl --request POST \
--url https://api.sandbox.lead.bank/v0/accounts/{id}/close \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"status_reason": "client_closed"
}
'import requests
url = "https://api.sandbox.lead.bank/v0/accounts/{id}/close"
payload = { "status_reason": "client_closed" }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({status_reason: 'client_closed'})
};
fetch('https://api.sandbox.lead.bank/v0/accounts/{id}/close', 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/v0/accounts/{id}/close",
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([
'status_reason' => 'client_closed'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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/v0/accounts/{id}/close"
payload := strings.NewReader("{\n \"status_reason\": \"client_closed\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.sandbox.lead.bank/v0/accounts/{id}/close")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status_reason\": \"client_closed\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.lead.bank/v0/accounts/{id}/close")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status_reason\": \"client_closed\"\n}"
response = http.request(request)
puts response.read_body{
"id": "account_xyz123",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"application_id": "application_xyz123",
"status": "active",
"status_reason": "client_closed",
"capabilities": [
"deposit"
],
"entities": {
"account_holder_type": "consumer"
},
"details": {
"product_name": "<string>",
"closed_at": "2023-11-07T05:31:56Z",
"credit": {
"is_secured": true,
"is_mla": true,
"underwriting_grade": "<string>",
"currency": "USD",
"available_credit": 123,
"limit": 123,
"max_limit": 123,
"scra": {
"start_date": "2023-12-25",
"end_date": "2023-12-25"
},
"report": {
"pulled_at": "2023-11-07T05:31:56Z",
"source": "equifax",
"score": 575,
"non_score_value": "unestablished"
}
},
"adverse_action_notice": {
"delivered_at": "2023-11-07T05:31:56Z",
"reason": "<string>",
"delivery_method": "email"
}
},
"metadata": {},
"documents": [
{
"document_id": "document_2N5Hk8xYmQpL9rBvC3jD",
"type": "aan",
"displayed_at": "2023-11-07T05:31:56Z",
"consented_at": "2023-11-07T05:31:56Z",
"version": "v1"
}
],
"client_account_id": "<string>"
}{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"status": "<string>",
"invalid_parameters": [
{
"parameter": "transaction_type",
"reason": "<string>"
}
],
"instance": "<string>"
}{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"status": "<string>",
"invalid_parameters": [
{
"parameter": "transaction_type",
"reason": "<string>"
}
],
"instance": "<string>"
}{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"status": "<string>",
"invalid_parameters": [
{
"parameter": "transaction_type",
"reason": "<string>"
}
],
"instance": "<string>"
}{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"status": "<string>",
"invalid_parameters": [
{
"parameter": "transaction_type",
"reason": "<string>"
}
],
"instance": "<string>"
}{
"code": "invalid_status_transition",
"title": "Invalid status transition.",
"detail": "Account cannot be closed from current status.",
"invalid_parameters": []
}{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"status": "<string>",
"invalid_parameters": [
{
"parameter": "transaction_type",
"reason": "<string>"
}
],
"instance": "<string>"
}{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"status": "<string>",
"invalid_parameters": [
{
"parameter": "transaction_type",
"reason": "<string>"
}
],
"instance": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Unique key to ensure idempotent requests
255Path Parameters
Account ID The ID of the Account object.
^account_\w+$"account_xyz123"
Body
Request body for closing an account
Valid reasons for closing an account
entity_closed, client_closed, paid_off, charged_off, canceled Response
Account closed successfully.
An account object
The ID of the Account object.
^account_\w+$"account_xyz123"
Creation timestamp
Last update timestamp
Unique identifier for the application. Prefixed with application_.
^application_\w+$"application_xyz123"
Current state of the account
active, inactive, closed Machine-readable reason for the current status
client_closed, entity_closed, frozen, dormant, active, paid_off, charged_off, canceled, other List of items that inform Lead how the Account will be used
Capability that informs Lead how the Account will be used
deposit, credit_with_underwriting, credit_without_underwriting Entity relationships associated with the account (response only)
Show child attributes
Show child attributes
Core details of the account
Show child attributes
Show child attributes
A set of key-value pairs that can be used to store additional information related to this object.
Show child attributes
Show child attributes
Array of associated legal or informational documents
Show child attributes
Show child attributes
Client-provided identifier for the account. Optional: present only for accounts created via file upload, and omitted for accounts created through the API, which are identified solely by their server-generated ID.
Was this page helpful?

