Skip to main content
POST
/
v2
/
lists
Create a List
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

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Request body for creating a new List

name
string
required

The name of the List

Required string length: 1 - 255
Example:

"My Companies"

type
enum<string>
required

The entity type for the List

Available options:
company,
opportunity,
person
Example:

"company"

isPublic
boolean
default:false

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.

Example:

false

Response

Created

ListWithType model

id
integer<int64>
required

The unique identifier for the list

Required range: 1 <= x <= 9007199254740991
Example:

1

name
string
required

The name of the list

Example:

"All companies"

creatorId
integer<int64>
required

The ID of the user that created this list

Required range: 1 <= x <= 9007199254740991
Example:

1

ownerId
integer<int64>
required

The ID of the user that owns this list

Required range: 1 <= x <= 9007199254740991
Example:

1

isPublic
boolean
required

Whether or not the list is public

Example:

false

type
enum<string>
required

The entity type for this list

Available options:
company,
opportunity,
person
Example:

"company"

createdAt
string<date-time>
required

The date and time the list was created

Example:

"2024-03-07T20:21:42Z"