Creates a new contact record.
After creation, Lightfield automatically enriches the contact in the background.
Supports idempotency via the Idempotency-Key header.
To avoid duplicates, we recommend a find-or-create pattern — use list filtering to check if a record exists before creating.
Required scope: contacts:create
Rate limit category: Write
Create a contact
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"),
)
contactCreateResponse, err := client.Contact.New(context.TODO(), githubcomlightfldlightfieldgo.ContactNewParams{
Fields: map[string]githubcomlightfldlightfieldgo.ContactNewParamsFieldUnion{
"foo": githubcomlightfldlightfieldgo.ContactNewParamsFieldUnion{
OfString: githubcomlightfldlightfieldgo.String("string"),
},
},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", contactCreateResponse.ID)
}
{
"id": "id",
"createdAt": "createdAt",
"fields": {
"foo": {
"value": "string",
"valueType": "ADDRESS"
}
},
"httpLink": "httpLink",
"relationships": {
"foo": {
"cardinality": "cardinality",
"objectType": "objectType",
"values": [
"string"
]
}
},
"updatedAt": "updatedAt",
"externalId": "externalId"
}Returns Examples
{
"id": "id",
"createdAt": "createdAt",
"fields": {
"foo": {
"value": "string",
"valueType": "ADDRESS"
}
},
"httpLink": "httpLink",
"relationships": {
"foo": {
"cardinality": "cardinality",
"objectType": "objectType",
"values": [
"string"
]
}
},
"updatedAt": "updatedAt",
"externalId": "externalId"
}