AWeber API (1.0)

Download OpenAPI specification:Download

We are constantly working to improve this documentation. If you have feedback and questions, please contact the AWeber API team at api@aweber.com.

The AWeber API is a REST API that uses the OAuth 1.0a authentication model.

Please see the below resources for further information:

Getting Started

Creating a Developer Account

To start developing, you will first need to create a free developer account. After you create a developer account, log in and create an app.

What is the AWeber API?

The AWeber API is a JSON based REST API.

This means that resources are represented as JSON dictionaries and you use a different HTTP verb to do your standard CRUD operations on them:

  • POST: Create new resources.
  • GET: Retrieve a resource.
  • PATCH: Update existing resources.
  • DELETE: Delete existing resources.

Note

Within this document, campaigns is a generic term that refers to both Broadcast and Follow Up messages. Currently the AWeber API does not support Campaigns, which is an email automation platform available to customers within the AWeber web platform.

Authentication

Before you can make requests to the API, you need to support our authentication protocol. We currently require all API requests to use the OAuth 1.0a authentication protocol.

We recommend that you start out by visiting the OAuth1 Overview. This will walk you through the authentication process.

How Resources are Arranged in the AWeber API

API resources are arranged in the AWeber API based on their relationships to each other. We illustrate these relationships on the image below with the URLs of the resources. When we refer to the relationships of the resources, we say an Account has Lists, a List has Subscribers, etc. We can also say Subscribers belong to a List, or Lists belong to an Account, and so on.

A single resource is referred to as an Entry and is shown as a yellow circle on the image. Entries are contained in Collections which are shown as a blue box on the image. These resources are contained under version '1.0' of the API.

[Resource Map]

 

How Collections are Represented

Collections are represented as an ordered sequence of entries. They are paginated using the ws.size and ws.start query parameters where ws.size is the maximum number of entries to return and ws.start is the zero-based index to start the page at. The response represents a page of entries and includes at least the following body properties:

Name Type Description
entries List of Objects The entries on the requested page
start Non-negative Integer The starting offset of the page
total_size Non-negative Integer The total size of the collection*
next_collection_link URL Link to the next page unless this is the final page
prev_collection_link URL Link to the previous page unless this is the first page

Though you can specify the exact page that you want using ws.size and ws.start, you should use the next_collection_link and prev_collection_link properties in the response to traverse the collection. If the prev_collection_link is absent, then the current page is the first page. Likewise, if the next_collection_link is absent, then the current page is the last page in the collection.

OAuth1 Overview

The AWeber API uses the OAuth 1.0a specification for authentication.

Before you start adding subscribers, sending messages, or checking your broadcast stats with AWeber's API you'll need to obtain an access token and access secret for an AWeber account in order to make requests. We currently use OAuth 1 to verify that an integration is who they claim to be and has proper permission to access an AWeber account.

You'll need the following to get started:

  • An AWeber developer account
  • An app created in that account
  • An AWeber customer account
  • An HTTP library capable of making OAuth 1 requests.

If you need a customer account you can sign up for a free trial to get started. These examples will be using Python 3 and requests_oauthlib as the HTTP library but there are lots of other good libraries out there. For a full sample in Python as well as PHP please see our code samples on GitHub.

Just looking for the endpoints and don't need a walkthrough? No problem! Our authorization endpoints are listed below:

Request Token URL:

https://auth.aweber.com/1.0/oauth/request_token

Authorization URL:

https://auth.aweber.com/1.0/oauth/authorize

Access Token URL:

https://auth.aweber.com/1.0/oauth/access_token

What is OAuth 1.0a?

OAuth is a way for a developer to securely access information without knowing someone's password or other login details. The end result of following the OAuth 1 process is a set of access tokens. The access token and access secret prove the developer has permission to access the data held within the API and should always be kept safe and secure. When OAuth 1 is used the user never has to share their password with the developer, which is good for security.

If you've never used OAuth 1.0a before it can be a little intimidating, but don't worry because this guide will walk you through each step. You'll learn to do the following:

  1. Generate a request token
  2. Authorize that request token to get a verifier
  3. Trade the request token and verifier to get an access token and access secret

Step 1: Generating a request token

