Key Concepts
Audiences Lists of contacts grouped by purpose. E.g., Newsletter subscribers, Product updates, etc.
Contacts Individual subscribers with email addresses and custom properties.
Properties Custom fields on contacts for personalization and segmentation.
Creating an Audience
Create an audience to group your contacts:
curl -X POST https://www.unosend.co/api/v1/audiences \
-H "Authorization: Bearer un_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "Newsletter Subscribers",
"description": "Users who signed up for our weekly newsletter"
}'
Response
{
"id" : "aud_xxxxxxxxxxxxxxxx" ,
"name" : "Newsletter Subscribers" ,
"description" : "Users who signed up for our weekly newsletter" ,
"contact_count" : 0 ,
"created_at" : "2024-01-15T10:30:00Z"
}
curl -X POST https://www.unosend.co/api/v1/contacts \
-H "Authorization: Bearer un_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"audience_id": "aud_xxxxxxxxxxxxxxxx",
"email": "[email protected] ",
"first_name": "John",
"last_name": "Doe",
"properties": {
"company": "Acme Inc",
"role": "Developer",
"signup_date": "2024-01-15",
"plan": "pro"
}
}'
Response
{
"id" : "ctc_xxxxxxxxxxxxxxxx" ,
"email" : "[email protected] " ,
"first_name" : "John" ,
"last_name" : "Doe" ,
"properties" : {
"company" : "Acme Inc" ,
"role" : "Developer" ,
"signup_date" : "2024-01-15" ,
"plan" : "pro"
},
"created_at" : "2024-01-15T10:30:00Z"
}
To add multiple contacts, make individual POST requests to /api/v1/contacts or use the dashboard’s CSV import feature for bulk imports.
Bulk Operations
Perform bulk operations on existing contacts:
Bulk Delete
curl -X POST https://www.unosend.co/api/v1/contacts/bulk \
-H "Authorization: Bearer un_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"contact_ids": ["ctc_xxx1", "ctc_xxx2", "ctc_xxx3"],
"operation": "delete"
}'
Bulk Subscribe/Unsubscribe
# Unsubscribe multiple contacts
curl -X POST https://www.unosend.co/api/v1/contacts/bulk \
-H "Authorization: Bearer un_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"contact_ids": ["ctc_xxx1", "ctc_xxx2"],
"operation": "unsubscribe"
}'
# Re-subscribe contacts
curl -X POST https://www.unosend.co/api/v1/contacts/bulk \
-H "Authorization: Bearer un_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"contact_ids": ["ctc_xxx1", "ctc_xxx2"],
"operation": "subscribe"
}'
Move to Different Audience
curl -X POST https://www.unosend.co/api/v1/contacts/bulk \
-H "Authorization: Bearer un_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"contact_ids": ["ctc_xxx1", "ctc_xxx2", "ctc_xxx3"],
"operation": "move",
"audience_id": "aud_new_audience_id"
}'
Bulk Operation Response
{
"operation" : "delete" ,
"affected" : 3 ,
"skipped" : 0 ,
"message" : "Successfully deleted 3 contact(s)"
}
Store custom data on contacts for personalization:
{
"email" : "[email protected] " ,
"first_name" : "Jane" ,
"last_name" : "Smith" ,
"properties" : {
"company" : "Tech Corp" ,
"job_title" : "Product Manager" ,
"signup_date" : "2024-01-15" ,
"last_purchase" : "2024-03-20" ,
"lifetime_value" : 1500 ,
"order_count" : 12 ,
"is_premium" : true ,
"newsletter_opted_in" : true ,
"interests" : [ "technology" , "design" , "marketing" ]
}
}
Update Properties
curl -X PATCH https://www.unosend.co/api/v1/contacts/ctc_xxxxxxxx \
-H "Authorization: Bearer un_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"properties": {
"plan": "enterprise",
"lifetime_value": 5000,
"last_purchase": "2024-03-25"
}
}'
Properties are merged, not replaced. Existing properties not included are preserved.
curl "https://www.unosend.co/api/v1/contacts?audience_id=aud_xxxxxxxx&limit=100&offset=0" \
-H "Authorization: Bearer un_your_api_key"
Response
{
"contacts" : [
{
"id" : "ctc_xxxxxxxx" ,
"email" : "[email protected] " ,
"first_name" : "John" ,
"last_name" : "Doe" ,
"properties" : { "plan" : "pro" }
}
],
"total" : 150 ,
"has_more" : true
}
curl https://www.unosend.co/api/v1/contacts/ctc_xxxxxxxx \
-H "Authorization: Bearer un_your_api_key"
Managing Unsubscribes
Contacts can unsubscribe from audiences. We automatically handle unsubscribe links in your emails:
# Manually unsubscribe a contact
curl -X PATCH https://www.unosend.co/api/v1/contacts/ctc_xxxxxxxx \
-H "Authorization: Bearer un_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"unsubscribed": true
}'
# Re-subscribe (only if they have opted in again)
curl -X PATCH https://www.unosend.co/api/v1/contacts/ctc_xxxxxxxx \
-H "Authorization: Bearer un_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"unsubscribed": false
}'
Automatic Unsubscribe Links: We automatically add unsubscribe links to your emails if you use the {{unsubscribe_url}} variable in your templates.
Best Practices
✓ Organize with audiences - Create separate audiences for different purposes
✓ Use properties - Store relevant data for personalization
✓ Handle unsubscribes - Never re-add unsubscribed contacts without explicit consent
✓ Clean your lists - Remove bounced emails and inactive contacts regularly
✓ Double opt-in - Confirm subscriptions to maintain a quality list