Skip to main content

Update an audience

Creates or updates audience.

URL: https://api.courier.com/audiences/:audience_id

Method: PUT

Path Parameters

audience_idstringrequired
A unique identifier representing the audience id

Body Parameters

idstring
A unique identifier representing the audience_id
namestring
The name of the audience
descriptionstring
A description of the audience
filteroneOf
+ Show Properties

Responses

status: 200 OK

audienceobject
+ Show Properties

status: 400 Bad Request

messagestring
A message describing the error that occurred.
typestring
[invalid_request_error] The type of error that occurred.

Request Example

curl --request PUT \
--url https://api.courier.com/audiences/my-favorite-developer-audience \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '
{
"id": "developer-audience",
"name": "Developer Audience",
"description": "Audience for developers",
"filter": {
"operator": "EQ",
"value": "engineer",
"path": "title"
}
}
'

Responses Example

{
"audience": {
"id": "developer-audience",
"name": "Developer Audience",
"description": "Audience for developers",
"created_at": "2023-08-23T18:40:59.143Z",
"updated_at": "2023-08-23T18:45:26.199Z",
"filter": {
"operator": "EQ",
"value": "engineer",
"path": "title"
}
}
}
{
"message": "Error Message",
"type": "invalid_request_error"
}

Example of an OR operator

{
"id": "abcdefgh12345678",
"name": "Product Team",
"description": "Members of the product team, including both engineers and product managers.",
"filter": {
"Multiple Filters": {
"operator": "OR",
"filters": [
{
"operator": "EQ",
"value": "engineer",
"path": "title"
},
{
"operator": "EQ",
"value": "product manager",
"path": "title"
}
]
}
}
}

Example of an AND operator

JSON
{
"id": "abcdefgh12345678",
"name": "Developers from San Francisco",
"filter": {
"operator": "AND",
"filters": [
{
"path": "location",
"operator": "EQ",
"value": "San Francisco"
},
{
"path": "job_title",
"operator": "EQ",
"value": "Developer"
}
]
}
}
Was this helpful?