First, you'll need to tell AWeber's API that someone would like to authorize your integration to access their account. The request token and secret, sometimes called OAuth tokens, are the way to do that. Find your integration's consumer key and consumer secret in your Labs account. It'll be on the right, below the edit button. Do not share these keys with anyone (that includes leaving them in code you post publicly, like a WordPress plugin, JavaScript on your site, or code you make open source)!

step01

Once you have those keys you can use your library to make a GET request to https://auth.aweber.com/1.0/oauth/request_token, which is AWeber's request token endpoint.

We also need to specify a callback URL that will allow us to obtain a verifier token. If you don't have a web page to capture the verifier you can use oob instead, which will just display the token to the user after they sign in successfully. The oob stands for out of band, which just means you're working outside of a web browser.

Below is an example using requests_oauthlib.

from requests_oauthlib import OAuth1Session, OAuth1
# Replace with your real keys
consumer_key = '****'
consumer_secret = '****'

request_token_url = 'https://auth.aweber.com/1.0/oauth/request_token'
oauth = OAuth1Session(consumer_key, consumer_secret, callback_uri='oob')
fetch_response = oauth.fetch_request_token(request_token_url)

request_token = fetch_response.get('oauth_token')
request_secret = fetch_response.get('oauth_token_secret')

The response will contain your request token and secret that will be used in the next steps.

Step 2: Authorizing the request token

Once the request token and secret are obtained the next step is getting permission from the user to access their account. To do this, you'll ask the user to go to https://auth.aweber.com/1.0/oauth/authorize?oauth_token=XXX, where XXX is the request token you obtained in step 1.

That URL is a special web page that shows a login box. If you're authorizing your own AWeber account be sure to put your customer account information in there and not your developer account information. They are two separate logins. If you're authorizing someone else's account you'll need to send them the link and ask them to log in to allow your integration access.

Note the text on the log in screen will change depending on what permissions you have enabled.

step02a

Once the user successfully enters their AWeber login information AWeber will redirect them to the callback you defined in step 1 and provide a verifier token that you can use for the next step. If that callback was a page on your website the verifier will be in the query string like so:

{your_callback}/?oauth_token=******************&oauth_verifier=******&display=page

If you used oob as your callback as in the example in step 1 the verifier will be shown to the user. This is helpful when you're trying to authorize your own account, though you can instruct the user to copy and paste it somewhere if you like.

step02b

Step 3: Trade for Access Tokens

Now you need to combine the request token and secret and your newly obtained verifier and trade them for a permanent access token and secret. These are the keys you'll use to access the user's AWeber account.

Note: Protect the access token and access secret like you would your own passwords. They give you access to the account of the AWeber customer who authorized your app and will remain valid until they revoke that access or until you change your consumer key and consumer secret. Store them safely!

To make the trade, just make one final POST request to https://auth.aweber.com/1.0/oauth/access_token, which is AWeber's access token endpoint. The response will contain your access token and access secret and you can make all the API calls you wish!

Here's a requests_oauthlib example, using the same OAuth1Session that was set up in step 1:

access_token_url = 'https://auth.aweber.com/1.0/oauth/access_token'
authkeys = OAuth1(client_key=consumer_key,
                  client_secret=consumer_secret,
                  resource_owner_key=oauth_token,
                  resource_owner_secret=oauth_secret,
                  verifier=oauth_verifier)

access_response = oauth.fetch_access_token(access_token_url,
                                           verifier=oauth_verifier,
                                           auth=authkeys)

access_token = access_response.get('oauth_token')
access_secret = access_response.get('oauth_token_secret')

Use your access tokens in combination with your consumer key and consumer secret to make API calls! You might want to get your account ID first. Your new access tokens will never expire, but they can be revoked from the AWeber customer's side by hitting the “disable” button in their account or you can revoke all of them at once by changing your consumer key.

Have more than one user?

Sometimes an integration is used by many AWeber customers. You can have as many users as you like with this authentication process. Just start at the top and make a new request token for each user of your integration. Access tokens are tied to AWeber customer accounts so each account will have a new set of tokens. You can store them safely in a database and use the account ID to differentiate them.

Having trouble?

Never fear! We're always ready to help you. Send an email to api@aweber.com and let us know where you're getting stuck.

