curl --request POST \
--url https://api.affinity.co/v2/lists \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "2026 Prospects",
"type": "company",
"isPublic": false
}
'import requests
url = "https://api.affinity.co/v2/lists"
payload = {
"name": "2026 Prospects",
"type": "company",
"isPublic": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '2026 Prospects', type: 'company', isPublic: false})
};
fetch('https://api.affinity.co/v2/lists', 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.affinity.co/v2/lists",
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([
'name' => '2026 Prospects',
'type' => 'company',
'isPublic' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.affinity.co/v2/lists"
payload := strings.NewReader("{\n \"name\": \"2026 Prospects\",\n \"type\": \"company\",\n \"isPublic\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
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.affinity.co/v2/lists")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"2026 Prospects\",\n \"type\": \"company\",\n \"isPublic\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/lists")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"2026 Prospects\",\n \"type\": \"company\",\n \"isPublic\": false\n}"
response = http.request(request)
puts response.read_body{
"id": 42,
"name": "2026 Prospects",
"type": "company",
"isPublic": false,
"ownerId": 1,
"creatorId": 1,
"createdAt": "2024-03-07T20:21:42Z"
}{
"errors": [
{
"code": "bad-request",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authorization",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authentication",
"message": "<string>"
}
]
}Create a List
Create a new List.
The List type determines the kind of entities (Companies, Persons, or Opportunities) that can be added. The requester is recorded as the creator and the owner.
curl --request POST \
--url https://api.affinity.co/v2/lists \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "2026 Prospects",
"type": "company",
"isPublic": false
}
'import requests
url = "https://api.affinity.co/v2/lists"
payload = {
"name": "2026 Prospects",
"type": "company",
"isPublic": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '2026 Prospects', type: 'company', isPublic: false})
};
fetch('https://api.affinity.co/v2/lists', 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.affinity.co/v2/lists",
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([
'name' => '2026 Prospects',
'type' => 'company',
'isPublic' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.affinity.co/v2/lists"
payload := strings.NewReader("{\n \"name\": \"2026 Prospects\",\n \"type\": \"company\",\n \"isPublic\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
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.affinity.co/v2/lists")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"2026 Prospects\",\n \"type\": \"company\",\n \"isPublic\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/lists")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"2026 Prospects\",\n \"type\": \"company\",\n \"isPublic\": false\n}"
response = http.request(request)
puts response.read_body{
"id": 42,
"name": "2026 Prospects",
"type": "company",
"isPublic": false,
"ownerId": 1,
"creatorId": 1,
"createdAt": "2024-03-07T20:21:42Z"
}{
"errors": [
{
"code": "bad-request",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authorization",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authentication",
"message": "<string>"
}
]
}Authorizations
A static Affinity API key, presented as a bearer token.
Body
Request body for creating a new List
The name of the List
1 - 255"My Companies"
The entity type for the List
company, opportunity, person "company"
Whether the List is public. Public Lists are visible to all users in the organization. Creating a public List requires the "Share accessible Lists globally" permission.
false
Response
Created
ListWithType model
The unique identifier for the list
1 <= x <= 90071992547409911
The name of the list
"All companies"
The ID of the user that created this list
1 <= x <= 90071992547409911
The ID of the user that owns this list
1 <= x <= 90071992547409911
Whether or not the list is public
false
The entity type for this list
company, opportunity, person "company"
The date and time the list was created
"2024-03-07T20:21:42Z"
Was this page helpful?