POST /contacts
Add an address to your audience, with optional names, properties, segments and topics.
Body
| Field | Type | Description |
|---|---|---|
email* | string | The contact's address. |
first_name | string | Up to 200 characters. |
last_name | string | Up to 200 characters. |
unsubscribed | boolean | Start the contact opted out of every broadcast. Defaults to false. A repeat create never sets it back to false. |
properties | object | Values for declared contact properties, keyed by property key. Each value must match its property's type. |
2 more fields (segments, topics)
| Field | Type | Description |
|---|---|---|
segments | object[] | { id } entries naming segments to add the contact to. |
topics | object[] | { id, subscription } entries, with subscription one of opt_in or opt_out. |
curl -X POST "https://api.rasket.com/contacts" \
-H "Authorization: Bearer $RASKET_API_KEY" \
-H "User-Agent: acme-billing/1.0" \
-H "Content-Type: application/json" \
-d '{
"email": "ronald.williams@example.com",
"first_name": "Ronald",
"last_name": "Williams",
"properties": {
"company": "Acme",
"seats": 12
}
}'const response = await fetch("https://api.rasket.com/contacts", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RASKET_API_KEY}`,
"User-Agent": "acme-billing/1.0",
"Content-Type": "application/json",
},
body: JSON.stringify({
email: "ronald.williams@example.com",
first_name: "Ronald",
last_name: "Williams",
properties: {
company: "Acme",
seats: 12
}
}),
});
const { id } = await response.json();import os
import requests
response = requests.post(
"https://api.rasket.com/contacts",
headers={
"Authorization": f"Bearer {os.environ['RASKET_API_KEY']}",
"User-Agent": "acme-billing/1.0",
},
json={
"email": "ronald.williams@example.com",
"first_name": "Ronald",
"last_name": "Williams",
"properties": {
"company": "Acme",
"seats": 12
}
},
)
id = response.json()["id"]Response 201
{
"object": "contact",
"id": "e169aa45-1ecf-4183-9955-b1499d5701d3"
}- An address the team already holds a contact for is updated with the fields the body carries, and the existing
idis returned. There is no 409. - Every key in
propertiesmust name a declared contact property of a matching type; an unknown key or a wrong type is422 invalid_parameternaming the key. - Your plan's contact limit is enforced here and on imports: past it, the call is
422 validation_errorwithContact limit reached. - Emits
contact.created— orcontact.updatedwhen the address already existed.