Contacts
Add or Update a Contact
PUT /v3/marketing/contacts
Base url: https://api.sendgrid.com
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
Request Body
An array of List ID strings that this contact will be added to.
One or more contacts objects that you intend to upsert. The available fields for a contact, including the required email
field are described below.
The first line of the address.
maxLength: 100An optional second line for the address.
maxLength: 100Additional emails associated with the contact.
maxItems: 5minItems: 0The contact's city.
maxLength: 60The contact's country. Can be a full name or an abbreviation.
maxLength: 50The contact's primary email. This is required to be a valid email.
maxLength: 254The contact's personal name.
maxLength: 50The contact's family name.
maxLength: 50The contact's ZIP code or other postal code.
The contact's state, province, or region.
maxLength: 50An object of custom field IDs and the values you want to associate with those custom fields. You can retrieve the IDs of your custom fields from the Get All Field Definitions endpoint.
The properties in this object are made up of a key (the custom field ID) and value you want associated with that custom field. For example {"w1": "coffee"}
.
Responses
Indicates that the contacts are queued for processing. Check the job status with the "Import Contacts Status" endpoint.
the error message
the field that generated the error
helper text or docs for troubleshooting
{
"errors": [
{
"field": "field_name",
"message": "error message"
}
]
}
the error message
the field that generated the error
helper text or docs for troubleshooting
{
"errors": [
{
"field": "field_name",
"message": "error message"
}
]
}
the error message
the field that generated the error
helper text or docs for troubleshooting
{
"errors": [
{
"field": "field_name",
"message": "error message"
}
]
}
Need some help?
We all do sometimes. Get help now from the Twilio SendGrid Support Team.
Running into a coding hurdle? Lean on the wisdom of the crowd by browsing the SendGrid tag on Stack Overflow or visiting Twilio's Stack Overflow Collective.