Skip to content

Create a list

client.List.New(ctx, body) (*ListCreateResponse, error)
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 ListNewParams
Fields param.Field[ListNewParamsFields]

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

Name string

Display name of the list.

ObjectType string

The type of entities this list contains. Use $account, $contact, or $opportunity (the $ prefix identifies system types). Bare slugs without the prefix (e.g. account) are accepted for backward compatibility but are deprecated.

Description stringOptional

Optional description of what this list is for.

Kind stringOptional

Product-level list purpose. Normally omit to create a regular list; reserve target for the single account-prioritization (APG) demand list per org, and only for account/contact lists.

Relationships param.Field[ListNewParamsRelationships]Optional

Relationships to set on the new list.

Accounts ListNewParamsRelationshipsAccountsUnionOptional

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

One of the following:
string
type ListNewParamsRelationshipsAccountsArray []string
Contacts ListNewParamsRelationshipsContactsUnionOptional

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

One of the following:
string
type ListNewParamsRelationshipsContactsArray []string
Opportunities ListNewParamsRelationshipsOpportunitiesUnionOptional

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

One of the following:
string
type ListNewParamsRelationshipsOpportunitiesArray []string
ReturnsExpand Collapse
type ListCreateResponse struct{…}
ID string

Unique identifier for the list.

CreatedAt string

ISO 8601 timestamp of when the list was created.

Fields map[string, ListCreateResponseField]

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

Value ListCreateResponseFieldValueUnion

The field value, or null if unset.

One of the following:
string
float64
bool
type ListCreateResponseFieldValueArray []string
type ListCreateResponseFieldValueAddress struct{…}
City stringOptional

City name.

Country stringOptional

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

Latitude float64Optional

Latitude coordinate.

Longitude float64Optional

Longitude coordinate.

PostalCode stringOptional

Postal or ZIP code.

State stringOptional

State or province.

Street stringOptional

Street address line 1.

Street2 stringOptional

Street address line 2.

type ListCreateResponseFieldValueFullName struct{…}
FirstName stringOptional

The contact’s first name.

LastName stringOptional

The contact’s last name.

ValueType string

The data type of the field.

One of the following:
const ListCreateResponseFieldValueTypeAddress ListCreateResponseFieldValueType = "ADDRESS"
const ListCreateResponseFieldValueTypeCheckbox ListCreateResponseFieldValueType = "CHECKBOX"
const ListCreateResponseFieldValueTypeCurrency ListCreateResponseFieldValueType = "CURRENCY"
const ListCreateResponseFieldValueTypeDatetime ListCreateResponseFieldValueType = "DATETIME"
const ListCreateResponseFieldValueTypeEmail ListCreateResponseFieldValueType = "EMAIL"
const ListCreateResponseFieldValueTypeFullName ListCreateResponseFieldValueType = "FULL_NAME"
const ListCreateResponseFieldValueTypeMarkdown ListCreateResponseFieldValueType = "MARKDOWN"
const ListCreateResponseFieldValueTypeMultiSelect ListCreateResponseFieldValueType = "MULTI_SELECT"
const ListCreateResponseFieldValueTypeNumber ListCreateResponseFieldValueType = "NUMBER"
const ListCreateResponseFieldValueTypeSingleSelect ListCreateResponseFieldValueType = "SINGLE_SELECT"
const ListCreateResponseFieldValueTypeSocialHandle ListCreateResponseFieldValueType = "SOCIAL_HANDLE"
const ListCreateResponseFieldValueTypeTelephone ListCreateResponseFieldValueType = "TELEPHONE"
const ListCreateResponseFieldValueTypeText ListCreateResponseFieldValueType = "TEXT"
const ListCreateResponseFieldValueTypeURL ListCreateResponseFieldValueType = "URL"
const ListCreateResponseFieldValueTypeHTML ListCreateResponseFieldValueType = "HTML"

Create a list

package main

import (
  "context"
  "fmt"

  "github.com/Lightfld/lightfield-go"
  "github.com/Lightfld/lightfield-go/option"
)

func main() {
  client := githubcomlightfldlightfieldgo.NewClient(
    option.WithAPIKey("My API Key"),
  )
  listCreateResponse, err := client.List.New(context.TODO(), githubcomlightfldlightfieldgo.ListNewParams{
    Fields: githubcomlightfldlightfieldgo.ListNewParamsFields{
      Name: "$name",
      ObjectType: "$objectType",
    },
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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"
}