There are a few common problems you can check for as well:

  • For OAuth 1.0a authentication like this, make sure to use the consumer key listed in your developer account.
  • The OAuth1.0a described here does not require an authorization code.
  • Make sure the AWeber account login information is valid by trying to log into AWeber. If you cannot log in there, try resetting your password.
  • Make sure you're not using your developer account login for the authorize login page.
  • Make sure your consumer key and consumer secret are correctly typed or copy/pasted when you get request tokens.
  • Check the documentation for your HTTP library and make sure it supports OAuth 1.0a. Many libraries have walkthroughs of the workflow in their documentation as well.

OAuth1 Example

The following examples show how to obtain access tokens for an AWeber account using Python. For a PHP version please see our PHP code sample on GitHub.

Get An Access Token

Below is a python example using the requests_oauthlib OAuth library to obtain an accounts access tokens.

You will need the consumer key and consumer secret from your application, available on the My Apps Page as well as the username and password for an AWeber account you want to connect.

import pprint

from requests_oauthlib import OAuth1Session

request_token_url = 'https://auth.aweber.com/1.0/oauth/request_token'
access_token_url = 'https://auth.aweber.com/1.0/oauth/access_token'
authorize_url = 'https://auth.aweber.com/1.0/oauth/authorize'
api_url = 'https://api.aweber.com/1.0/accounts'

# Replace with your real keys
consumer_key = '****'
consumer_secret = '****'

oauth1_session = OAuth1Session(consumer_key,
                               client_secret=consumer_secret,
                               callback_uri='http://localhost')

oauth1_session.fetch_request_token(request_token_url)
href = oauth.authorization_url(authorize_url)
full_url = input('Go to this url: {}\n'
                 'Login and paste the returned full url here: '.format(href))

oauth1_session.parse_authorization_response(full_url)
print(oauth1_session.fetch_access_token(access_token_url))

response = oauth1_session.get(api_url,
                              headers={'Content-Type': 'application/json'})
pprint.pprint(response.json())

Now you should have your access tokens and account id from the output. The last call in the example is to retrieve the /accounts resource in order to retrieve the account id. The account id, consumer key, consumer secret, access token and access secret are needed for every api call.

Distributing the application's source code?

If you are making the source code of your integration public, you may not have a means to distribute the consumer key and consumer secret securely. In this case, we allow another method for authentication which uses the application id only.

Below is an example on how to authenticate using this method, keep in mind this creates new consumer keys for each access token and access secret that you will have to manage separate from the consumer key and consumer secret found in the My Apps Page.

The main difference here is that the authorize_url is not the same and returns a different payload. This method does not support a callback_url and requires that the AWeber account holder copy and paste the output.

import pprint
from urllib import parse

import requests
from requests_oauthlib import OAuth1

app_id = '****'
access_token_url = 'https://auth.aweber.com/1.0/oauth/access_token'
authorize_url = 'https://auth.aweber.com/1.0/oauth/authorize_app/{}'.format(app_id)
api_url = 'https://api.aweber.com/1.0/accounts'

authorization_code = input(
    'Go to this url: {}\n'
    'Login and paste the returned full url here: '.format(authorize_url))
(consumer_key, consumer_secret,
 request_token, request_token_secret,
 verifier, _) = authorization_code.split('|')
auth = OAuth1(consumer_key,
                        client_secret=consumer_secret,
                        resource_owner_key=request_token,
                        resource_owner_secret=request_token_secret,
                        verifier=verifier)
response = requests.post(access_token_url, auth=auth)
keys = parse.parse_qs(response.content.decode('utf-8'))
auth = OAuth1(consumer_key,
                        client_secret=consumer_secret,
                        resource_owner_key=keys['oauth_token'][0],
                        resource_owner_secret=keys['oauth_token_secret'][0])
response = requests.get(api_url,
                        auth=auth,
                        headers={'Content-Type': 'application/json'})
print('consumer_key = "{}"\nconsumer_secret = "{}"\n'
      'access_token = "{}"\naccess_secret = "{}"'.format(
      auth.client.client_key,
      auth.client.client_secret,
      auth.client.resource_owner_key,
      auth.client.resource_owner_secret))
