Account
Update Account
Updates an existing account’s properties.
Modify account details such as name, description, classification, or metadata. Note that some properties like account status and purpose cannot be changed through this endpoint. Changing classification from SECONDARY to PRIMARY will fail if a PRIMARY account already exists.
PATCH
/
v1
/
accounts
/
{account_id}
Update Account
curl --request PATCH \
--url https://api.example.com/v1/accounts/{account_id} \
--header 'Content-Type: application/json' \
--data '
{
"name": "Updated Business Account",
"description": "Updated description for business account",
"metadata": {
"department": "operations",
"costCenter": "EMEA"
}
}
'import requests
url = "https://api.example.com/v1/accounts/{account_id}"
payload = {
"name": "Updated Business Account",
"description": "Updated description for business account",
"metadata": {
"department": "operations",
"costCenter": "EMEA"
}
}
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Updated Business Account',
description: 'Updated description for business account',
metadata: {department: 'operations', costCenter: 'EMEA'}
})
};
fetch('https://api.example.com/v1/accounts/{account_id}', 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.example.com/v1/accounts/{account_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Updated Business Account',
'description' => 'Updated description for business account',
'metadata' => [
'department' => 'operations',
'costCenter' => 'EMEA'
]
]),
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.example.com/v1/accounts/{account_id}"
payload := strings.NewReader("{\n \"name\": \"Updated Business Account\",\n \"description\": \"Updated description for business account\",\n \"metadata\": {\n \"department\": \"operations\",\n \"costCenter\": \"EMEA\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.example.com/v1/accounts/{account_id}")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Updated Business Account\",\n \"description\": \"Updated description for business account\",\n \"metadata\": {\n \"department\": \"operations\",\n \"costCenter\": \"EMEA\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/accounts/{account_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Updated Business Account\",\n \"description\": \"Updated description for business account\",\n \"metadata\": {\n \"department\": \"operations\",\n \"costCenter\": \"EMEA\"\n }\n}"
response = http.request(request)
puts response.read_body{
"accountId": "acc_12345",
"name": "Primary Business Account",
"description": "Main account for business operations",
"purpose": "OPERATING",
"classification": "PRIMARY",
"status": "ACTIVE",
"metadata": {
"department": "finance",
"costCenter": "HQ"
},
"updatedAt": "2025-04-29T13:29:15.064Z",
"createdAt": "2025-04-29T13:29:15.064Z"
}{
"type": "https://docs.bluerails.com/api/errors/validation-error",
"title": "Validation Failed",
"status": 400,
"detail": "The request body is invalid. Please check the 'errors' field for more details.",
"instance": "/v1/accounts",
"code": "VALIDATION_ERROR",
"traceId": "trace_c0177bce4d1547b3ad750eb54bbb9f4d",
"errors": [
{
"field": "classification",
"message": "Classification is required and must be either 'PRIMARY' or 'SECONDARY'.",
"code": "MISSING_OR_INVALID_FIELD",
"value": null
},
{
"field": "type",
"message": "Account type cannot be empty and must be a recognized type.",
"value": ""
}
]
}{
"type": "https://docs.bluerails.com/api/errors/organization-not-found",
"title": "Organization Not Found",
"status": 404,
"detail": "The specified organization could not be found or you do not have access.",
"instance": "/v1/accounts",
"code": "ORGANIZATION_NOT_FOUND",
"traceId": "trace_c0177bce4d1547b3ad750eb54bbb9f4d"
}{
"type": "https://docs.bluerails.com/api/errors/primary-account-exists",
"title": "Primary Account Exists",
"status": 409,
"detail": "A primary account already exists for this organization. Cannot create another one.",
"instance": "/v1/accounts",
"code": "PRIMARY_ACCOUNT_EXISTS",
"traceId": "trace_c0177bce4d1547b3ad750eb54bbb9f4d"
}{
"type": "https://docs.bluerails.com/api/errors/internal-server-error",
"title": "Internal Server Error",
"status": 500,
"detail": "An unexpected error occurred while processing your request.",
"instance": "/v1/accounts",
"code": "INTERNAL_SERVER_ERROR",
"traceId": "trace_c0177bce4d1547b3ad750eb54bbb9f4d"
}Path Parameters
Body
application/json
Input properties for updating an existing account
Response
The request has succeeded.
Represents a financial account in the system Accounts are used to track balances and process transactions
⌘I
Update Account
curl --request PATCH \
--url https://api.example.com/v1/accounts/{account_id} \
--header 'Content-Type: application/json' \
--data '
{
"name": "Updated Business Account",
"description": "Updated description for business account",
"metadata": {
"department": "operations",
"costCenter": "EMEA"
}
}
'import requests
url = "https://api.example.com/v1/accounts/{account_id}"
payload = {
"name": "Updated Business Account",
"description": "Updated description for business account",
"metadata": {
"department": "operations",
"costCenter": "EMEA"
}
}
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Updated Business Account',
description: 'Updated description for business account',
metadata: {department: 'operations', costCenter: 'EMEA'}
})
};
fetch('https://api.example.com/v1/accounts/{account_id}', 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.example.com/v1/accounts/{account_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Updated Business Account',
'description' => 'Updated description for business account',
'metadata' => [
'department' => 'operations',
'costCenter' => 'EMEA'
]
]),
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.example.com/v1/accounts/{account_id}"
payload := strings.NewReader("{\n \"name\": \"Updated Business Account\",\n \"description\": \"Updated description for business account\",\n \"metadata\": {\n \"department\": \"operations\",\n \"costCenter\": \"EMEA\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.example.com/v1/accounts/{account_id}")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Updated Business Account\",\n \"description\": \"Updated description for business account\",\n \"metadata\": {\n \"department\": \"operations\",\n \"costCenter\": \"EMEA\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/accounts/{account_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Updated Business Account\",\n \"description\": \"Updated description for business account\",\n \"metadata\": {\n \"department\": \"operations\",\n \"costCenter\": \"EMEA\"\n }\n}"
response = http.request(request)
puts response.read_body{
"accountId": "acc_12345",
"name": "Primary Business Account",
"description": "Main account for business operations",
"purpose": "OPERATING",
"classification": "PRIMARY",
"status": "ACTIVE",
"metadata": {
"department": "finance",
"costCenter": "HQ"
},
"updatedAt": "2025-04-29T13:29:15.064Z",
"createdAt": "2025-04-29T13:29:15.064Z"
}{
"type": "https://docs.bluerails.com/api/errors/validation-error",
"title": "Validation Failed",
"status": 400,
"detail": "The request body is invalid. Please check the 'errors' field for more details.",
"instance": "/v1/accounts",
"code": "VALIDATION_ERROR",
"traceId": "trace_c0177bce4d1547b3ad750eb54bbb9f4d",
"errors": [
{
"field": "classification",
"message": "Classification is required and must be either 'PRIMARY' or 'SECONDARY'.",
"code": "MISSING_OR_INVALID_FIELD",
"value": null
},
{
"field": "type",
"message": "Account type cannot be empty and must be a recognized type.",
"value": ""
}
]
}{
"type": "https://docs.bluerails.com/api/errors/organization-not-found",
"title": "Organization Not Found",
"status": 404,
"detail": "The specified organization could not be found or you do not have access.",
"instance": "/v1/accounts",
"code": "ORGANIZATION_NOT_FOUND",
"traceId": "trace_c0177bce4d1547b3ad750eb54bbb9f4d"
}{
"type": "https://docs.bluerails.com/api/errors/primary-account-exists",
"title": "Primary Account Exists",
"status": 409,
"detail": "A primary account already exists for this organization. Cannot create another one.",
"instance": "/v1/accounts",
"code": "PRIMARY_ACCOUNT_EXISTS",
"traceId": "trace_c0177bce4d1547b3ad750eb54bbb9f4d"
}{
"type": "https://docs.bluerails.com/api/errors/internal-server-error",
"title": "Internal Server Error",
"status": 500,
"detail": "An unexpected error occurred while processing your request.",
"instance": "/v1/accounts",
"code": "INTERNAL_SERVER_ERROR",
"traceId": "trace_c0177bce4d1547b3ad750eb54bbb9f4d"
}