Tag
Tags are a way to organize your subscribers. You can create, update, and delete tags via the API. You can also list all tags for a given newsletter.
Tags don't have any strict functionality on their own, but you can send emails to subscribers with a given tag (or to all subscribers without a given tag.)
Basic tag
{"color": "string","creation_date": "2019-08-24T14:15:22Z","description": "string","id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","name": "string"}
field | type | description |
---|---|---|
id | string | |
name | string | |
color | string | |
description | string | |
secondary_id | integer | |
creation_date | string |
Create Tag
curl
python
ruby
typescript
Copy to clipboard
import requestsheaders = {"Authorization": f"Token {BUTTONDOWN_API_KEY}",}BASE_URL = "https://api.buttondown.email"ENDPOINT = "/v1/tags"response = requests.post(f"{BASE_URL}{ENDPOINT}", headers=headers)
Parameters
parameter | type | description | optional |
---|---|---|---|
name | string | ||
color | string | ||
description | string |
Responses
Status | Description | Sample Response |
---|---|---|
201 | Created |
|
400 | Bad Request |
|
403 | Forbidden |
|
List Tags
curl
python
ruby
typescript
Copy to clipboard
import requestsheaders = {"Authorization": f"Token {BUTTONDOWN_API_KEY}",}BASE_URL = "https://api.buttondown.email"ENDPOINT = "/v1/tags"response = requests.get(f"{BASE_URL}{ENDPOINT}", headers=headers)
Responses
Status | Description | Sample Response |
---|---|---|
200 | OK |
|
403 | Forbidden |
|
Retrieve Tag
curl
python
ruby
typescript
Copy to clipboard
import requestsheaders = {"Authorization": f"Token {BUTTONDOWN_API_KEY}",}BASE_URL = "https://api.buttondown.email"ENDPOINT = "/v1/tags/{pk}"response = requests.get(f"{BASE_URL}{ENDPOINT}", headers=headers)
Responses
Status | Description | Sample Response |
---|---|---|
200 | OK |
|
403 | Forbidden |
|
404 | Not Found |
|
Update Tag
curl
python
ruby
typescript
Copy to clipboard
import requestsheaders = {"Authorization": f"Token {BUTTONDOWN_API_KEY}",}BASE_URL = "https://api.buttondown.email"ENDPOINT = "/v1/tags/{pk}"response = requests.patch(f"{BASE_URL}{ENDPOINT}", headers=headers)
Parameters
parameter | type | description | optional |
---|---|---|---|
name | string | ||
color | string | ||
description | string | ||
secondary_id | integer |
Responses
Status | Description | Sample Response |
---|---|---|
200 | OK |
|
400 | Bad Request |
|
Error codes
type | identifier | description |
---|---|---|
Name already exists | name_already_exists | The name of the tag already exists |
Delete Tag
curl
python
ruby
typescript
Copy to clipboard
import requestsheaders = {"Authorization": f"Token {BUTTONDOWN_API_KEY}",}BASE_URL = "https://api.buttondown.email"ENDPOINT = "/v1/tags/{pk}"response = requests.delete(f"{BASE_URL}{ENDPOINT}", headers=headers)
Responses
Status | Description | Sample Response |
---|---|---|
204 | No Content |
|
403 | Forbidden |
|
404 | Not Found |
|