Node.js
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { data, error } = await rewrite.contacts.create({
phone: '+5511999999999',
name: 'Fernanda',
channel: 'SMS',
tags: { flow: 'checkout', origin: 'import' },
preferredLanguages: ['br', 'us'],
});
if (error) throw error;{
"ok": true,
"data": {
"id": "748395130237498515",
"phone": "+5511999999999",
"country": "br",
"createdAt": "2026-03-20T14:22:31.562Z",
"sandbox": false
}
}Contacts
Create a contact
Create a reusable contact with metadata, tag relations and optional preferred languages.
POST
/
contacts
Node.js
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { data, error } = await rewrite.contacts.create({
phone: '+5511999999999',
name: 'Fernanda',
channel: 'SMS',
tags: { flow: 'checkout', origin: 'import' },
preferredLanguages: ['br', 'us'],
});
if (error) throw error;{
"ok": true,
"data": {
"id": "748395130237498515",
"phone": "+5511999999999",
"country": "br",
"createdAt": "2026-03-20T14:22:31.562Z",
"sandbox": false
}
}Authorizations
Send your API key as Authorization: Bearer rw_....
Required scope: project:write.
Body
application/json
Destination number stored in E.164 format after normalization.
Minimum string length:
8Example:
"+5511999999999"
Optional human-readable label used to look up the contact later.
Required string length:
1 - 80Example:
"Fernanda"
Optional preferred channel for future contact-based sends.
Available options:
SMS, OTP Example:
"SMS"
Optional tag identifiers attached to the contact on creation.
Maximum array length:
15Example:
["748395130237498570"]
Arbitrary metadata stored with the contact.
Preferred locale codes used when targeting this contact with localized flows.
Example:
["br", "us"]