## 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](/using-the-api/scopes/):** `lists:create` **[Rate limit category](/using-the-api/rate-limits/):** Write ### Parameters - `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`. - `const ListNewParamsFieldsObjectTypeAccount ListNewParamsFieldsObjectType = "account"` - `const ListNewParamsFieldsObjectTypeContact ListNewParamsFieldsObjectType = "contact"` - `const ListNewParamsFieldsObjectTypeOpportunity ListNewParamsFieldsObjectType = "opportunity"` - `Relationships param.Field[ListNewParamsRelationshipsUnion]` 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`. - `string` - `type ListNewParamsRelationshipsAccountsAccountsArray []string` - `type ListNewParamsRelationshipsContacts struct{…}` - `Contacts ListNewParamsRelationshipsContactsContactsUnion` Contact ID(s) to add as initial members. List `$objectType` must be `contact`. - `string` - `type ListNewParamsRelationshipsContactsContactsArray []string` - `type ListNewParamsRelationshipsOpportunities struct{…}` - `Opportunities ListNewParamsRelationshipsOpportunitiesOpportunitiesUnion` Opportunity ID(s) to add as initial members. List `$objectType` must be `opportunity`. - `string` - `type ListNewParamsRelationshipsOpportunitiesOpportunitiesArray []string` ### Returns - `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. - `string` - `float64` - `bool` - `type ListCreateResponseFieldValueArray []string` - `type ListCreateResponseFieldValueAddress struct{…}` - `City string` City name. - `Country string` 2-letter ISO 3166-1 alpha-2 country code. - `Latitude float64` Latitude coordinate. - `Longitude float64` Longitude coordinate. - `PostalCode string` Postal or ZIP code. - `State string` State or province. - `Street string` Street address line 1. - `Street2 string` Street address line 2. - `type ListCreateResponseFieldValueFullName struct{…}` - `FirstName string` The contact's first name. - `LastName string` The contact's last name. - `ValueType string` The data type of the field. - `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"` - `HTTPLink string` URL to view the list in the Lightfield web app, or null. ### Example ```go 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) } ``` #### Response ```json { "id": "id", "createdAt": "createdAt", "fields": { "foo": { "value": "string", "valueType": "ADDRESS" } }, "httpLink": "httpLink" } ```