Menu

Contacts

Add or Update a Contact

PUT /marketing/contacts

This endpoint allows the upsert (insert or update) of up to 30,000 contacts, or 6MB of data, whichever is lower.

Because the creation and update of contacts is an asynchronous process, the response will not contain immediate feedback on the processing of your upserted contacts. Rather, it will contain an HTTP 202 response indicating the contacts are queued for processing or an HTTP 4XX error containing validation errors. Should you wish to get the resulting contact's ID or confirm your contacts have been updated or added, you can use the "Get Contacts by Emails" endpoint.

Please note that custom fields need to have been already created if you wish to set their values for the contacts being upserted. To do this, please use the "Create Custom Field Definition" endpoint.

You will see a job_id in the response to your request. This can be used to check the status of your upsert job. To do so, please use the "Import Contacts Status" endpoint.

If the contact already exists in the system, any entries submitted via this endpoint will update the existing contact. The contact to update will be determined only by the email field and any fields omitted from the request will remain as they were. A contact's ID cannot be used to update the contact.

The email field will be changed to all lower-case. If a contact is added with an email that exists but contains capital letters, the existing contact with the all lower-case email will be updated.

Authentication

  • API Key

Headers

Authorization
string
default: Bearer <<YOUR_API_KEY_HERE>>
required

Request Body

object
list_ids
array[string]

An array of List ID strings that this contact will be added to.

contacts
array[object]

One or more contacts objects that you intend to upsert. The available fields for a contact, including the required email field are described below.

maxItems: 30000minItems: 1
required
address_line_1
string

The first line of the address.

maxLength: 100
address_line_2
string

An optional second line for the address.

maxLength: 100
alternate_emails
array[string]

Additional emails associated with the contact.

maxItems: 5minItems: 0
city
string

The contact's city.

maxLength: 60
country
string

The contact's country. Can be a full name or an abbreviation.

maxLength: 50
email
string

The contact's primary email. This is required to be a valid email.

maxLength: 254
first_name
string

The contact's personal name.

maxLength: 50
last_name
string

The contact's family name.

maxLength: 50
postal_code
string

The contact's ZIP code or other postal code.

state_province_region
string

The contact's state, province, or region.

maxLength: 50
custom_fields
object

Responses

object
job_id
string

Indicates that the contacts are queued for processing. Check the job status with the "Import Contacts Status" endpoint.

object
errors
array[object]
message
string
field
string
error_id
string
parameter
string
object
errors
array[object]
message
string

the error message

field
string or null

the field that generated the error

help
object

helper text or docs for troubleshooting

id
string
{
  "errors": [
    {
      "field": "field_name",
      "message": "error message"
    }
  ]
}
object
errors
array[object]
message
string

the error message

field
string or null

the field that generated the error

help
object

helper text or docs for troubleshooting

id
string
{
  "errors": [
    {
      "field": "field_name",
      "message": "error message"
    }
  ]
}
object
errors
array[object]
message
string

the error message

field
string or null

the field that generated the error

help
object

helper text or docs for troubleshooting

id
string
{
  "errors": [
    {
      "field": "field_name",
      "message": "error message"
    }
  ]
}
object
errors
array[object]
message
string
Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the SendGrid tag on Stack Overflow.

Thank you for your feedback!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Sending your feedback...
🎉 Thank you for your feedback!
Something went wrong. Please try again.

Thanks for your feedback!

Refer us and get $10 in 3 simple steps!

Step 1

Get link

Get a free personal referral link here

Step 2

Give $10

Your user signs up and upgrade using link

Step 3

Get $10

1,250 free SMSes
OR 1,000 free voice mins
OR 12,000 chats
OR more