Audiences and contacts

An audience is a list of contacts you send broadcasts to. This page covers creating audiences, adding and updating contacts one at a time, and importing them from a CSV file.

Audiences

Create one audience per list your readers sign up for, for example a product newsletter and a separate list for release notes. A contact belongs to exactly one audience, so the same address in two audiences is two contacts with their own subscription state.

POST/v1/audiences

curl https://api.sendfern.com/v1/audiences \
  -H "Authorization: Bearer $SENDFERN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Acme newsletter"}'
Response · 201 Created
{
  "id": "aud_3hX9kQpL2vNcR8tYwB4mZe",
  "name": "Acme newsletter",
  "contact_count": 0,
  "subscribed_count": 0,
  "created_at": "2026-11-28T10:19:04Z"
}

The audience object

idstring
Starts with aud_.
namestring
Up to 200 characters. Only you see it.
contact_countinteger
Every contact in the audience.
subscribed_countinteger
Contacts that have not unsubscribed. Addresses on your suppression list still count here, because suppression is applied when a broadcast is sent.
created_atstring
ISO 8601, UTC.

List, rename and delete

GET /v1/audiences lists your audiences, newest first (see Pagination). PATCH /v1/audiences/{id} renames one and DELETE /v1/audiences/{id} deletes it.

# List audiences
curl https://api.sendfern.com/v1/audiences \
  -H "Authorization: Bearer $SENDFERN_API_KEY"

# Rename one
curl -X PATCH https://api.sendfern.com/v1/audiences/aud_3hX9kQpL2vNcR8tYwB4mZe \
  -H "Authorization: Bearer $SENDFERN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Acme product news"}'

# Delete one, with all its contacts
curl -X DELETE https://api.sendfern.com/v1/audiences/aud_3hX9kQpL2vNcR8tYwB4mZe \
  -H "Authorization: Bearer $SENDFERN_API_KEY"

Contacts

The contact object

idstring
Starts with con_.
emailstring
Stored in lowercase. Unique within the audience.
first_namestring
Up to 100 characters. Fills {{first_name}} in broadcasts.
last_namestring
Up to 100 characters. Fills {{last_name}} in broadcasts.
unsubscribedboolean
true once the contact unsubscribes. Broadcasts skip unsubscribed contacts. See Unsubscribe.
created_atstring
ISO 8601, UTC.

Add or update a contact

Adding a contact is an upsert by email address. If the address is not in the audience yet, Sendfern creates the contact and answers 201 Created. If it is, Sendfern updates that contact with the fields you sent and answers 200 OK. Fields you leave out keep their current values. This means you can call it every time someone signs up without checking first.

POST/v1/audiences/{id}/contacts

curl https://api.sendfern.com/v1/audiences/aud_3hX9kQpL2vNcR8tYwB4mZe/contacts \
  -H "Authorization: Bearer $SENDFERN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "first_name": "Jane",
    "last_name": "Doe"
  }'
Response · 201 Created
{
  "id": "con_7Lm2pQ9xVb4KcN1rTz8YhA",
  "email": "user@example.com",
  "first_name": "Jane",
  "last_name": "Doe",
  "unsubscribed": false,
  "created_at": "2026-11-28T10:21:40Z"
}

Body

emailstringrequired
The address. Case does not matter.
first_namestring
Optional.
last_namestring
Optional.
unsubscribedboolean
Optional. Send true to add someone as unsubscribed, or to unsubscribe an existing contact. Sending false subscribes them again.

List contacts

GET /v1/audiences/{id}/contacts returns the audience's contacts, newest first. Both filters are optional and can be combined:

  • email: contacts whose address contains this text, ignoring case. ?email=acme.com finds everyone at acme.com.
  • status: subscribed or unsubscribed. Any other value is 400 invalid_parameter.
curl "https://api.sendfern.com/v1/audiences/aud_3hX9kQpL2vNcR8tYwB4mZe/contacts?status=unsubscribed&limit=50" \
  -H "Authorization: Bearer $SENDFERN_API_KEY"

