Set Primary Bank Account
curl --request PUT \
--url https://api.stablepay.global/v2/users/{userId}/bank-accounts/{bankAccountId}/primary \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.stablepay.global/v2/users/{userId}/bank-accounts/{bankAccountId}/primary"
headers = {"Authorization": "Bearer <token>"}
response = requests.put(url, headers=headers)
print(response.text)const options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.stablepay.global/v2/users/{userId}/bank-accounts/{bankAccountId}/primary', 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.stablepay.global/v2/users/{userId}/bank-accounts/{bankAccountId}/primary",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.stablepay.global/v2/users/{userId}/bank-accounts/{bankAccountId}/primary"
req, _ := http.NewRequest("PUT", url, nil)
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.put("https://api.stablepay.global/v2/users/{userId}/bank-accounts/{bankAccountId}/primary")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.stablepay.global/v2/users/{userId}/bank-accounts/{bankAccountId}/primary")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyUsers
Set Primary Bank Account
Choose the default account a user’s payouts are sent to
PUT
/
v2
/
users
/
{userId}
/
bank-accounts
/
{bankAccountId}
/
primary
Set Primary Bank Account
curl --request PUT \
--url https://api.stablepay.global/v2/users/{userId}/bank-accounts/{bankAccountId}/primary \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.stablepay.global/v2/users/{userId}/bank-accounts/{bankAccountId}/primary"
headers = {"Authorization": "Bearer <token>"}
response = requests.put(url, headers=headers)
print(response.text)const options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.stablepay.global/v2/users/{userId}/bank-accounts/{bankAccountId}/primary', 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.stablepay.global/v2/users/{userId}/bank-accounts/{bankAccountId}/primary",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.stablepay.global/v2/users/{userId}/bank-accounts/{bankAccountId}/primary"
req, _ := http.NewRequest("PUT", url, nil)
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.put("https://api.stablepay.global/v2/users/{userId}/bank-accounts/{bankAccountId}/primary")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.stablepay.global/v2/users/{userId}/bank-accounts/{bankAccountId}/primary")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodySet Primary Bank Account
Makes this account the user’s default payout destination and clears the flag on their other accounts. No request body. The first verified account is primary automatically. Verifying more accounts later does not change it.string
required
The user ID
string
required
The account to make primary, from List Bank Accounts. Must be verified.
To send a single payout to a non-primary account, pass
bankAccountId on Create Transaction instead. Switching the primary before each payout is racy when two payouts for the same user are in flight.Request
curl -X PUT https://api.stablepay.global/v2/users/usr_abc123/bank-accounts/8b1d07e2-3c4f-4a90-b6d1-2e7f9a0c5b18/primary \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"success": true,
"data": {
"bankAccountId": "8b1d07e2-3c4f-4a90-b6d1-2e7f9a0c5b18",
"instrumentId": "8b1d07e2-3c4f-4a90-b6d1-2e7f9a0c5b18",
"externalId": "pi_90457",
"isPrimary": true,
"maskedAccountNumber": "XXXXXX4412",
"ifsc": "ICIC0000123",
"bankName": "ICICI Bank"
}
}
{
"success": true,
"data": { "bankAccountId": "8b1d07e2-3c4f-4a90-b6d1-2e7f9a0c5b18", "isPrimary": true, "unchanged": true }
}
Errors
| Status | code / error | Description |
|---|---|---|
| 400 | BANK_NOT_VERIFIED | Only a verified account can be made primary |
| 404 | Not Found | User not found, or the account doesn’t belong to this user |
| 500 | Internal Server Error | Unexpected failure |
