Create Contact
Create a contact.
Body Parameters
Section titled “Body Parameters”email(string, required) — The email address of the contact.
The first name of the contact.
The last name of the contact.
-
unsubscribed(boolean) — The Contact's global subscription status. If set totrue, the contact will be unsubscribed from all Broadcasts. -
properties(object) — A map of custom property keys and values to create.custom properties
key(string, required) — The property key.value(string, required) — The property value.
-
segments(array) — Array of objects. Each object must contain the ID of the segment that you'd like to add the contact to.segments
id(string, required) — The segment ID.
-
topics(array) — Array of topic subscriptions for the contact.topics
id(string, required) — The topic ID.subscription('opt_in' | 'opt_out', required) — The subscription status for this topic.
import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.contacts.create({
email: 'steve.wozniak@gmail.com',
firstName: 'Steve',
lastName: 'Wozniak',
unsubscribed: false,
});$resend = Resend::client('re_xxxxxxxxx');
$resend->contacts->create(
parameters: [
'email' => 'steve.wozniak@gmail.com',
'first_name' => 'Steve',
'last_name' => 'Wozniak',
'unsubscribed' => false
]
);import resend
resend.api_key = "re_xxxxxxxxx"
params: resend.Contacts.CreateParams = {
"email": "steve.wozniak@gmail.com",
"first_name": "Steve",
"last_name": "Wozniak",
"unsubscribed": False,
}
resend.Contacts.create(params)require "resend"
Resend.api_key = "re_xxxxxxxxx"
params = {
"email": "steve.wozniak@gmail.com",
"first_name": "Steve",
"last_name": "Wozniak",
"unsubscribed": false,
}
Resend::Contacts.create(params)package main
import "github.com/resend/resend-go/v4"
func main() {
client := resend.NewClient("re_xxxxxxxxx")
params := &resend.CreateContactRequest{
Email: "steve.wozniak@gmail.com",
FirstName: "Steve",
LastName: "Wozniak",
Unsubscribed: false,
}
client.Contacts.Create(params)
}use resend_rs::{types::CreateContactOptions, Resend, Result};
#[tokio::main]
async fn main() -> Result<()> {
let resend = Resend::new("re_xxxxxxxxx");
let contact = CreateContactOptions::new("steve.wozniak@gmail.com")
.with_first_name("Steve")
.with_last_name("Wozniak")
.with_unsubscribed(false);
let _contact = resend.contacts.create(contact).await?;
Ok(())
}import com.resend.Resend;
import com.resend.core.exception.ResendException;
import com.resend.services.contacts.model.CreateContactOptions;
import com.resend.services.contacts.model.CreateContactResponseSuccess;
public class Main {
public static void main(String[] args) throws ResendException {
Resend resend = new Resend("re_xxxxxxxxx");
CreateContactOptions params = CreateContactOptions.builder()
.email("steve.wozniak@gmail.com")
.firstName("Steve")
.lastName("Wozniak")
.unsubscribed(false)
.build();
CreateContactResponseSuccess data = resend.contacts().create(params);
}
}using Resend;
IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI
var resp = await resend.ContactAddAsync(
new ContactData()
{
Email = "steve.wozniak@gmail.com",
FirstName = "Steve",
LastName = "Wozniak",
IsUnsubscribed = false,
}
);
Console.WriteLine( "Contact Id={0}", resp.Content );curl -X POST 'https://api.resend.com/contacts' \
-H 'Authorization: Bearer re_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-d $'{
"email": "steve.wozniak@gmail.com",
"first_name": "Steve",
"last_name": "Wozniak",
"unsubscribed": false
}'resend contacts create \
--email steve.wozniak@gmail.com \
--first-name Steve \
--last-name Wozniak{
"object": "contact",
"id": "479e3145-dd38-476b-932c-529ceb705947"
}