pprint.pprint(response.json())

OAuth1 Reference

These endpoints are used to authenticate with the api. The AWeber API uses the OAuth 1.0 model to handle authentication. OAuth is a standardized way for services to grant permission on a user's behalf to another application, without exposing their credentials (ie - username and password).

Each request made by your application also includes a request signature, which will require 7 mandatory parameters:

  • oauth_consumer_key: This is the consumer key assigned to your application.
  • oauth_nonce: A unique, randomly generated string. Each request should have a unique nonce.
  • oauth_timestamp: Timestamp for the request. This is in the format of a Unix timestamp, or seconds since January 1st, 1970.
  • oauth_signature_method: The hashing algorithm that was used to generate the signature. AWeber only supports the HMAC-SHA1 hash, so that's what this parameter should always be.
  • oauth_version: This identifies which version of the OAuth protocol you are using, and should always be 1.0 when working with the AWeber API.
  • oauth_token: This is the token that represents the user of the application. This will be either the request token, when in the process of gaining an access token, or the access token when making requests to the AWeber API. The oauth_token parameter will be blank when you are getting a request token for a new user.
  • oauth_signature: This is an HMAC-SHA1 hash of the entire request, including the application's secret, and the customer's oauth_token_secret. Generating the signature is a complex process, and we highly recommend using an OAuth library that will handle this for you.

Please use an OAuth1 library to generate the request signature.

Get a request token

post /oauth/request_token
//oauth/request_token

This endpoint is used to get a request token.

Request Body schema: application/x-www-form-urlencoded
oauth_consumer_key
string

The consumer key assigned to your application, available on the My Apps Page

oauth_callback
string

A url that will be sent the verifier token when authorizing the request token in a future step. If you don't have a callback, use oob as the value, this will indicate that the callback is 'out of band' and will display an html page after authorization, containing the verifier token.

oauth_nonce
string

A unique, randomly generated string. Each request should have a unique nonce.

oauth_signature
string

This is an HMAC-SHA1 hash of the entire request, including the application's secret, and the customer's oauth_token_secret. Generating the signature is a complex process, and we highly recommend using an OAuth library that will handle this for you.

oauth_signature_method
string

The hashing algorithm that was used to generate the signature. AWeber only supports the HMAC-SHA1 hash, so that's what this parameter should always be.

oauth_timestamp
string

Timestamp for the request. This is in the format of a Unix timestamp, or seconds since January 1st, 1970.

oauth_token
string

This is the token that represents the user of the application. This will be either the request token, when in the process of gaining an access token, or the access token when making requests to the AWeber API. The oauth_token parameter will be blank when you are getting a request token for a new user.

oauth_version
string

This identifies which version of the OAuth protocol you are using, and should always be 1.0 when working with the AWeber API.

Responses

200

The request completed successfully

400

The server cannot or will not process the request due to a client error

401

The request could not be completed due to an authentication error

500

The request failed due to an internal error in the code or because of an external dependency failure

503

The server is currently unavailable

Response samples

application/json
Copy
Expand all Collapse all
"oauth_token_secret=******************&oauth_token=******************&oauth_callback_confirmed=true"

Get an access token

post /oauth/access_token
//oauth/access_token

This endpoint is used to get an access token.

Request Body schema: application/x-www-form-urlencoded
oauth_consumer_key
string

The consumer key assigned to your application, available on the My Apps Page

oauth_callback
string

A url that will be sent the verifier token when authorizing the request token in a future step. If you don't have a callback, use oob as the value, this will indicate that the callback is 'out of band' and will display an html page after authorization, containing the verifier token.

oauth_nonce
string

A unique, randomly generated string. Each request should have a unique nonce.

oauth_signature
string

This is an HMAC-SHA1 hash of the entire request, including the application's secret, and the customer's oauth_token_secret. Generating the signature is a complex process, and we highly recommend using an OAuth library that will handle this for you.

oauth_signature_method
string

The hashing algorithm that was used to generate the signature. AWeber only supports the HMAC-SHA1 hash, so that's what this parameter should always be.

oauth_timestamp
string

Timestamp for the request. This is in the format of a Unix timestamp, or seconds since January 1st, 1970.

