# 30646: Failed to Upsert Consent

Log Type: APPLICATION

Log Level: ERROR

## Description

This error occurs when one or more fields in a consent object are invalid during the upsert process, or due to an internal server issue. The contact's consent status may fail validation due to issues with the sender ID, opt-in status, or the source from which the consent was collected.

### 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\_SENDER\_ID:** The sender\_id field is invalid. It must be either a valid Messaging Service SID or a from phone number. Ensure the sender\_id is correctly formatted.

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

**INVALID\_STATUS:** The status field is invalid. It must be one of the following values: opt-in or opt-out.

**INVALID\_SOURCE:** The source field is invalid. It must be one of the following values: website, offline, opt-in-message, opt-out-message, or others.

**INVALID\_DATE\_OF\_CONSENT:** The date\_of\_consent field is invalid. It must be a datetime string in ISO-8601 format (e.g., 2025-06-02T15:30:00Z) and cannot be set to a future date.

**INTERNAL\_SERVER\_ERROR:** The request failed due to an internal server error during the upsert process. 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 sender\_id is either a valid Messaging Service SID or a from phone number.
* Ensure the contact\_id is a valid phone number in [E.164 format.](http://localhost:4200/docs/glossary/what-e164)
* Ensure the status field contains a valid value (opt-in or opt-out).
* Ensure the source field is one of the accepted values (website, offline, opt-in-message, opt-out-message, others).
* Ensure the date\_of\_consent is a datetime string in ISO-8601 format (e.g., 2025-06-02T15:30:00Z) and is not set to a future date and time.
* If an internal server error occurs, retry the request after some time.

#### Continued issues with error 30646

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 30646, and [open a support request.](https://www.twilio.com/console/support/tickets/create)