Get, update and delete a contact

Once you have a contact's id, use GET, PATCH and DELETE on /v1/contacts/{id}. A PATCH changes only the fields you send. Set unsubscribed to true when someone asks you to remove them through another channel, for example by replying to a newsletter. Deleting a contact removes it from the audience; to stop sending to an address while keeping a record of it, unsubscribe it instead.

# Unsubscribe a contact
curl -X PATCH https://api.sendfern.com/v1/contacts/con_7Lm2pQ9xVb4KcN1rTz8YhA \
  -H "Authorization: Bearer $SENDFERN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"unsubscribed": true}'

# Delete a contact
curl -X DELETE https://api.sendfern.com/v1/contacts/con_7Lm2pQ9xVb4KcN1rTz8YhA \
  -H "Authorization: Bearer $SENDFERN_API_KEY"

Only subscribe someone again (unsubscribed: false) when they have asked for it. Sending to people who unsubscribed leads to spam complaints, and complaints can pause your account.

Import contacts from CSV

To add many contacts at once, upload a CSV file as multipart/form-data with the file in the file field. The SDKs have no import method yet, so use cURL or any HTTP client that can send a multipart form. You can also import from the audience's page in the dashboard.

POST/v1/audiences/{id}/contacts/import

curl https://api.sendfern.com/v1/audiences/aud_3hX9kQpL2vNcR8tYwB4mZe/contacts/import \
  -H "Authorization: Bearer $SENDFERN_API_KEY" \
  -F "file=@contacts.csv"

File format

  • The first non-blank row is the header. Column names are trimmed and case does not matter.
  • An email column is required. first_name and last_name are optional. Any other column is ignored, including an unsubscribed column.
  • The file must be UTF-8, with or without a byte order mark. Spreadsheet apps can all export this.
  • At most 5 MB and 50,000 data rows per file. Split bigger lists into several files.
contacts.csv
email,first_name,last_name
jane@example.com,Jane,Doe
sam@example.com,Sam,

not-an-address,Alex,Kim
jane@example.com,Janet,Doe

If the file is too big, has too many rows, has no email column, is empty, is not UTF-8 or is not valid CSV, the request fails with 400 and param: "file", and nothing is saved.

The response

Otherwise the import runs straight away and answers with a summary. For the file above:

Response · 200 OK
{
  "created": 2,
  "updated": 0,
  "invalid": [
    {"row": 5, "reason": "'not-an-address' is not a valid email address."},
    {"row": 6, "reason": "Duplicate of row 2."}
  ],
  "invalid_count": 2
}
createdinteger
New contacts added to the audience.
updatedinteger
Rows whose address was already in the audience.
invalidarray
The first 100 skipped rows, each with its row number and a reason.
invalid_countinteger
How many rows were skipped in total.

created + updated + invalid_count always equals the number of data rows. A row is skipped when its address is missing or not valid, when a name is longer than 100 characters, or when the same address appeared earlier in the file. The rest of the file is still imported.

row is the line number in the file, with the header as row 1. Blank lines count too, so the number matches the row you see in a spreadsheet. In the example, the blank line is row 4 and the invalid address is row 5.

What an import changes

CaseResult
New addressContact created and subscribed.
Address already in the audienceCounted as updated. Non-blank name cells replace the names; blank cells keep them.
Contact that unsubscribedStays unsubscribed. An import never changes unsubscribed, so re-importing an old list cannot subscribe people again.
Address on your suppression listImported like any other. Suppressed addresses are skipped when a broadcast is sent.

Test mode

Audiences and contacts are shared between live and test mode, so a test broadcast goes to the same audience as a live one. Test keys can read audiences and contacts but not change them: any create, update, delete or import with a test key is 403 permission_denied. Use a live key to manage contacts. See Test mode.

Next steps

Write and send a newsletter to your audience with Broadcasts, and learn how contacts leave a list in Unsubscribe. Every endpoint is in the API reference.