curl --request POST \
--url https://api.sandbox.lead.bank/v2/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--header 'Idempotency-Key: <idempotency-key>' \
--form file=@example-file \
--form type=loan_agreement \
--form 'metadata={};type=application/json'import requests
url = "https://api.sandbox.lead.bank/v2/files"
files = { "file": ("example-file", open("example-file", "rb")) }
files["metadata"] = (None, "{}", "application/json")
payload = { "type": "loan_agreement" }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('type', 'loan_agreement');
form.append('metadata', '{}');
const options = {
method: 'POST',
headers: {'Idempotency-Key': '<idempotency-key>', Authorization: 'Bearer <token>'}
};
options.body = form;
fetch('https://api.sandbox.lead.bank/v2/files', 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/v2/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\nloan_agreement\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\nContent-Type: application/json\r\n\r\n{}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data",
"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/v2/files"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\nloan_agreement\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\nContent-Type: application/json\r\n\r\n{}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
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/v2/files")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\nloan_agreement\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\nContent-Type: application/json\r\n\r\n{}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.lead.bank/v2/files")
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.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\nloan_agreement\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\nContent-Type: application/json\r\n\r\n{}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "file_7RwQ2mK9pL4xT1vN8jS5",
"uploaded_by": "partner",
"file_name": "loan_agreement_acct_4471.pdf",
"type": "loan_agreement",
"content_type": "application/pdf",
"size_bytes": 184233,
"checksum": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"created_at": "2026-09-14T14:22:01Z",
"updated_at": "2026-09-14T14:22:01Z",
"metadata": {}
}{
"code": "idempotency_key_missing",
"message": "The Idempotency-Key header is required for this endpoint."
}{
"code": "token_invalid",
"message": "The bearer token is missing, expired, or invalid."
}{
"code": "idempotency_key_in_use",
"message": "A concurrent request using this Idempotency-Key is still in flight."
}{
"code": "content_too_large",
"message": "The request is over a size limit for this endpoint. Make it smaller and resend it.",
"errors": [
{
"code": "body_too_large",
"message": "file is 52428801 bytes, which is over this endpoint's 50 MB limit.",
"parameters": [
"file"
]
}
]
}{
"code": "parameters_invalid",
"message": "One or more parameters are invalid.",
"errors": [
{
"code": "required",
"message": "The file part is required and must include a filename and Content-Type.",
"parameters": [
"file"
]
}
]
}{
"code": "rate_limit_exceeded",
"message": "You have exceeded the rate limit for this endpoint. Retry with backoff."
}{
"code": "internal_server_error",
"message": "Something went wrong on our end. Contact Lead with the Request-Id if this persists."
}{
"code": "service_unavailable",
"message": "The service is temporarily unavailable. Retry after the indicated delay."
}{
"code": "gateway_timeout",
"message": "An upstream system timed out. Retry with backoff."
}Create a File
Upload a File to Lead and get back a Lead-issued id you can reference immediately.
curl --request POST \
--url https://api.sandbox.lead.bank/v2/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--header 'Idempotency-Key: <idempotency-key>' \
--form file=@example-file \
--form type=loan_agreement \
--form 'metadata={};type=application/json'import requests
url = "https://api.sandbox.lead.bank/v2/files"
files = { "file": ("example-file", open("example-file", "rb")) }
files["metadata"] = (None, "{}", "application/json")
payload = { "type": "loan_agreement" }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('type', 'loan_agreement');
form.append('metadata', '{}');
const options = {
method: 'POST',
headers: {'Idempotency-Key': '<idempotency-key>', Authorization: 'Bearer <token>'}
};
options.body = form;
fetch('https://api.sandbox.lead.bank/v2/files', 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/v2/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\nloan_agreement\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\nContent-Type: application/json\r\n\r\n{}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data",
"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/v2/files"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\nloan_agreement\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\nContent-Type: application/json\r\n\r\n{}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
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/v2/files")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\nloan_agreement\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\nContent-Type: application/json\r\n\r\n{}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.lead.bank/v2/files")
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.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\nloan_agreement\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\nContent-Type: application/json\r\n\r\n{}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "file_7RwQ2mK9pL4xT1vN8jS5",
"uploaded_by": "partner",
"file_name": "loan_agreement_acct_4471.pdf",
"type": "loan_agreement",
"content_type": "application/pdf",
"size_bytes": 184233,
"checksum": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"created_at": "2026-09-14T14:22:01Z",
"updated_at": "2026-09-14T14:22:01Z",
"metadata": {}
}{
"code": "idempotency_key_missing",
"message": "The Idempotency-Key header is required for this endpoint."
}{
"code": "token_invalid",
"message": "The bearer token is missing, expired, or invalid."
}{
"code": "idempotency_key_in_use",
"message": "A concurrent request using this Idempotency-Key is still in flight."
}{
"code": "content_too_large",
"message": "The request is over a size limit for this endpoint. Make it smaller and resend it.",
"errors": [
{
"code": "body_too_large",
"message": "file is 52428801 bytes, which is over this endpoint's 50 MB limit.",
"parameters": [
"file"
]
}
]
}{
"code": "parameters_invalid",
"message": "One or more parameters are invalid.",
"errors": [
{
"code": "required",
"message": "The file part is required and must include a filename and Content-Type.",
"parameters": [
"file"
]
}
]
}{
"code": "rate_limit_exceeded",
"message": "You have exceeded the rate limit for this endpoint. Retry with backoff."
}{
"code": "internal_server_error",
"message": "Something went wrong on our end. Contact Lead with the Request-Id if this persists."
}{
"code": "service_unavailable",
"message": "The service is temporarily unavailable. Retry after the indicated delay."
}{
"code": "gateway_timeout",
"message": "An upstream system timed out. Retry with backoff."
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Idempotency key
255Body
The file bytes, as a standard multipart file part. The part's
own filename and Content-Type headers — which HTTP clients
set automatically — are your declaration of the file's name and
format, and are returned as file_name and content_type.
The file's type. Must be a valid enum.
The accepted values are grouped by the object the file can be linked to.
Application and User Account
aan, ach_authorization, autopay_authorization, bo_certification,
cardholder_agreement, consent_to_link_account, consent_to_link_hsa,
consumer_credit_auth, credit_pull_consent, credit_score_notice,
decision_maker_document, deposit_agreement, eft_authorization,
esign_agreement, fcra_notice, lead_funds_transfer_agreement,
lead_privacy_policy, loan_agreement, loc_agreement,
missed_payments_policy, mla_notice, negative_option_consent,
notice_of_incompleteness, offer_summary, partner_privacy_policy,
patriot_act_notice, periodic_statement, personal_guarantee,
pre_approval_terms, prohibited_industry_certification, tcpa_consent,
terms_of_use, truth_in_lending_document
Entity — individual
adverse_media, bank_statement, drivers_license,
financial_statement, id_selfie, investigation_report,
matriculate_id, military_id, national_id, passport,
permanent_residency_id, proof_of_address, public_records,
state_or_provincial_id, utility_bills
Entity — business
adverse_media, bank_statement, certificate_of_good_standing,
financial_statement, formation_document, id_selfie,
investigation_report, partnership_agreement,
proof_of_address, proof_of_place_on_stock_exchange, public_records,
tax_certificate, tax_returns, utility_bills
Entity — sole prop
adverse_media, bank_statement, drivers_license,
financial_statement, id_selfie, investigation_report,
matriculate_id, military_id, name_certificate, national_id,
passport, permanent_residency_id, proof_of_address,
public_records, state_or_provincial_id, tax_certificate,
tax_returns, utility_bills
"loan_agreement"
A set of key-value pairs that can be used to store additional information related to this object.
Show child attributes
Show child attributes
Response
File object created.
Unique ID of the file. Use this to link the file to Entity, Application and User Account objects.
"file_7RwQ2mK9pL4xT1vN8jS5"
Who created the file. Set by Lead, not declarable on upload.
partner: created by you through the files API.lead: reserved for files Lead itself creates.
partner, lead "partner"
The filename you declared, taken from the uploaded part's filename
header.
255"loan_agreement_acct_4471.pdf"
The file's type. Must be a valid enum.
The accepted values are grouped by the object the file can be linked to.
Application and User Account
aan, ach_authorization, autopay_authorization, bo_certification,
cardholder_agreement, consent_to_link_account, consent_to_link_hsa,
consumer_credit_auth, credit_pull_consent, credit_score_notice,
decision_maker_document, deposit_agreement, eft_authorization,
esign_agreement, fcra_notice, lead_funds_transfer_agreement,
lead_privacy_policy, loan_agreement, loc_agreement,
missed_payments_policy, mla_notice, negative_option_consent,
notice_of_incompleteness, offer_summary, partner_privacy_policy,
patriot_act_notice, periodic_statement, personal_guarantee,
pre_approval_terms, prohibited_industry_certification, tcpa_consent,
terms_of_use, truth_in_lending_document
Entity — individual
adverse_media, bank_statement, drivers_license,
financial_statement, id_selfie, investigation_report,
matriculate_id, military_id, national_id, passport,
permanent_residency_id, proof_of_address, public_records,
state_or_provincial_id, utility_bills
Entity — business
adverse_media, bank_statement, certificate_of_good_standing,
financial_statement, formation_document, id_selfie,
investigation_report, partnership_agreement,
proof_of_address, proof_of_place_on_stock_exchange, public_records,
tax_certificate, tax_returns, utility_bills
Entity — sole prop
adverse_media, bank_statement, drivers_license,
financial_statement, id_selfie, investigation_report,
matriculate_id, military_id, name_certificate, national_id,
passport, permanent_residency_id, proof_of_address,
public_records, state_or_provincial_id, tax_certificate,
tax_returns, utility_bills
"loan_agreement"
MIME type of the file (e.g., application/pdf), taken from the Content-Type header of the multipart file part.
"application/pdf"
Size of the file in bytes.
184233
A SHA-256 checksum digest of the file bytes, computed by Lead as the file is received.
"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
The ISO-8601 timestamp at which the file was created.
"2026-09-14T14:22:01Z"
The ISO-8601 timestamp at which the file was last updated.
"2026-09-14T14:22:01Z"
A set of key-value pairs that can be used to store additional information related to this object.
Show child attributes
Show child attributes
{}
Was this page helpful?