oauth_token
string

This is the token that represents the user of the application. This will be either the request token, when in the process of gaining an access token, or the access token when making requests to the AWeber API. The oauth_token parameter will be blank when you are getting a request token for a new user.

oauth_version
string

This identifies which version of the OAuth protocol you are using, and should always be 1.0 when working with the AWeber API.

Responses

200

The request completed successfully

400

The server cannot or will not process the request due to a client error

401

The request could not be completed due to an authentication error

500

The request failed due to an internal error in the code or because of an external dependency failure

503

The server is currently unavailable

Response samples

application/json
Copy
Expand all Collapse all
"oauth_token_secret=******************&oauth_token=******************"

Accounts

What is It?

Represents AWeber Customer Accounts that have authorized your application.

The Account collection contains a single account entry for the AWeber Customer Account that has authorized your application. You can use the links in the Account entry to retrieve the lists owned by the account as well as the social integrations associated with the account.

Get accounts

get /accounts
//accounts

This endpoint is used to get a paginated collection of accounts.

Check out examples for python and php.

query Parameters
ws.start
integer <int32>
Default: 0

The pagination starting offset

ws.size
integer <int32> <= 100
Default: 100

The pagination total entries to retrieve

Responses

200

The request completed successfully

400

The server cannot or will not process the request due to a client error

401

The request could not be completed due to an authentication error

403

The request could not be completed due to a rate limit error

500

The request failed due to an internal error in the code or because of an external dependency failure

503

The server is currently unavailable

Request samples

Copy
headers = {'Accept': 'application/json',
           'User-Agent': 'AWeber-Python-code-sample/1.0'}
url = 'https://api.aweber.com/1.0/accounts'
response = oauth1_session.get(url, headers=headers)
print(response.json())

Response samples

application/json
Copy
Expand all Collapse all
{}

Get account

get /accounts/{accountId}
//accounts/{accountId}

This endpoint is used to retrieve information for a specific account.

Check out examples for python and php.

path Parameters
accountId
required
integer <int32>

The account ID

Responses

200

The request completed successfully

400

The server cannot or will not process the request due to a client error

401

The request could not be completed due to an authentication error

403

The request could not be completed due to a rate limit error

404

The requested resource could not be found

500

The request failed due to an internal error in the code or because of an external dependency failure

503

The server is currently unavailable

Request samples

Copy
headers = {'Accept': 'application/json',
           'User-Agent': 'AWeber-Python-code-sample/1.0'}
url = f'https://api.aweber.com/1.0/accounts/{account_id}'
response = oauth1_session.get(url, headers=headers)
print(response.json())

Response samples

application/json
Copy
Expand all Collapse all
{}

Broadcasts

What is It?

Represents broadcast messages associated with a specific list.

Use this set of resources to create, retrieve, modify, schedule, and delete broadcast messages on a list.

The broadcast collection is paginated in pages of 100 items by default and sorted based on the message status. Each response page includes next_collection_link and prev_collection_link properties to traverse the collection. See How Collections are Represented for traversal details and the following table for sorting.

Status Sort attribute
draft broadcast_id
scheduled scheduled_for
sent sent_at

Get broadcasts

get /accounts/{accountId}/lists/{listId}/broadcasts
//accounts/{accountId}/lists/{listId}/broadcasts

This endpoint is used to get a paginated collection of broadcasts under the specified account and list. The sort order is dependent on the requested status.

  • draft messages are sorted by broadcast_id
  • scheduled messages are sorted by scheduled_for
  • sent messages are sorted by sent_at

Check out related examples:

path Parameters
accountId
required
integer <int32>

The account ID

listId
required
integer <int32>

The list ID

query Parameters
status
required
string
Enum:"draft" "scheduled" "sent"

The status of the broadcasts to retrieve.

ws.start
integer <int32>
Default: 0

The pagination starting offset

ws.size
integer <int32> <= 100
Default: 100

The pagination total entries to retrieve

Responses

200

The request completed successfully

400

The server cannot or will not process the request due to a client error

401

The request could not be completed due to an authentication error

403

The request could not be completed due to a rate limit error

404

The requested resource could not be found

500

