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. One of account, contact, or opportunity.

One of the following:
const ListNewParamsFieldsObjectTypeAccount ListNewParamsFieldsObjectType = "account"
const ListNewParamsFieldsObjectTypeContact ListNewParamsFieldsObjectType = "contact"
const ListNewParamsFieldsObjectTypeOpportunity ListNewParamsFieldsObjectType = "opportunity"
Relationships param.Field[ListNewParamsRelationshipsUnion]Optional

Relationships to set on the new list.

type ListNewParamsRelationshipsAccounts struct{…}
Accounts ListNewParamsRelationshipsAccountsAccountsUnion

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

One of the following:
string
type ListNewParamsRelationshipsAccountsAccountsArray []string
type ListNewParamsRelationshipsContacts struct{…}
Contacts ListNewParamsRelationshipsContactsContactsUnion

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

One of the following:
string
type ListNewParamsRelationshipsContactsContactsArray []string
type ListNewParamsRelationshipsOpportunities struct{…}
Opportunities ListNewParamsRelationshipsOpportunitiesOpportunitiesUnion

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

One of the following:
string
type ListNewParamsRelationshipsOpportunitiesOpportunitiesArray []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"

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: "account",
    },
  })
  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"
}