API Reference
Contacts
Manage contacts within your audiences. Add, update, and remove contacts from your mailing lists.
POST
/v1/contactsCreate a Contact
Add a new contact to your organization, optionally assigning them to an audience.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
email | string | Required | Email address |
first_name | string | Optional | First name |
last_name | string | Optional | Last name |
audience_id | string | Optional | UUID of the audience to add the contact to |
subscribed | boolean | Optional | Subscription status (default: true) |
metadata | object | Optional | Custom key-value data |
cURL
curl -X POST https://www.unosend.co/api/v1/contacts \
-H "Authorization: Bearer un_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"first_name": "John",
"last_name": "Doe",
"audience_id": "550e8400-e29b-41d4-a716-446655440000",
"metadata": {
"plan": "pro",
"signup_source": "website"
}
}'Response
201 Created
{
"id": "770e8400-e29b-41d4-a716-446655440002",
"email": "user@example.com",
"first_name": "John",
"last_name": "Doe",
"audience_id": "550e8400-e29b-41d4-a716-446655440000",
"subscribed": true,
"metadata": {
"plan": "pro",
"signup_source": "website"
},
"created_at": "2024-01-15T10:30:00.000Z"
}GET
/v1/contactsList Contacts
Get a paginated list of contacts. Optionally filter by audience.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
audience_id | string | Filter contacts by audience |
limit | number | Max results to return (default: 50, max: 100) |
offset | number | Number of results to skip (default: 0) |
cURL
curl "https://www.unosend.co/api/v1/contacts?audience_id=550e8400-e29b-41d4-a716-446655440000&limit=50" \
-H "Authorization: Bearer un_your_api_key"Response
200 OK
{
"data": [
{
"id": "770e8400-e29b-41d4-a716-446655440002",
"email": "user@example.com",
"first_name": "John",
"last_name": "Doe",
"audience_id": "550e8400-e29b-41d4-a716-446655440000",
"subscribed": true,
"metadata": { "plan": "pro" },
"created_at": "2024-01-15T10:30:00.000Z",
"updated_at": "2024-01-15T10:30:00.000Z"
}
]
}PATCH
/v1/contacts/:idUpdate a Contact
Update contact details. Only provided fields will be updated.
cURL
curl -X PATCH https://www.unosend.co/api/v1/contacts/770e8400-e29b-41d4-a716-446655440002 \
-H "Authorization: Bearer un_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"first_name": "Jane",
"metadata": {
"plan": "enterprise"
}
}'DELETE
/v1/contacts/:idDelete a Contact
Permanently delete a contact. This action cannot be undone.
cURL
curl -X DELETE https://www.unosend.co/api/v1/contacts/770e8400-e29b-41d4-a716-446655440002 \
-H "Authorization: Bearer un_your_api_key"POST
/v1/contacts/bulkBulk Operations
Perform bulk operations on multiple contacts at once.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
contact_ids | string[] | Required | Array of contact UUIDs |
operation | string | Required | One of: delete, subscribe, unsubscribe, move |
audience_id | string | For move | Target audience UUID (required for move operation) |
Bulk Delete
cURL
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": ["id1", "id2", "id3"],
"operation": "delete"
}'Bulk Subscribe/Unsubscribe
cURL
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": ["id1", "id2"],
"operation": "unsubscribe"
}'Move to Different Audience
cURL
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": ["id1", "id2", "id3"],
"operation": "move",
"audience_id": "new-audience-uuid"
}'Response
200 OK
{
"operation": "delete",
"affected": 3,
"skipped": 0,
"message": "Successfully deleted 3 contact(s)"
}