Add an external bank account
curl --request POST \
--url https://api.tuyo.com/public/external_bank_accounts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Tuyo-API-Version: <tuyo-api-version>' \
--data '
{
"accountType": "us",
"accountNumber": "<string>",
"routingNumber": "<string>",
"address": {
"streetLine1": "<string>",
"city": "<string>",
"postalCode": "<string>",
"country": "<string>",
"streetLine2": "<string>",
"state": "<string>"
},
"holder": "<unknown>"
}
'import requests
url = "https://api.tuyo.com/public/external_bank_accounts"
payload = {
"accountType": "us",
"accountNumber": "<string>",
"routingNumber": "<string>",
"address": {
"streetLine1": "<string>",
"city": "<string>",
"postalCode": "<string>",
"country": "<string>",
"streetLine2": "<string>",
"state": "<string>"
},
"holder": "<unknown>"
}
headers = {
"Tuyo-API-Version": "<tuyo-api-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Tuyo-API-Version': '<tuyo-api-version>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
accountType: 'us',
accountNumber: '<string>',
routingNumber: '<string>',
address: {
streetLine1: '<string>',
city: '<string>',
postalCode: '<string>',
country: '<string>',
streetLine2: '<string>',
state: '<string>'
},
holder: '<unknown>'
})
};
fetch('https://api.tuyo.com/public/external_bank_accounts', 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.tuyo.com/public/external_bank_accounts",
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([
'accountType' => 'us',
'accountNumber' => '<string>',
'routingNumber' => '<string>',
'address' => [
'streetLine1' => '<string>',
'city' => '<string>',
'postalCode' => '<string>',
'country' => '<string>',
'streetLine2' => '<string>',
'state' => '<string>'
],
'holder' => '<unknown>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Tuyo-API-Version: <tuyo-api-version>"
],
]);
$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.tuyo.com/public/external_bank_accounts"
payload := strings.NewReader("{\n \"accountType\": \"us\",\n \"accountNumber\": \"<string>\",\n \"routingNumber\": \"<string>\",\n \"address\": {\n \"streetLine1\": \"<string>\",\n \"city\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"country\": \"<string>\",\n \"streetLine2\": \"<string>\",\n \"state\": \"<string>\"\n },\n \"holder\": \"<unknown>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Tuyo-API-Version", "<tuyo-api-version>")
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.tuyo.com/public/external_bank_accounts")
.header("Tuyo-API-Version", "<tuyo-api-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"accountType\": \"us\",\n \"accountNumber\": \"<string>\",\n \"routingNumber\": \"<string>\",\n \"address\": {\n \"streetLine1\": \"<string>\",\n \"city\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"country\": \"<string>\",\n \"streetLine2\": \"<string>\",\n \"state\": \"<string>\"\n },\n \"holder\": \"<unknown>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tuyo.com/public/external_bank_accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Tuyo-API-Version"] = '<tuyo-api-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"accountType\": \"us\",\n \"accountNumber\": \"<string>\",\n \"routingNumber\": \"<string>\",\n \"address\": {\n \"streetLine1\": \"<string>\",\n \"city\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"country\": \"<string>\",\n \"streetLine2\": \"<string>\",\n \"state\": \"<string>\"\n },\n \"holder\": \"<unknown>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accountType": "us",
"label": "<string>",
"holderName": "<string>",
"bankName": "<string>",
"accountNumberLast4": "<string>",
"currency": "<string>",
"country": "<string>",
"lastUsedAt": "2023-11-07T05:31:56Z"
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accountType": "us",
"label": "<string>",
"holderName": "<string>",
"bankName": "<string>",
"accountNumberLast4": "<string>",
"currency": "<string>",
"country": "<string>",
"lastUsedAt": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}API Reference
Add an external bank account
Saves a bank account the user can send to: one of their own, or the account of a person or business they pay. There is no approval step; sending to it still needs a send proposal the user approves in Tuyo. The currency follows accountType: us is USD, sepa is EUR and clabe is MXN; send proposals can’t pay MXN yet. The bank checks the account before it is saved, so a refused account is never listed. Adding an account the user already saved returns it with 200; a new one returns 201. 403 codes: verification_required, account_frozen. 422 codes: validation_error, invalid_routing_number, invalid_iban, invalid_clabe, and bank_account_rejected with the bank’s reason.
POST
/
external_bank_accounts
Add an external bank account
curl --request POST \
--url https://api.tuyo.com/public/external_bank_accounts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Tuyo-API-Version: <tuyo-api-version>' \
--data '
{
"accountType": "us",
"accountNumber": "<string>",
"routingNumber": "<string>",
"address": {
"streetLine1": "<string>",
"city": "<string>",
"postalCode": "<string>",
"country": "<string>",
"streetLine2": "<string>",
"state": "<string>"
},
"holder": "<unknown>"
}
'import requests
url = "https://api.tuyo.com/public/external_bank_accounts"
payload = {
"accountType": "us",
"accountNumber": "<string>",
"routingNumber": "<string>",
"address": {
"streetLine1": "<string>",
"city": "<string>",
"postalCode": "<string>",
"country": "<string>",
"streetLine2": "<string>",
"state": "<string>"
},
"holder": "<unknown>"
}
headers = {
"Tuyo-API-Version": "<tuyo-api-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Tuyo-API-Version': '<tuyo-api-version>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
accountType: 'us',
accountNumber: '<string>',
routingNumber: '<string>',
address: {
streetLine1: '<string>',
city: '<string>',
postalCode: '<string>',
country: '<string>',
streetLine2: '<string>',
state: '<string>'
},
holder: '<unknown>'
})
};
fetch('https://api.tuyo.com/public/external_bank_accounts', 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.tuyo.com/public/external_bank_accounts",
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([
'accountType' => 'us',
'accountNumber' => '<string>',
'routingNumber' => '<string>',
'address' => [
'streetLine1' => '<string>',
'city' => '<string>',
'postalCode' => '<string>',
'country' => '<string>',
'streetLine2' => '<string>',
'state' => '<string>'
],
'holder' => '<unknown>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Tuyo-API-Version: <tuyo-api-version>"
],
]);
$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.tuyo.com/public/external_bank_accounts"
payload := strings.NewReader("{\n \"accountType\": \"us\",\n \"accountNumber\": \"<string>\",\n \"routingNumber\": \"<string>\",\n \"address\": {\n \"streetLine1\": \"<string>\",\n \"city\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"country\": \"<string>\",\n \"streetLine2\": \"<string>\",\n \"state\": \"<string>\"\n },\n \"holder\": \"<unknown>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Tuyo-API-Version", "<tuyo-api-version>")
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.tuyo.com/public/external_bank_accounts")
.header("Tuyo-API-Version", "<tuyo-api-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"accountType\": \"us\",\n \"accountNumber\": \"<string>\",\n \"routingNumber\": \"<string>\",\n \"address\": {\n \"streetLine1\": \"<string>\",\n \"city\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"country\": \"<string>\",\n \"streetLine2\": \"<string>\",\n \"state\": \"<string>\"\n },\n \"holder\": \"<unknown>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tuyo.com/public/external_bank_accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Tuyo-API-Version"] = '<tuyo-api-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"accountType\": \"us\",\n \"accountNumber\": \"<string>\",\n \"routingNumber\": \"<string>\",\n \"address\": {\n \"streetLine1\": \"<string>\",\n \"city\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"country\": \"<string>\",\n \"streetLine2\": \"<string>\",\n \"state\": \"<string>\"\n },\n \"holder\": \"<unknown>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accountType": "us",
"label": "<string>",
"holderName": "<string>",
"bankName": "<string>",
"accountNumberLast4": "<string>",
"currency": "<string>",
"country": "<string>",
"lastUsedAt": "2023-11-07T05:31:56Z"
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accountType": "us",
"label": "<string>",
"holderName": "<string>",
"bankName": "<string>",
"accountNumberLast4": "<string>",
"currency": "<string>",
"country": "<string>",
"lastUsedAt": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"meta": {
"requestId": "<string>"
}
}Headers
Body
application/json
Response
The account the user had already saved.
Pattern:
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$