The request failed due to an internal error in the code or because of an external dependency failure

503

The server is currently unavailable

Request samples

Copy
headers = {'Accept': 'application/json',
           'User-Agent': 'AWeber-Python-code-sample/1.0'}
url = (f'https://api.aweber.com/1.0/accounts/{account_id}'
       f'/lists/{list_id}/broadcasts')
response = oauth1_session.get(url, headers=headers)
print(response.json())

Response samples

application/json

Create broadcast

post /accounts/{accountId}/lists/{listId}/broadcasts
//accounts/{accountId}/lists/{listId}/broadcasts

This endpoint is used to create a broadcast message. This POST request is limited to 1 million bytes.

Check out related examples:

path Parameters
accountId
required
integer <int32>

The account ID

listId
required
integer <int32>

The list ID

Request Body schema: application/x-www-form-urlencoded
body_html
required
string <html>

The content of the message in html format. If body_text is not provided, it will be auto-generated. If body_text is not provided, body_html must be provided.

body_text
required
string

The content of the message in plain text, used when HTML is not supported. If body_html is not provided, the broadcast will be sent using only the body_text. If body_text is not provided, body_html must be provided.

click_tracking_enabled
boolean
Default: true

Enables links in the email message to be tracked

exclude_lists
Array of string <uri>
Default: []

List of Lists URLs to exclude in the delivery of this broadcast.
Use the self_link of the list here - e.g. https://api.aweber.com/1.0/accounts/<account_id>/lists/<list_id>

facebook_integration
string <uri>

URL to the Facebook broadcast integration to use for this broadcast. When the broadcast is sent, the subject of the broadcast will be posted to this Facebook integration - e.g., https://api.aweber.com/1.0/accounts/<account_id>/integrations/<integration_id>

include_lists
Array of string <uri>
Default: []

List of Lists URLs to include in the delivery of this broadcast.
Use the self_link of the list here - e.g. https://api.aweber.com/1.0/accounts/<account_id>/lists/<list_id>

is_archived
boolean
Default: true

Whether the broadcast enabled sharing via an archive url

notify_on_send
boolean
Default: true

If true, notify when stats are available on a sent broadcast message

subject
required
string <= 120

The broadcast subject line. Subject must not be empty nor contain only whitespace.

twitter_integration
string <uri>

URL to the Twitter broadcast integration to use for this broadcast. When the broadcast is sent, the subject of the broadcast will be tweeted - e.g., https://api.aweber.com/1.0/accounts/<account_id>/integrations/<integration_id>

Responses

200

The request completed successfully

400

The server cannot or will not process the request due to a client error

401

The request could not be completed due to an authentication error

403

Forbidden due to rate limit or missing Manage Email permission

404

The requested resource could not be found

415

The enclosed body has a media type that is not application/x-www-form-urlencoded

500

The request failed due to an internal error in the code or because of an external dependency failure

503

The server is currently unavailable

Request samples

Copy
body = {
    'body_html': '<html><h1>title</h1><body>message body.</body></html>',
    'body_text': 'this is the content of my message',
    'click_tracking_enabled': True,
    'exclude_lists': json.dumps([
        'https://api.aweber.com/1.0/accounts/123/lists/456'
    ]),
    'facebook_integration': 'https://api.aweber.com/1.0/accounts/123/integrations/1',
    'include_lists': json.dumps([
        'https://api.aweber.com/1.0/accounts/123/lists/456'
    ]),
    'is_archived': True,
    'notify_on_send': True,
    'subject': 'weekly recipes',
    'twitter_integration': 'https://api.aweber.com/1.0/accounts/123/integrations/2',
}
headers = {'Content-Type': 'application/x-www-form-urlencoded',
           'Accept': 'application/json',
           'User-Agent': 'AWeber-Python-code-sample/1.0'}
url = (f'https://api.aweber.com/1.0/accounts/{account_id}'
       f'/lists/{list_id}/broadcasts')
response = oauth1_session.post(url, headers=headers, data=body)
print(response.json())

Response samples

application/json
Copy
Expand all Collapse all
{}

Get broadcast

get /accounts/{accountId}/lists/{listId}/broadcasts/{broadcastId}
//accounts/{accountId}/lists/{listId}/broadcasts/{broadcastId}

