Skip to main content
POST
/
audiences
cURL
curl --request POST \
  --url https://letterby.com/api/v4/audiences \
  --header 'Content-Type: application/json' \
  --header 'apiKey: <api-key>' \
  --data '
{
  "name": "<string>",
  "listId": "<string>",
  "filters": "{\"points\": {\"gte\": 100}, \"AND\": [{\"email\": {\"contains\": \"@gmail.com\"}}]}",
  "mode": "manual"
}
'
{
  "data": {
    "audience": {
      "id": "<string>",
      "name": "<string>",
      "filters": "<string>",
      "mode": "smart",
      "listId": "<string>",
      "createdAt": "2023-11-07T05:31:56Z",
      "updatedAt": "2023-11-07T05:31:56Z",
      "subs": [
        {
          "id": "<string>",
          "email": "<string>",
          "firstName": "<string>",
          "lastName": "<string>",
          "phoneNumber": "<string>",
          "createdAt": "2023-11-07T05:31:56Z",
          "points": 123,
          "referrals": 123,
          "listId": "<string>",
          "isVerified": true,
          "unsubscribed": true,
          "data": {},
          "address": "<string>",
          "isGDPR": true,
          "name": "<string>",
          "instagram": "<string>",
          "twitter": "<string>",
          "website": "<string>",
          "company": "<string>",
          "country": "<string>",
          "city": "<string>",
          "list": {
            "id": "<string>",
            "name": "<string>",
            "url": "<string>",
            "mode": "<string>",
            "referrals": true,
            "color": "<string>",
            "title": "<string>",
            "desc": "<string>"
          },
          "audiences": "<array>",
          "referralLink": "<string>",
          "privateLink": "<string>"
        }
      ]
    }
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.letterby.com/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

apiKey
string
header
required

API key to authorize requests

Body

application/json
name
string
required

Name of the audience

listId
string
required

ID of the list this audience belongs to

filters
string

JSON string containing Prisma where clause for Sub model. Required if mode is 'smart'

Example:

"{\"points\": {\"gte\": 100}, \"AND\": [{\"email\": {\"contains\": \"@gmail.com\"}}]}"

mode
enum<string>
default:manual

Audience mode

Available options:
manual,
smart

Response

Audience created successfully

data
object