Attachments on the API

Upload, list and manage email attachments programmatically

May 30, 2025

We've added a new /attachments endpoint to the API that allows you to upload, list, and manage attachments for your emails. This brings the attachment functionality that was previously only available through the web interface to the API.

The attachments API supports all the same file types as the web interface, and each attachment must be less than 2MB in size. The attachments feature is available on paid plans.

Uploading an attachment

import requests

url = "https://api.buttondown.com/v1/attachments"
headers = {
  "Authorization": "Token $BUTTONDOWN_API_KEY"
}
files = {
}

response = requests.request("POST", url, headers=headers, files=files)
print(response.text)

Listing attachments

import requests

url = "https://api.buttondown.com/v1/attachments"
headers = {
  "Authorization": "Token $BUTTONDOWN_API_KEY"
}

response = requests.request("GET", url, headers=headers)
print(response.text)

Deleting an attachment

import requests

url = "https://api.buttondown.com/v1/attachments/{id}"
headers = {
  "Authorization": "Token $BUTTONDOWN_API_KEY"
}

response = requests.request("DELETE", url, headers=headers)
print(response.text)
Buttondown is the last email platform you’ll switch to.