# 30647: Failed to Upsert Contact

Log Type: APPLICATION

Log Level: ERROR

## Description

We return this error when one or more contact objects fail validation during a Contact API bulk upsert request. Common failures include an invalid `correlation_id`, a `contact_id` that is not in `E.164` format, an invalid `country_iso_code`, an invalid `zip_code`, or an internal server failure during processing.

### Possible causes

* Reason code `INVALID_CORRELATION_ID`. The `correlation_id` field is not a valid 32-character UUID.
* Reason code `INVALID_COUNTRY_ISO_CODE`. The `country_iso_code` field is not a valid 2-character uppercase `ISO 3166-1 alpha-2` country code such as `US`.
* Reason code `INVALID_CONTACT_ID`. The `contact_id` field is not a valid phone number in `E.164` format.
* Reason code `INVALID_ZIP_CODE`. The `zip_code` field does not match the postal code format for the country specified by `country_iso_code`.
* Reason code `INTERNAL_SERVER_ERROR`. The upsert request failed because of an internal server issue during processing.

### Possible solutions

* Generate a unique 32-character UUID for each `correlation_id` in the request so you can map each response item back to the original contact object.
* Format every `contact_id` in `E.164`. Start the number with `+`, use only digits after the `+`, and keep the total length to 15 digits or fewer.
* Use a valid two-letter uppercase `country_iso_code` value such as `US`.
* Make sure each `zip_code` matches the postal code format used by the country you send in `country_iso_code`.
* Validate phone numbers before you upsert contacts. A Lookup formatting and validation request can confirm whether a number is valid and return validation errors when it is not.
* Retry the request if you receive `INTERNAL_SERVER_ERROR`. If the issue continues, collect at least 3 recent `correlation_id` values from the last 24 hours before contacting support.

#### Additional resources

* [Contact API](/docs/messaging/features/contact-api)
* [What is E.164?](/docs/glossary/what-e164)
* [Lookup Formatting and Validation](/docs/lookup/v2-api/formatting-validation)
