Node.js
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { error } = await rewrite.contacts.update(
'748395130237498515',
{
name: 'Fernanda Silva',
preferredLanguages: ['br'],
tags: { flow: 'otp-login', origin: 'signup' },
},
);
if (error) throw error;{
"ok": true,
"data": null
}Contacts
Update a contact
Update a saved contact, including metadata, preferred languages and attached tags.
PATCH
/
contacts
/
{id}
Node.js
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { error } = await rewrite.contacts.update(
'748395130237498515',
{
name: 'Fernanda Silva',
preferredLanguages: ['br'],
tags: { flow: 'otp-login', origin: 'signup' },
},
);
if (error) throw error;{
"ok": true,
"data": null
}Authorizations
Send your API key as Authorization: Bearer rw_....
Required scope: project:write.
Path Parameters
Contact identifier returned by Rewrite.
Example:
"748395130237498412"
Body
application/json
Updated destination number. Rewrite normalizes it before persisting.
Minimum string length:
8Example:
"+5511888888888"
Updated contact label.
Required string length:
1 - 80Example:
"Fernanda Silva"
Updated preferred channel.
Available options:
SMS, OTP Example:
"OTP"
Replacement tag set linked to the contact. Existing relations are synchronized.
Maximum array length:
15Example:
["748395130237498570"]
Replacement metadata stored with the contact.
Updated locale preference list for the contact.
Example:
["br"]