Skip to main content

Methods

Update

Updates an existing contact.

UpdateWithContext

Updates an existing contact with context support.

Request Parameters

UpdateContactRequest

string
required
The contact ID to update. Either id or email is required.
string
The contact’s new email address, or use this to identify the contact instead of id
string
Deprecated: Optional - Omit for global contacts. Use Segments API for contact organization.
string
The contact’s first name
string
The contact’s last name
bool
Whether the contact is unsubscribed. Use SetUnsubscribed() method to set this value (see examples).
map[string]any
Custom key-value pairs for global contacts (when audience_id is omitted).Important: Currently, the Resend API only accepts string values for properties. Non-string values will be rejected.Example: map[string]any{"tier": "premium", "age": "30"}

SetUnsubscribed Method

Sets the unsubscribed status. This is a temporary helper method for backwards compatibility (will be improved in v3). Use this method to explicitly set the unsubscribed field to false, since the default zero value for bool is false with omitempty.

Response

UpdateContactResponse

Contact
The updated contact object containing:
  • id (string): Contact identifier
  • email (string): Email address
  • object (string): Object type
  • first_name (string): First name
  • last_name (string): Last name
  • created_at (string): Creation timestamp
  • unsubscribed (bool): Unsubscribe status
  • properties (map[string]any): Custom properties
struct{}
Error information if the update failed

Examples

Update Contact Name

Update Using Email Address

Update Unsubscribe Status

Update Contact Properties

Complete Update with Context

Notes

  • Either Id or Email must be provided to identify the contact
  • Use SetUnsubscribed() method to set the unsubscribed status
  • Properties are only supported for global contacts (without audience_id)
  • The API currently only accepts string values for properties