Skip to content

Create a list

client.list.create(ListCreateParams { fields, relationships } body, RequestOptionsoptions?): ListCreateResponse { id, createdAt, fields, httpLink }
POST/v1/lists

Creates a new list. The $name and $objectType fields are required.

Supports idempotency via the Idempotency-Key header.

Required scope: lists:create

Rate limit category: Write

ParametersExpand Collapse
body: ListCreateParams { fields, relationships }
fields: Fields

Field values for the new list. Required: $name (string) and $objectType.

"$name": string

Display name of the list.

"$objectType": "account" | "contact" | "opportunity"

The type of entities this list contains. One of account, contact, or opportunity.

Accepts one of the following:
"account"
"contact"
"opportunity"
relationships?: Accounts { $accounts } | Contacts { $contacts } | Opportunities { $opportunities }

Relationships to set on the new list.

Accepts one of the following:
Accounts { $accounts }
"$accounts": string | Array<string>

Account ID(s) to add as initial members. List $objectType must be account.

Accepts one of the following:
string
Array<string>
Contacts { $contacts }
"$contacts": string | Array<string>

Contact ID(s) to add as initial members. List $objectType must be contact.

Accepts one of the following:
string
Array<string>
Opportunities { $opportunities }
"$opportunities": string | Array<string>

Opportunity ID(s) to add as initial members. List $objectType must be opportunity.

Accepts one of the following:
string
Array<string>
ReturnsExpand Collapse
ListCreateResponse { id, createdAt, fields, httpLink }
id: string

Unique identifier for the list.

createdAt: string

ISO 8601 timestamp of when the list was created.

fields: Record<string, Fields>

Map of field names to their typed values. System fields are prefixed with $ (e.g. $name, $objectType).

value: string | number | boolean | 3 more | null

The field value, or null if unset.

Accepts one of the following:
string
number
boolean
Array<string>
Address { city, country, latitude, 5 more }
city?: string | null

City name.

country?: string | null

2-letter ISO 3166-1 alpha-2 country code.

latitude?: number | null

Latitude coordinate.

longitude?: number | null

Longitude coordinate.

postalCode?: string | null

Postal or ZIP code.

state?: string | null

State or province.

street?: string | null

Street address line 1.

street2?: string | null

Street address line 2.

FullName { firstName, lastName }
firstName?: string | null

The contact's first name.

lastName?: string | null

The contact's last name.

valueType: "ADDRESS" | "CHECKBOX" | "CURRENCY" | 11 more

The data type of the field.

Accepts one of the following:
"ADDRESS"
"CHECKBOX"
"CURRENCY"
"DATETIME"
"EMAIL"
"FULL_NAME"
"MARKDOWN"
"MULTI_SELECT"
"NUMBER"
"SINGLE_SELECT"
"SOCIAL_HANDLE"
"TELEPHONE"
"TEXT"
"URL"

Create a list

import Lightfield from 'lightfield';

const client = new Lightfield({
  apiKey: 'My API Key',
});

const listCreateResponse = await client.list.create({
  fields: { $name: '$name', $objectType: 'account' },
});

console.log(listCreateResponse.id);
{
  "id": "id",
  "createdAt": "createdAt",
  "fields": {
    "foo": {
      "value": "string",
      "valueType": "ADDRESS"
    }
  },
  "httpLink": "httpLink"
}
Returns Examples
{
  "id": "id",
  "createdAt": "createdAt",
  "fields": {
    "foo": {
      "value": "string",
      "valueType": "ADDRESS"
    }
  },
  "httpLink": "httpLink"
}