Create Contact

Create a new contact for the organization.

POST/contacts

Resend Compatibility: Partial -- Postflare adds properties, segments, and topics fields.

Requires an API key with contacts:write permission.

Body Parameters

emailstringrequired

Contact email address.

first_namestring

Contact first name.

last_namestring

Contact last name.

unsubscribedboolean

Whether the contact is unsubscribed. Default false.

propertiesobject

Custom key-value properties for the contact. Values can be strings or numbers.

segmentsstring[]

Array of segment IDs to add the contact to.

topicsarray

Array of topic subscriptions.

idstringrequired

Topic ID.

subscriptionstring

Subscription status: opt_in or opt_out. Defaults to the topic's default subscription.

Response Fields

objectstring

Always "contact".

idstring

The newly created contact ID.

curl -X POST 'https://api.postflare.dev/contacts' \
  -H 'Authorization: Bearer sk_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
    "email": "user@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "unsubscribed": false
  }'
// Set RESEND_BASE_URL=https://api.postflare.dev in the environment before
// the process starts. Without it the SDK sends to api.resend.com, silently.
import { Resend } from 'resend';

const resend = new Resend('sk_xxxxxxxxx');

const { data, error } = await resend.contacts.create({
  email: 'user@example.com',
  firstName: 'John',
  lastName: 'Doe',
  unsubscribed: false,
});

Response

Response
{
  "object": "contact",
  "id": "e169aa45-1ecf-4183-9955-b1499d5701d3"
}