This endpoint is used to retrieve a broadcast message.

Check out related examples:

path Parameters
accountId
required
integer <int32>

The account ID

listId
required
integer <int32>

The list ID

broadcastId
required
integer <int32>

The broadcast ID

Responses

200

The request completed successfully

400

The server cannot or will not process the request due to a client error

401

The request could not be completed due to an authentication error

403

Forbidden due to rate limit or missing Manage Email permission

404

The requested resource could not be found

500

The request failed due to an internal error in the code or because of an external dependency failure

503

The server is currently unavailable

Request samples

Copy
headers = {'Accept': 'application/json',
           'User-Agent': 'AWeber-Python-code-sample/1.0'}
url = (f'https://api.aweber.com/1.0/accounts/{account_id}'
       f'/lists/{list_id}/broadcasts/{broadcast_id}')
response = oauth1_session.get(url, headers=headers)
print(response.json())

Response samples

application/json
Copy
Expand all Collapse all
{}

Update broadcast

put /accounts/{accountId}/lists/{listId}/broadcasts/{broadcastId}
//accounts/{accountId}/lists/{listId}/broadcasts/{broadcastId}

This endpoint is used to replace existing details of a broadcast message in a draft state.

Check out related examples:

path Parameters
accountId
required
integer <int32>

The account ID

listId
required
integer <int32>

The list ID

broadcastId
required
integer <int32>

The broadcast ID

Request Body schema: application/x-www-form-urlencoded
body_html
string <html>

The content of the message in html format. If body_text is not provided, it will be auto-generated.

body_text
string

The content of the message in plain text, used when HTML is not supported. If body_html is not provided, the broadcast will be sent using only the body_text.

click_tracking_enabled
boolean

Enables links in the email message to be tracked.

facebook_integration
string <uri>

URL to the Facebook broadcast integration to use for this broadcast. When the broadcast is sent, the subject of the broadcast will be posted to this Facebook integration - e.g., https://api.aweber.com/1.0/accounts/<account_id>/integrations/<integration_id>

is_archived
boolean

Whether the broadcast enabled sharing via an archive url.

notify_on_send
boolean

If true, notify when stats are available on a sent broadcast message, defaults to true.

subject
string <= 120

The broadcast subject line. Subject must not be empty nor contain only whitespace.

twitter_integration
string <uri>

URL to the Twitter broadcast integration to use for this broadcast. When the broadcast is sent, the subject of the broadcast will be tweeted - e.g., https://api.aweber.com/1.0/accounts/<account_id>/integrations/<integration_id>

Responses

200

The request completed successfully

400

The server cannot or will not process the request due to a client error

401

The request could not be completed due to an authentication error

403

Forbidden due to rate limit or missing Manage Email permission

404

The requested resource could not be found

415

The enclosed body has a media type that is not application/x-www-form-urlencoded

500

The request failed due to an internal error in the code or because of an external dependency failure

503

The server is currently unavailable

Request samples

Copy
body = {
    'body_html': '<html><h1>title</h1><body>message body.</body></html>',
    'body_text': 'this is the content of my message',
    'click_tracking_enabled': True,
    'facebook_integration': 'https://api.aweber.com/1.0/accounts/123/integrations/1',
    'is_archived': True,
    'notify_on_send': True,
    'subject': 'weekly recipes',
    'twitter_integration': 'https://api.aweber.com/1.0/accounts/123/integrations/2',
}
headers = {'Content-Type': 'application/x-www-form-urlencoded',
           'Accept': 'application/json',
           'User-Agent': 'AWeber-Python-code-sample/1.0'}
url = (f'https://api.aweber.com/1.0/accounts/{account_id}'
       f'/lists/{list_id}/broadcasts/{broadcast_id}')
response = oauth1_session.put(url, headers=headers, data=body)
print(response.json())

Response samples

application/json
Copy
Expand all Collapse all
{}

Delete broadcast

delete /accounts/{accountId}/lists/{listId}/broadcasts/{broadcastId}
//accounts/{accountId}/lists/{listId}/broadcasts/{broadcastId}

This endpoint is used to delete a broadcast message draft.

Check out related examples:

path Parameters