---
page_type: error
code: 30647
message: "30647: Failed to Upsert Contact"
level: ERROR
product: Programmable Messaging
---

## Description

This error occurs when a contact object fails validation during upsert operations. The error can result from one or more of the following issues: invalid correlation ID, incorrect phone number format, invalid country ISO code, or an improperly formatted postal code. Additionally, this error may also indicate an internal server issue during the upsert process.

### Possible Causes

**INVALID\_CORRELATION\_ID:** The correlation\_id field is not a valid 32-character UUID. Each correlation\_id should be a unique identifier, exactly 32 characters long, to map the response to the original request.

**INVALID\_COUNTRY\_ISO\_CODE:** The country\_iso\_code is not a valid ISO 3166-1 alpha-2 country code. This field should be a 2-character uppercase string (e.g., "US" for the United States).

**INVALID\_CONTACT\_ID:** The contact\_id field is not in the correct [E.164 format.](http://localhost:4200/docs/glossary/what-e164)

**INVALID\_ZIP\_CODE:** The zip\_code field is not a valid postal code. The zip code should conform to the format used in the corresponding country as indicated by the country\_iso\_code.

**INTERNAL\_SERVER\_ERROR:** This error indicates an internal server issue that caused the upsert process to fail. Please retry the request.

### Possible Solutions

- Ensure the correlation\_id is a valid 32-character UUID. Each correlation\_id must be unique across all contact objects. You can use a UUID generator if necessary.

- Ensure the contact\_id is a valid phone number in [E.164 format.](http://localhost:4200/docs/glossary/what-e164)

- Confirm the country\_iso\_code: Ensure the country\_iso\_code follows the ISO 3166-1 alpha-2 standard (e.g., "US").

- Ensure the zip\_code matches the postal code format for the specified country.

- If an internal server error occurs, retry the request after some time.

#### Continued issues with error 30647

Twilio's support team can help investigate what went wrong with upserting your contacts. Please collect 3 or more correlation\_id from the last 24 hours that were flagged with Error 30647, and [open a support request.](https://www.twilio.com/console/support/tickets/create)