Batch create user account entity relationships
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"
]
}User Accounts
Batch Create User Account Entity Relationships
Add Entities to a User Account under a single relationship type.
POST
/
v2
/
user_accounts
/
{user_account_id}
/
entity_relationships
/
batch
Batch create user account entity relationships
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"
]
}See Errors for the common errors every v2 endpoint can return.
Authorizations
Headers
A unique key for this request, up to 255 characters. Retrying with the same key and request returns the original response instead of performing the operation again. See Idempotency. A unique key for this request, up to 255 characters. Retrying with the same key and body returns the original response instead of performing the operation again.
Required string length:
1 - 255Example:
"3f1c9a52-7d4e-4b8a-9c21-6e0f5d2a8b14"
Path Parameters
Body
application/json
Request body for adding entities to a user account under one relationship type.
Response
Entity relationships created successfully.
Was this page helpful?

