Update a contact by contact key
const url = 'https://api.tryletterhead.com/api/v3/contacts/keyed/example';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"email":"[email protected]","firstName":"example","lastName":"example","tags":["example"],"customFields":{},"channel":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.tryletterhead.com/api/v3/contacts/keyed/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "email": "[email protected]", "firstName": "example", "lastName": "example", "tags": [ "example" ], "customFields": {}, "channel": "example" }'Same as Update a contact (PUT /api/v3/contacts/{email}), with the contact addressed by its contactKey instead of its email address — the address to use for a contact with no email, such as a phone-only contact. Contacts without an email address are in early access and may not be available on your account yet.
Early access: on accounts where it is available, sending email for a contact created from a phone number (its anchor is endpoint) gives that person the address. Everything the contact holds is carried onto a new contact keyed on the address, and the response returns it under a new contactKey; use that key from then on. A later write to the old key returns 409 with the new key in data, and a read of the old key returns the new contact. On accounts where it isn’t available, the request is refused with 422 (reason: emailOnPhoneContactUnavailable) and nothing changes.
- An address another contact already holds is refused with
409. - A contact created with an email address, including one that was given its address this way, keeps it: sending
emailfor one is refused with422. - An empty
email, or the address the contact already holds, is ignored, and so is anyemailwhere contacts without an email address aren’t enabled for your account. - A request that arrives while another change to the company’s contacts is running, or while this contact is changing, can be refused with
409. Nothing is lost; send it again.
This is a company-level (v3) write. Authenticate with a company API key as a Bearer token.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The contact’s opaque 64-character hex key (from a prior response’s contactKey field).
Request Body required
Section titled “Request Body required ”object
Early access. Gives a contact created from a phone number an email address, returning it under a new contactKey. See above.
The contact’s first name.
The contact’s last name.
Tags to set on the contact.
Values for your company’s custom fields, keyed by field name. See PUT /api/v3/contacts/{email} for the full rules.
object
A channel slug. Scopes the tag-change trigger for tags this update adds; omit for a company-wide edit.
Example generated
{ "firstName": "example", "lastName": "example", "tags": [ "example" ], "customFields": {}, "channel": "example"}Responses
Section titled “ Responses ”200 OK. Same shape as GET /api/v3/contacts/{email}.
object
The updated contact. Full field list under GET /api/v3/contacts/{email}.
object
Example generated
{ "items": {}, "message": "example", "total": 1}Still can’t find what you need? Contact support.