curl --request POST \
--url https://api.sandbox.lead.bank/v2/user_accounts/{user_account_id}/entity_relationships/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"entity_ids": [
"entity_8kL9jH7gF6dS5aQ4wE3rT2yU1iO",
"entity_2mN3bV4cX5zL6kwdJ7hG8fD9sA0",
"entity_1qW2eR3tY4uI5oP6aS7dF8gH9jK",
"entity_9pLuO8iK7yJ6hT5gR4fE3dD2sS1",
"entity_5zX4cV3bN2m1qW0eR9tY8uI7oP6"
],
"relationship_type": "authorized_user"
}
'import requests
url = "https://api.sandbox.lead.bank/v2/user_accounts/{user_account_id}/entity_relationships/batch"
payload = {
"entity_ids": ["entity_8kL9jH7gF6dS5aQ4wE3rT2yU1iO", "entity_2mN3bV4cX5zL6kwdJ7hG8fD9sA0", "entity_1qW2eR3tY4uI5oP6aS7dF8gH9jK", "entity_9pLuO8iK7yJ6hT5gR4fE3dD2sS1", "entity_5zX4cV3bN2m1qW0eR9tY8uI7oP6"],
"relationship_type": "authorized_user"
}
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({
entity_ids: [
'entity_8kL9jH7gF6dS5aQ4wE3rT2yU1iO',
'entity_2mN3bV4cX5zL6kwdJ7hG8fD9sA0',
'entity_1qW2eR3tY4uI5oP6aS7dF8gH9jK',
'entity_9pLuO8iK7yJ6hT5gR4fE3dD2sS1',
'entity_5zX4cV3bN2m1qW0eR9tY8uI7oP6'
],
relationship_type: 'authorized_user'
})
};
fetch('https://api.sandbox.lead.bank/v2/user_accounts/{user_account_id}/entity_relationships/batch', 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/user_accounts/{user_account_id}/entity_relationships/batch",
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([
'entity_ids' => [
'entity_8kL9jH7gF6dS5aQ4wE3rT2yU1iO',
'entity_2mN3bV4cX5zL6kwdJ7hG8fD9sA0',
'entity_1qW2eR3tY4uI5oP6aS7dF8gH9jK',
'entity_9pLuO8iK7yJ6hT5gR4fE3dD2sS1',
'entity_5zX4cV3bN2m1qW0eR9tY8uI7oP6'
],
'relationship_type' => 'authorized_user'
]),
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/v2/user_accounts/{user_account_id}/entity_relationships/batch"
payload := strings.NewReader("{\n \"entity_ids\": [\n \"entity_8kL9jH7gF6dS5aQ4wE3rT2yU1iO\",\n \"entity_2mN3bV4cX5zL6kwdJ7hG8fD9sA0\",\n \"entity_1qW2eR3tY4uI5oP6aS7dF8gH9jK\",\n \"entity_9pLuO8iK7yJ6hT5gR4fE3dD2sS1\",\n \"entity_5zX4cV3bN2m1qW0eR9tY8uI7oP6\"\n ],\n \"relationship_type\": \"authorized_user\"\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/v2/user_accounts/{user_account_id}/entity_relationships/batch")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entity_ids\": [\n \"entity_8kL9jH7gF6dS5aQ4wE3rT2yU1iO\",\n \"entity_2mN3bV4cX5zL6kwdJ7hG8fD9sA0\",\n \"entity_1qW2eR3tY4uI5oP6aS7dF8gH9jK\",\n \"entity_9pLuO8iK7yJ6hT5gR4fE3dD2sS1\",\n \"entity_5zX4cV3bN2m1qW0eR9tY8uI7oP6\"\n ],\n \"relationship_type\": \"authorized_user\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.lead.bank/v2/user_accounts/{user_account_id}/entity_relationships/batch")
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 \"entity_ids\": [\n \"entity_8kL9jH7gF6dS5aQ4wE3rT2yU1iO\",\n \"entity_2mN3bV4cX5zL6kwdJ7hG8fD9sA0\",\n \"entity_1qW2eR3tY4uI5oP6aS7dF8gH9jK\",\n \"entity_9pLuO8iK7yJ6hT5gR4fE3dD2sS1\",\n \"entity_5zX4cV3bN2m1qW0eR9tY8uI7oP6\"\n ],\n \"relationship_type\": \"authorized_user\"\n}"
response = http.request(request)
puts response.read_body{
"user_account_id": "user_account_9h8g7f6e5d4c3b2a1z0y9x8w7v6",
"relationship_type": "authorized_user",
"entity_ids": [
"entity_8kL9jH7gF6dS5aQ4wE3rT2yU1iO",
"entity_2mN3bV4cX5zL6kwdJ7hG8fD9sA0",
"entity_1qW2eR3tY4uI5oP6aS7dF8gH9jK",
"entity_9pLuO8iK7yJ6hT5gR4fE3dD2sS1",
"entity_5zX4cV3bN2m1qW0eR9tY8uI7oP6"
]
}{
"code": "request_malformed",
"message": "The request is invalid and cannot be parsed by the server.",
"errors": [
{
"code": "body_malformed",
"message": "The request body is missing or isn't a JSON object."
}
]
}{
"code": "token_invalid",
"message": "The bearer token is missing, expired, malformed, or invalid."
}{
"code": "object_not_found",
"message": "No object exists at the requested ID, or it is not visible to this caller."
}{
"code": "idempotency_key_in_use",
"message": "A concurrent request using this Idempotency-Key is still in flight."
}{
"code": "related_object_invalid",
"message": "An object referenced in the request doesn't exist or can't be used.",
"errors": [
{
"code": "reference_not_found",
"message": "Entity entity_8kL9jH7gF6dS5aQ4wE3rT2yU1iO does not exist.",
"parameters": [
"entity_ids[0]"
]
}
]
}{
"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."
}Batch Create User Account Entity Relationships
Add Entities to a User Account under a single relationship type.
curl --request POST \
--url https://api.sandbox.lead.bank/v2/user_accounts/{user_account_id}/entity_relationships/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"entity_ids": [
"entity_8kL9jH7gF6dS5aQ4wE3rT2yU1iO",
"entity_2mN3bV4cX5zL6kwdJ7hG8fD9sA0",
"entity_1qW2eR3tY4uI5oP6aS7dF8gH9jK",
"entity_9pLuO8iK7yJ6hT5gR4fE3dD2sS1",
"entity_5zX4cV3bN2m1qW0eR9tY8uI7oP6"
],
"relationship_type": "authorized_user"
}
'import requests
url = "https://api.sandbox.lead.bank/v2/user_accounts/{user_account_id}/entity_relationships/batch"
payload = {
"entity_ids": ["entity_8kL9jH7gF6dS5aQ4wE3rT2yU1iO", "entity_2mN3bV4cX5zL6kwdJ7hG8fD9sA0", "entity_1qW2eR3tY4uI5oP6aS7dF8gH9jK", "entity_9pLuO8iK7yJ6hT5gR4fE3dD2sS1", "entity_5zX4cV3bN2m1qW0eR9tY8uI7oP6"],
"relationship_type": "authorized_user"
}
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({
entity_ids: [
'entity_8kL9jH7gF6dS5aQ4wE3rT2yU1iO',
'entity_2mN3bV4cX5zL6kwdJ7hG8fD9sA0',
'entity_1qW2eR3tY4uI5oP6aS7dF8gH9jK',
'entity_9pLuO8iK7yJ6hT5gR4fE3dD2sS1',
'entity_5zX4cV3bN2m1qW0eR9tY8uI7oP6'
],
relationship_type: 'authorized_user'
})
};
fetch('https://api.sandbox.lead.bank/v2/user_accounts/{user_account_id}/entity_relationships/batch', 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/user_accounts/{user_account_id}/entity_relationships/batch",
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([
'entity_ids' => [
'entity_8kL9jH7gF6dS5aQ4wE3rT2yU1iO',
'entity_2mN3bV4cX5zL6kwdJ7hG8fD9sA0',
'entity_1qW2eR3tY4uI5oP6aS7dF8gH9jK',
'entity_9pLuO8iK7yJ6hT5gR4fE3dD2sS1',
'entity_5zX4cV3bN2m1qW0eR9tY8uI7oP6'
],
'relationship_type' => 'authorized_user'
]),
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/v2/user_accounts/{user_account_id}/entity_relationships/batch"
payload := strings.NewReader("{\n \"entity_ids\": [\n \"entity_8kL9jH7gF6dS5aQ4wE3rT2yU1iO\",\n \"entity_2mN3bV4cX5zL6kwdJ7hG8fD9sA0\",\n \"entity_1qW2eR3tY4uI5oP6aS7dF8gH9jK\",\n \"entity_9pLuO8iK7yJ6hT5gR4fE3dD2sS1\",\n \"entity_5zX4cV3bN2m1qW0eR9tY8uI7oP6\"\n ],\n \"relationship_type\": \"authorized_user\"\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/v2/user_accounts/{user_account_id}/entity_relationships/batch")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entity_ids\": [\n \"entity_8kL9jH7gF6dS5aQ4wE3rT2yU1iO\",\n \"entity_2mN3bV4cX5zL6kwdJ7hG8fD9sA0\",\n \"entity_1qW2eR3tY4uI5oP6aS7dF8gH9jK\",\n \"entity_9pLuO8iK7yJ6hT5gR4fE3dD2sS1\",\n \"entity_5zX4cV3bN2m1qW0eR9tY8uI7oP6\"\n ],\n \"relationship_type\": \"authorized_user\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.lead.bank/v2/user_accounts/{user_account_id}/entity_relationships/batch")
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 \"entity_ids\": [\n \"entity_8kL9jH7gF6dS5aQ4wE3rT2yU1iO\",\n \"entity_2mN3bV4cX5zL6kwdJ7hG8fD9sA0\",\n \"entity_1qW2eR3tY4uI5oP6aS7dF8gH9jK\",\n \"entity_9pLuO8iK7yJ6hT5gR4fE3dD2sS1\",\n \"entity_5zX4cV3bN2m1qW0eR9tY8uI7oP6\"\n ],\n \"relationship_type\": \"authorized_user\"\n}"
response = http.request(request)
puts response.read_body{
"user_account_id": "user_account_9h8g7f6e5d4c3b2a1z0y9x8w7v6",
"relationship_type": "authorized_user",
"entity_ids": [
"entity_8kL9jH7gF6dS5aQ4wE3rT2yU1iO",
"entity_2mN3bV4cX5zL6kwdJ7hG8fD9sA0",
"entity_1qW2eR3tY4uI5oP6aS7dF8gH9jK",
"entity_9pLuO8iK7yJ6hT5gR4fE3dD2sS1",
"entity_5zX4cV3bN2m1qW0eR9tY8uI7oP6"
]
}{
"code": "request_malformed",
"message": "The request is invalid and cannot be parsed by the server.",
"errors": [
{
"code": "body_malformed",
"message": "The request body is missing or isn't a JSON object."
}
]
}{
"code": "token_invalid",
"message": "The bearer token is missing, expired, malformed, or invalid."
}{
"code": "object_not_found",
"message": "No object exists at the requested ID, or it is not visible to this caller."
}{
"code": "idempotency_key_in_use",
"message": "A concurrent request using this Idempotency-Key is still in flight."
}{
"code": "related_object_invalid",
"message": "An object referenced in the request doesn't exist or can't be used.",
"errors": [
{
"code": "reference_not_found",
"message": "Entity entity_8kL9jH7gF6dS5aQ4wE3rT2yU1iO does not exist.",
"parameters": [
"entity_ids[0]"
]
}
]
}{
"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
A unique key for this request, up to 255 characters. Retrying with the same key and body returns the original response without creating the relationships twice. See Idempotency.
255Path Parameters
User Account ID The ID of the User Account object.
^user_account_\w+$"user_account_xyz123"
Body
Request body for batch creating entity relationships on an account.
List of entity IDs to associate with the account under the specified relationship type.
20The ID of your entity.
^entity_[^\s]{1,33}$Indicates the type of Entity
account_holder, authorized_signer, authorized_user "account_holder"
Response
Entity relationships created successfully.
The ID of the User Account object.
^user_account_\w+$"user_account_xyz123"
Indicates the type of Entity
account_holder, authorized_signer, authorized_user "account_holder"
List of entity IDs associated with the user account under the specified relationship type.
The ID of your entity.
^entity_[^\s]{1,33}$Was this page helpful?

