Adding Profiles to a List
This endpoint lets you add multiple profiles to an existing list or create a new list if one is not specified.
- If a
listIdis provided → profiles are added to that existing list. - If no
listIdis provided → a new list is created using the suppliednameanddescription.
Endpoint
POST /list/addProfiles
Headers
| Header | Value | Required |
|---|---|---|
Authroization | Bearer <your-api-key> | ✅ Yes |
Content-Type | application/json | ✅ Yes |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
profiles | Array | ✅ Yes | An array of profile objects. Each must include at least email. Optional fields: firstName, lastName. |
name | String | ✅ Required if no listId | The name for the new list. |
description | String | ❌ Optional (if listId absent) | A description for the new list. |
listId | String | ❌ Optional | If provided, profiles will be added to this list. |
Examples
Request
- JavaScript
- Python
- C#
- PHP
- cURL
const response = await fetch("https://api.basicsengage.com/api/v0/dev/list/addProfiles", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authroization": "Bearer <your-api-key>"
},
body: JSON.stringify({
listId: "64b22f999...",
profiles: [
{ email: "alice@example.com", firstName: "Alice", lastName: "Doe" },
{ email: "bob@example.com", firstName: "Bob", lastName: "Smith" }
]
})
});
const data = await response.json();
console.log(data);
import requests
import json
url = "https://api.basicsengage.com/api/v0/dev/list/addProfiles"
headers = {
"Content-Type": "application/json",
"Authroization": "Bearer <your-api-key>"
}
data = {
"listId": "64b22f999",
"profiles": [
{ "email": "alice@example.com", "firstName": "Alice", "lastName": "Doe" },
{ "email": "bob@example.com", "firstName": "Bob", "lastName": "Smith" }
]
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var url = "https://api.basicsengage.com/api/v0/dev/list/addProfiles";
var apiKey = "Bearer <your-api-key>";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authroization", apiKey);
var json = @"{
""listId"": ""64b22f999"",
""profiles"": [
{ ""email"": ""alice@example.com"", ""firstName"": ""Alice"", ""lastName"": ""Doe"" },
{ ""email"": ""bob@example.com"", ""firstName"": ""Bob"", ""lastName"": ""Smith"" }
]
}";
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(url, content);
var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseString);
}
}
}
<?php
$url = "https://api.basicsengage.com/api/v0/dev/list/addProfiles";
$headers = [
"Content-Type: application/json",
"Authroization: Bearer <your-api-key>"
];
$data = [
"listId" => "64b22f999",
"profiles" => [
[
"email" => "alice@example.com",
"firstName" => "Alice",
"lastName" => "Doe"
],
[
"email" => "bob@example.com",
"firstName" => "Bob",
"lastName" => "Smith"
]
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
curl -X POST "https://api.basicsengage.com/api/v0/dev/list/addProfiles" \
-H "Content-Type: application/json" \
-H "Authroization: Bearer <your-api-key>" \
-d '{
"listId": "64b22f999",
"profiles": [
{ "email": "alice@example.com", "firstName": "Alice", "lastName": "Doe" },
{ "email": "bob@example.com", "firstName": "Bob", "lastName": "Smith" }
]
}'
Responses
- 🟢 200
- 🔴 400
- 🔴 401
- 🔴 500
{
"status": "success",
"data": {
"listId": "64b22f999...",
"addedCount": 2
}
}
{
"status": "error",
"error": "Profiles array is required."
}
{
"status": "error",
"message": "Invalid API Key"
}
{
"status": "error",
"message": "Internal server error. Please try again later."
}