curl --request POST \
--url https://api.baselayer.com/portfolio/items/bulk \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"business_search_ids": [
"ede786f3-33ae-4894-843d-af2025f1d5b0",
"e1d5e9e1-6de2-46c0-8492-564998a7426a"
],
"group_id": "ede786f3-33ae-4894-843d-af2025f1d5b0"
}
'import requests
url = "https://api.baselayer.com/portfolio/items/bulk"
payload = {
"business_search_ids": ["ede786f3-33ae-4894-843d-af2025f1d5b0", "e1d5e9e1-6de2-46c0-8492-564998a7426a"],
"group_id": "ede786f3-33ae-4894-843d-af2025f1d5b0"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
business_search_ids: ['ede786f3-33ae-4894-843d-af2025f1d5b0', 'e1d5e9e1-6de2-46c0-8492-564998a7426a'],
group_id: 'ede786f3-33ae-4894-843d-af2025f1d5b0'
})
};
fetch('https://api.baselayer.com/portfolio/items/bulk', 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.baselayer.com/portfolio/items/bulk",
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([
'business_search_ids' => [
'ede786f3-33ae-4894-843d-af2025f1d5b0',
'e1d5e9e1-6de2-46c0-8492-564998a7426a'
],
'group_id' => 'ede786f3-33ae-4894-843d-af2025f1d5b0'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-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.baselayer.com/portfolio/items/bulk"
payload := strings.NewReader("{\n \"business_search_ids\": [\n \"ede786f3-33ae-4894-843d-af2025f1d5b0\",\n \"e1d5e9e1-6de2-46c0-8492-564998a7426a\"\n ],\n \"group_id\": \"ede786f3-33ae-4894-843d-af2025f1d5b0\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.baselayer.com/portfolio/items/bulk")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"business_search_ids\": [\n \"ede786f3-33ae-4894-843d-af2025f1d5b0\",\n \"e1d5e9e1-6de2-46c0-8492-564998a7426a\"\n ],\n \"group_id\": \"ede786f3-33ae-4894-843d-af2025f1d5b0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baselayer.com/portfolio/items/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"business_search_ids\": [\n \"ede786f3-33ae-4894-843d-af2025f1d5b0\",\n \"e1d5e9e1-6de2-46c0-8492-564998a7426a\"\n ],\n \"group_id\": \"ede786f3-33ae-4894-843d-af2025f1d5b0\"\n}"
response = http.request(request)
puts response.read_body{
"items": [
{
"business_search_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"portfolio_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"errors": [
{
"business_search_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "not_found",
"existing_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Create Portfolio Items Bulk
Create Business portfolio items for many completed searches.
Request-level authorization and group lookup failures still fail the
full request. Per-search failures are returned in errors so the
caller can add every eligible row from a checkbox selection without
retrying successful rows.
Bulk success and error rows are intentionally lightweight. The frontend only needs IDs and stable error codes for row correlation, cache refreshes, and summary toasts, so the endpoint avoids full PortfolioItem serialization and verbose per-row errors.
curl --request POST \
--url https://api.baselayer.com/portfolio/items/bulk \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"business_search_ids": [
"ede786f3-33ae-4894-843d-af2025f1d5b0",
"e1d5e9e1-6de2-46c0-8492-564998a7426a"
],
"group_id": "ede786f3-33ae-4894-843d-af2025f1d5b0"
}
'import requests
url = "https://api.baselayer.com/portfolio/items/bulk"
payload = {
"business_search_ids": ["ede786f3-33ae-4894-843d-af2025f1d5b0", "e1d5e9e1-6de2-46c0-8492-564998a7426a"],
"group_id": "ede786f3-33ae-4894-843d-af2025f1d5b0"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
business_search_ids: ['ede786f3-33ae-4894-843d-af2025f1d5b0', 'e1d5e9e1-6de2-46c0-8492-564998a7426a'],
group_id: 'ede786f3-33ae-4894-843d-af2025f1d5b0'
})
};
fetch('https://api.baselayer.com/portfolio/items/bulk', 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.baselayer.com/portfolio/items/bulk",
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([
'business_search_ids' => [
'ede786f3-33ae-4894-843d-af2025f1d5b0',
'e1d5e9e1-6de2-46c0-8492-564998a7426a'
],
'group_id' => 'ede786f3-33ae-4894-843d-af2025f1d5b0'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-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.baselayer.com/portfolio/items/bulk"
payload := strings.NewReader("{\n \"business_search_ids\": [\n \"ede786f3-33ae-4894-843d-af2025f1d5b0\",\n \"e1d5e9e1-6de2-46c0-8492-564998a7426a\"\n ],\n \"group_id\": \"ede786f3-33ae-4894-843d-af2025f1d5b0\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.baselayer.com/portfolio/items/bulk")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"business_search_ids\": [\n \"ede786f3-33ae-4894-843d-af2025f1d5b0\",\n \"e1d5e9e1-6de2-46c0-8492-564998a7426a\"\n ],\n \"group_id\": \"ede786f3-33ae-4894-843d-af2025f1d5b0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baselayer.com/portfolio/items/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"business_search_ids\": [\n \"ede786f3-33ae-4894-843d-af2025f1d5b0\",\n \"e1d5e9e1-6de2-46c0-8492-564998a7426a\"\n ],\n \"group_id\": \"ede786f3-33ae-4894-843d-af2025f1d5b0\"\n}"
response = http.request(request)
puts response.read_body{
"items": [
{
"business_search_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"portfolio_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"errors": [
{
"business_search_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "not_found",
"existing_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Body
Request body for adding multiple BusinessSearches to monitoring.
The UUIDs of the business searches to add to portfolio monitoring.
1 - 250 elements[
"ede786f3-33ae-4894-843d-af2025f1d5b0",
"e1d5e9e1-6de2-46c0-8492-564998a7426a"
]
The optional UUID of the group to add the newly created items to.
"ede786f3-33ae-4894-843d-af2025f1d5b0"
Response
Successful Response