{"command":{"effect":"write","timeoutSeconds":30,"inputSchema":{"type":"object","description":"**This endpoint allows the [upsert](https://en.wiktionary.org/wiki/upsert) (insert or update) of up to 30,000 contacts, or 6MB of data, whichever is lower**.\nBecause 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 that your contacts have been updated or added, you can use the [Get Contacts by Identifiers operation](https://www.twilio.com/docs/sendgrid/api-reference/contacts/get-contacts-by-identifiers).\nPlease 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](https://www.twilio.com/docs/sendgrid/api-reference/custom-fields/create-custom-field-definition).\nYou 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](https://www.twilio.com/docs/sendgrid/api-reference/contacts/import-contacts-status).\nIf the contact already exists in the system, any entries submitted via this endpoint will update the existing contact. In order to update a contact, all of its existing identifiers must be present. Any fields omitted from the request will remain as they were. A contact's ID cannot be used to update the contact.\nThe 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.","properties":{"body":{"type":"object","properties":{"list_ids":{"type":"array","description":"An array of List ID strings that this contact will be added to.","items":{"type":"string","format":"uuid"}},"contacts":{"type":"array","description":"One or more contacts objects that you intend to upsert. Each contact needs to include at least one of `email`, `phone_number_id`, `external_id`, or `anonymous_id` as an identifier.","minItems":1,"maxItems":30000,"items":{"$ref":"#/definitions/ContactRequest"}}},"required":["contacts"]}},"required":[],"additionalProperties":false,"definitions":{"ContactRequest":{"title":"contact-request","type":"object","properties":{"address_line_1":{"type":"string","description":"The first line of the address.","maxLength":100},"address_line_2":{"type":"string","description":"An optional second line for the address.","maxLength":100},"alternate_emails":{"type":"array","description":"Additional emails associated with the contact.","minItems":0,"maxItems":5,"items":{"type":"string","maxLength":254}},"city":{"type":"string","description":"The contact's city.","maxLength":60},"country":{"type":"string","description":"The contact's country. Can be a full name or an abbreviation.","maxLength":50},"email":{"type":"string","description":"The contact's primary email. This is required to be a valid email.","maxLength":254},"phone_number_id":{"type":"string","description":"The contact's Phone Number ID. This must be a valid phone number."},"external_id":{"type":"string","description":"The contact's External ID.","maxLength":254},"anonymous_id":{"type":"string","description":"The contact's Anonymous ID.","maxLength":254},"first_name":{"type":"string","description":"The contact's personal name.","maxLength":50},"last_name":{"type":"string","description":"The contact's family name.","maxLength":50},"postal_code":{"type":"string","description":"The contact's ZIP code or other postal code."},"state_province_region":{"type":"string","description":"The contact's state, province, or region.","maxLength":50},"custom_fields":{"type":"object","description":"An 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](https://docs.sendgrid.com/api-reference/custom-fields/get-all-field-definitions).","properties":{"w1":{"type":"string","description":"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\"}`."}},"examples":[{"w1":"coffee","w33":"42","e2":"blue"}]}}}}},"name":"Add or Update a Contact","id":"sendgrid.mc_contacts.updatecontact","example":{},"maxRequests":1,"summary":false}}