A recipient list is a collection of recipients that can be used in a transmission. The Recipient List API provides the means to manage recipient lists. When creating a new transmission using the Transmissions API, the recipients may be submitted "inline" as part of the transmission data, or a stored recipient list id attribute can be specified.
The Recipient List API operates on lists as a whole and does not currently support management of individual recipients.
{
"results": {
"id": "unique_id_4_graduate_students_list",
"name": "graduate_students",
"description": "An email list of graduate students at UMBC",
"attributes": {
"internal_id": 112,
"list_group_id": 12321
},
"total_accepted_recipients": 3,
"recipients": [ ... ]
}
}
Unique alphanumeric ID.
Maximum length: 64 bytes
Recipient list display name.
Maximum length: 64 bytes
Description of the recipient list.
Maximum length: 1024 bytes
An object of arbitrary metadata related to this list. This data is not used by the API. It is only for the user.
Array of recipient objects. See the Recipient Object.
Recipients are described in an array of objects with the following attributes:
{
"address": {
"email": "fred.jones@flintstone.com",
"name": "Grad Student Office"
},
"tags": [
"driver",
"fred",
"flintstone"
],
"metadata": {
"age": "33",
"place": "NY"
},
"substitution_data": {
"favorite_color": "Bright Green",
"job": "Firefighter"
}
}
Address information for a recipient. See the Address Object.
Email address to use for envelope FROM. Overrides transmission level return_path. The domain part of the return_path address must be a CNAME-verified sending domain. The local part of the return_path address will be overwritten by SparkPost.
For Enterprise accounts, the return_path may be any valid email address and the localpart in the return_path will not be overwritten by SparkPost.
Array of text labels associated with a recipient. Tags are available in Webhook events. Maximum number of tags - 10 per recipient, 100 system wide. Any tags over the limits are ignored.
Key/value pairs associated with a recipient. Metadata is available during events through the Webhooks and is provided to the template engine. Recipient metadata takes precedence over transmission metadata when there are conflicts. The maximum length is 10KB per recipient.
Key/value pairs associated with a recipient that are provided to the template engine. Recipient substitution data takes precedence over transmission substitution data. Unlike metadata, substitution data is not included in Webhook events. The maximum length is 100KB per recipient.
If the address
attribute is a string, it is interpreted as the email address. If it is an object, it is described with the following attributes:
Valid email address
Name attached to the email address
Email address to display in the To
header instead of address.email (for CC and BCC)
Constructing Headers using the Address Attributes
The address.email attribute is used as the envelope RCPT TO value.
If the address attribute is specified as a string instead of an address object, the address string is used as the envelope RCPT TO value.
The address.name attribute, in conjuction with the address.email attribute, is used to construct the
content To
header.
To: "address.name" <address.email>
If the address.name attribute is not specified, the To
header uses the address.email attribute in contructing the header.
To: address.email
If the address is specified as a string instead of an address object, the To
header is constructed using the address string.
To: address
If the address.header_to attribute is specified, then the To
header uses
the address.header_to attribute in constructing the header.
address.header_to can be used to BCC (blind carbon copy) recipients,
by hiding the envelope RCPT TO address and replacing it
with an alternative address in the To
header.
To: address.header_to
or:
To: "address.name" <address.header_to>
The To
header is only constructed for messages built from email part content. The To
header is not built for email_rfc822 content.
POST /api/v1/recipient-lists?num_rcpt_errors=3
{
"id": "unique_id_4_graduate_students_list",
"name": "graduate_students",
"description": "An email list of graduate students at UMBC",
"attributes": {
"internal_id": 112,
"list_group_id": 12321
},
"recipients": [
{
"address": {
"email": "wilmaflin@yahoo.com",
"name": "Wilma"
},
"tags": [
"greeting",
"prehistoric",
"fred",
"flintstone"
],
"metadata": {
"age": "24",
"place": "Bedrock"
},
"substitution_data": {
"favorite_color": "SparkPost Orange",
"job": "Software Engineer"
}
},
{
"address": {
"email": "abc@flintstone.com",
"name": "ABC"
},
"tags": [
"driver",
"flintstone"
],
"metadata": {
"age": "52",
"place": "MD"
},
"substitution_data": {
"favorite_color": "Sky Blue",
"job": "Driver"
}
},
{
"address": {
"email": "fred.jones@flintstone.com",
"name": "Grad Student Office",
"header_to": "grad-student-office@flintstone.com"
},
"tags": [
"driver",
"fred",
"flintstone"
],
"metadata": {
"age": "33",
"place": "NY"
},
"substitution_data": {
"favorite_color": "Bright Green",
"job": "Firefighter"
}
}
]
}
{
"results": {
"total_rejected_recipients": 0,
"total_accepted_recipients": 3,
"id": "unique_id_4_graduate_students_list",
"name": "graduate_students"
}
}
Maximum number of recipient errors that this call can return, otherwise all validation errors are returned.
Unique alphanumeric ID. If an id is not specified, one is generated.
Maximum length: 64 bytes
Recipient list display name. If a name is not specified, it defaults to the same value as id.
Maximum length: 64 bytes
Description of the recipient list.
Maximum length: 1024 bytes
An object of arbitrary metadata related to this list.
Array of recipient objects. See the Recipient Object.
At a minimum, the recipients
array is required, which must contain a valid address. Use the num_rcpt_errors
parameter to limit the number of recipient errors
returned.
GET /api/v1/recipient-lists/unique_id_4_graduate_students?show_recipients=true
{
"results": {
"id": "unique_id_4_graduate_students_list",
"name": "graduate_students",
"description": "An email list of graduate students at UMBC",
"attributes": {
"internal_id": 112,
"list_group_id": 12321
},
"total_accepted_recipients": 3,
"recipients": [
{
"address": {
"email": "wilmaflin@yahoo.com",
"name": "Wilma"
},
"tags": [
"greeting",
"prehistoric",
"fred",
"flintstone"
],
"metadata": {
"age": "24",
"place": "Bedrock"
},
"substitution_data": {
"favorite_color": "SparkPost Orange",
"job": "Software Engineer"
}
},
{
"address": {
"email": "abc@flintstone.com",
"name": "ABC"
},
"tags": [
"driver",
"flintstone"
],
"metadata": {
"age": "52",
"place": "MD"
},
"substitution_data": {
"favorite_color": "Sky Blue",
"job": "Driver"
}
},
{
"address": {
"email": "fred.jones@flintstone.com",
"name": "Grad Student Office",
"header_to": "grad-student-office@flintstone.com"
},
"tags": [
"driver",
"fred",
"flintstone"
],
"metadata": {
"age": "33",
"place": "NY"
},
"substitution_data": {
"favorite_color": "Bright Green",
"job": "Firefighter"
}
}
]
}
}
Case sensitive.
If true, return all the recipients contained in the list.
Retrieve details about a specified recipient list by specifying its id in the URI path. To
retrieve the recipients contained in a list, the list must be specified and the show_recipients
parameter must be set to true.
PUT /api/v1/recipient-lists/unique_id_4_graduate_students_list?num_rcpt_errors=3
{
"name": "updated_graduate_students",
"description": "An email list of graduate students at UMBC",
"attributes": {
"internal_id": 112,
"list_group_id": 12321
},
"recipients": [
{
"address": {
"email": "wilmaflin@yahoo.com",
"name": "Wilma"
},
"tags": [
"greeting",
"prehistoric",
"fred",
"flintstone"
],
"metadata": {
"age": "24",
"place": "Bedrock"
},
"substitution_data": {
"favorite_color": "SparkPost Orange",
"job": "Software Engineer"
}
},
{
"address": {
"email": "abc@flintstone.com",
"name": "ABC"
},
"tags": [
"driver",
"flintstone"
],
"metadata": {
"age": "52",
"place": "MD"
},
"substitution_data": {
"favorite_color": "Sky Blue",
"job": "Driver"
}
}
]
}
{
"results": {
"total_rejected_recipients": 0,
"total_accepted_recipients": 2,
"id": "unique_id_4_graduate_students_list",
"name": "updated_graduate_students"
}
}
Case sensitive.
Maximum number of recipient errors that this call can return, otherwise all validation errors are returned.
If a recipients
array is provided in the update request, it will replace the current recipients. This means that if you're adding, updating, or removing a single recipient, the recipients
array must contain all current recipients, regardless they are being changed or not.
Recipient list display name.
Maximum length: 64 bytes
Description of the recipient list.
Maximum length: 1024 bytes
An object of arbitrary metadata related to this list. Specifying this will completely replace the current value.
Array of recipient objects. The new recipients will completely replace the existing recipients. See the Recipient Object.
If a transmission using the recipient list has a state
of "submitted" or "generating", the list cannot be updated. Also, if the transmission is scheduled and is within 10 minutes of the scheduled time, the list won't be updatable.
Returns the recipient list's name
and id
. If the recipients
array was updated, it includes the number of accepted and rejected recipients.
DELETE /api/v1/recipient-lists/unique_id_4_graduate_students_list
{}
Case sensitive.
If a transmission contains a recipient list, the recipient list cannot be deleted if the transmission is submitted or generating.
GET /api/v1/recipient-lists
{
"results": [
{
"id": "unique_id_4_graduate_students_list",
"name": "graduate_students",
"description": "An email list of graduate students at UMBC",
"attributes": {
"internal_id": 112,
"list_group_id": 12321
},
"total_accepted_recipients": 3
},
{
"id": "unique_id_4_undergraduates",
"name": "undergraduate_students",
"description": "An email list of undergraduate students at UMBC",
"attributes": {
"internal_id": 111,
"list_group_id": 11321
},
"total_accepted_recipients": 8
}
]
}
Returns an array of abbreviated recipient list objects. The recipients for each list are not included in the results. Retrieve a single list to get a list the recipients.