php

Choose Language

Tags Calls

/tags/list.json

Return all of the user-defined tag information

Example Call

<?php try { $mandrill = new Mandrill('YOUR_API_KEY'); $result = $mandrill->tags->getList(); print_r($result); /* Array ( [0] => Array ( [tag] => example-tag [reputation] => 42 [sent] => 42 [hard_bounces] => 42 [soft_bounces] => 42 [rejects] => 42 [complaints] => 42 [unsubs] => 42 [opens] => 42 [clicks] => 42 [unique_opens] => 42 [unique_clicks] => 42 ) ) */ } catch(Mandrill_Error $e) { // Mandrill errors are thrown as exceptions echo 'A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage(); // A mandrill error occurred: Mandrill_Invalid_Key - Invalid API key throw $e; } ?>
Parameters
No parameters
Return Value
array a list of user-defined tags
return[] struct a user-defined tag
tag string the actual tag as a string
reputation integer the tag's current reputation on a scale from 0 to 100.
sent integer the total number of messages sent with this tag
hard_bounces integer the total number of hard bounces by messages with this tag
soft_bounces integer the total number of soft bounces by messages with this tag
rejects integer the total number of rejected messages with this tag
complaints integer the total number of spam complaints received for messages with this tag
unsubs integer the total number of unsubscribe requests received for messages with this tag
opens integer the total number of times messages with this tag have been opened
clicks integer the total number of times tracked URLs in messages with this tag have been clicked
unique_opens integer the number of unique opens for emails sent with this tag
unique_clicks integer the number of unique clicks for emails sent with this tag
Errors
Invalid_Key The provided API key is not a valid Mandrill API key
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.

/tags/delete.json

Deletes a tag permanently. Deleting a tag removes the tag from any messages that have been sent, and also deletes the tag's stats. There is no way to undo this operation, so use it carefully.

Example Call

<?php try { $mandrill = new Mandrill('YOUR_API_KEY'); $tag = 'example-tag'; $result = $mandrill->tags->delete($tag); print_r($result); /* Array ( [tag] => example-tag [reputation] => 42 [sent] => 42 [hard_bounces] => 42 [soft_bounces] => 42 [rejects] => 42 [complaints] => 42 [unsubs] => 42 [opens] => 42 [clicks] => 42 [unique_opens] => 42 [unique_clicks] => 42 ) */ } catch(Mandrill_Error $e) { // Mandrill errors are thrown as exceptions echo 'A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage(); // A mandrill error occurred: Mandrill_Invalid_Key - Invalid API key throw $e; } ?>
Parameters
tag* string a tag name
Return Value
struct the tag that was deleted
tag string the actual tag as a string
reputation integer the tag's current reputation on a scale from 0 to 100.
sent integer the total number of messages sent with this tag
hard_bounces integer the total number of hard bounces by messages with this tag
soft_bounces integer the total number of soft bounces by messages with this tag
rejects integer the total number of rejected messages with this tag
complaints integer the total number of spam complaints received for messages with this tag
unsubs integer the total number of unsubscribe requests received for messages with this tag
opens integer the total number of times messages with this tag have been opened
clicks integer the total number of times tracked URLs in messages with this tag have been clicked
unique_opens integer the number of unique opens for emails sent with this tag
unique_clicks integer the number of unique clicks for emails sent with this tag
Errors
Invalid_Tag_Name The requested tag does not exist or contains invalid characters
Invalid_Key The provided API key is not a valid Mandrill API key
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.

/tags/info.json

Return more detailed information about a single tag, including aggregates of recent stats

Example Call

<?php try { $mandrill = new Mandrill('YOUR_API_KEY'); $tag = 'example-tag'; $result = $mandrill->tags->info($tag); print_r($result); /* Array ( [tag] => example-tag [sent] => 42 [hard_bounces] => 42 [soft_bounces] => 42 [rejects] => 42 [complaints] => 42 [unsubs] => 42 [opens] => 42 [clicks] => 42 [stats] => Array ( [today] => Array ( [sent] => 42 [hard_bounces] => 42 [soft_bounces] => 42 [rejects] => 42 [complaints] => 42 [unsubs] => 42 [opens] => 42 [unique_opens] => 42 [clicks] => 42 [unique_clicks] => 42 ) [last_7_days] => Array ( [sent] => 42 [hard_bounces] => 42 [soft_bounces] => 42 [rejects] => 42 [complaints] => 42 [unsubs] => 42 [opens] => 42 [unique_opens] => 42 [clicks] => 42 [unique_clicks] => 42 ) [last_30_days] => Array ( [sent] => 42 [hard_bounces] => 42 [soft_bounces] => 42 [rejects] => 42 [complaints] => 42 [unsubs] => 42 [opens] => 42 [unique_opens] => 42 [clicks] => 42 [unique_clicks] => 42 ) [last_60_days] => Array ( [sent] => 42 [hard_bounces] => 42 [soft_bounces] => 42 [rejects] => 42 [complaints] => 42 [unsubs] => 42 [opens] => 42 [unique_opens] => 42 [clicks] => 42 [unique_clicks] => 42 ) [last_90_days] => Array ( [sent] => 42 [hard_bounces] => 42 [soft_bounces] => 42 [rejects] => 42 [complaints] => 42 [unsubs] => 42 [opens] => 42 [unique_opens] => 42 [clicks] => 42 [unique_clicks] => 42 ) ) ) */ } catch(Mandrill_Error $e) { // Mandrill errors are thrown as exceptions echo 'A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage(); // A mandrill error occurred: Mandrill_Invalid_Key - Invalid API key throw $e; } ?>
Parameters
tag* string an existing tag name
Validation: required
Return Value
struct the detailed information on the tag
tag string the actual tag as a string
sent integer the total number of messages sent with this tag
hard_bounces integer the total number of hard bounces by messages with this tag
soft_bounces integer the total number of soft bounces by messages with this tag
rejects integer the total number of rejected messages with this tag
complaints integer the total number of spam complaints received for messages with this tag
unsubs integer the total number of unsubscribe requests received for messages with this tag
opens integer the total number of times messages with this tag have been opened
clicks integer the total number of times tracked URLs in messages with this tag have been clicked
stats struct an aggregate summary of the tag's sending stats
today struct stats with this tag so far today
sent integer the number of emails sent with this tag so far today
hard_bounces integer the number of emails hard bounced with this tag so far today
soft_bounces integer the number of emails soft bounced with this tag so far today
rejects integer the number of emails rejected for sending this tag so far today
complaints integer the number of spam complaints with this tag so far today
unsubs integer the number of unsubscribes with this tag so far today
opens integer the number of times emails have been opened with this tag so far today
unique_opens integer the number of unique opens for emails sent with this tag so far today
clicks integer the number of URLs that have been clicked with this tag so far today
unique_clicks integer the number of unique clicks for emails sent with this tag so far today
last_7_days struct stats with this tag in the last 7 days
sent integer the number of emails sent with this tag in the last 7 days
hard_bounces integer the number of emails hard bounced with this tag in the last 7 days
soft_bounces integer the number of emails soft bounced with this tag in the last 7 days
rejects integer the number of emails rejected for sending this tag in the last 7 days
complaints integer the number of spam complaints with this tag in the last 7 days
unsubs integer the number of unsubscribes with this tag in the last 7 days
opens integer the number of times emails have been opened with this tag in the last 7 days
unique_opens integer the number of unique opens for emails sent with this tag in the last 7 days
clicks integer the number of URLs that have been clicked with this tag in the last 7 days
unique_clicks integer the number of unique clicks for emails sent with this tag in the last 7 days
last_30_days struct stats with this tag in the last 30 days
sent integer the number of emails sent with this tag in the last 30 days
hard_bounces integer the number of emails hard bounced with this tag in the last 30 days
soft_bounces integer the number of emails soft bounced with this tag in the last 30 days
rejects integer the number of emails rejected for sending this tag in the last 30 days
complaints integer the number of spam complaints with this tag in the last 30 days
unsubs integer the number of unsubscribes with this tag in the last 30 days
opens integer the number of times emails have been opened with this tag in the last 30 days
unique_opens integer the number of unique opens for emails sent with this tag in the last 30 days
clicks integer the number of URLs that have been clicked with this tag in the last 30 days
unique_clicks integer the number of unique clicks for emails sent with this tag in the last 30 days
last_60_days struct stats with this tag in the last 60 days
sent integer the number of emails sent with this tag in the last 60 days
hard_bounces integer the number of emails hard bounced with this tag in the last 60 days
soft_bounces integer the number of emails soft bounced with this tag in the last 60 days
rejects integer the number of emails rejected for sending this tag in the last 60 days
complaints integer the number of spam complaints with this tag in the last 60 days
unsubs integer the number of unsubscribes with this tag in the last 60 days
opens integer the number of times emails have been opened with this tag in the last 60 days
unique_opens integer the number of unique opens for emails sent with this tag in the last 60 days
clicks integer the number of URLs that have been clicked with this tag in the last 60 days
unique_clicks integer the number of unique clicks for emails sent with this tag in the last 60 days
last_90_days struct stats with this tag in the last 90 days
sent integer the number of emails sent with this tag in the last 90 days
hard_bounces integer the number of emails hard bounced with this tag in the last 90 days
soft_bounces integer the number of emails soft bounced with this tag in the last 90 days
rejects integer the number of emails rejected for sending this tag in the last 90 days
complaints integer the number of spam complaints with this tag in the last 90 days
unsubs integer the number of unsubscribes with this tag in the last 90 days
opens integer the number of times emails have been opened with this tag in the last 90 days
unique_opens integer the number of unique opens for emails sent with this tag in the last 90 days
clicks integer the number of URLs that have been clicked with this tag in the last 90 days
unique_clicks integer the number of unique clicks for emails sent with this tag in the last 90 days
Errors
Invalid_Tag_Name The requested tag does not exist or contains invalid characters
Invalid_Key The provided API key is not a valid Mandrill API key
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.

/tags/time-series.json

Return the recent history (hourly stats for the last 30 days) for a tag

Example Call

<?php try { $mandrill = new Mandrill('YOUR_API_KEY'); $tag = 'example-tag'; $result = $mandrill->tags->timeSeries($tag); print_r($result); /* Array ( [0] => Array ( [time] => 2013-01-01 15:00:00 [sent] => 42 [hard_bounces] => 42 [soft_bounces] => 42 [rejects] => 42 [complaints] => 42 [unsubs] => 42 [opens] => 42 [unique_opens] => 42 [clicks] => 42 [unique_clicks] => 42 ) ) */ } catch(Mandrill_Error $e) { // Mandrill errors are thrown as exceptions echo 'A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage(); // A mandrill error occurred: Mandrill_Invalid_Key - Invalid API key throw $e; } ?>
Parameters
tag* string an existing tag name
Return Value
array the array of history information
return[] struct the stats for a single hour
time string the hour as a UTC date string in YYYY-MM-DD HH:MM:SS format
sent integer the number of emails that were sent during the hour
hard_bounces integer the number of emails that hard bounced during the hour
soft_bounces integer the number of emails that soft bounced during the hour
rejects integer the number of emails that were rejected during the hour
complaints integer the number of spam complaints received during the hour
unsubs integer the number of unsubscribes received during the hour
opens integer the number of emails opened during the hour
unique_opens integer the number of unique opens generated by messages sent during the hour
clicks integer the number of tracked URLs clicked during the hour
unique_clicks integer the number of unique clicks generated by messages sent during the hour
Errors
Invalid_Tag_Name The requested tag does not exist or contains invalid characters
Invalid_Key The provided API key is not a valid Mandrill API key
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.

/tags/all-time-series.json

Return the recent history (hourly stats for the last 30 days) for all tags

Example Call

<?php try { $mandrill = new Mandrill('YOUR_API_KEY'); $result = $mandrill->tags->allTimeSeries(); print_r($result); /* Array ( [0] => Array ( [time] => 2013-01-01 15:00:00 [sent] => 42 [hard_bounces] => 42 [soft_bounces] => 42 [rejects] => 42 [complaints] => 42 [unsubs] => 42 [opens] => 42 [unique_opens] => 42 [clicks] => 42 [unique_clicks] => 42 ) ) */ } catch(Mandrill_Error $e) { // Mandrill errors are thrown as exceptions echo 'A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage(); // A mandrill error occurred: Mandrill_Invalid_Key - Invalid API key throw $e; } ?>
Parameters
No parameters
Return Value
array the array of history information
return[] struct the stats for a single hour
time string the hour as a UTC date string in YYYY-MM-DD HH:MM:SS format
sent integer the number of emails that were sent during the hour
hard_bounces integer the number of emails that hard bounced during the hour
soft_bounces integer the number of emails that soft bounced during the hour
rejects integer the number of emails that were rejected during the hour
complaints integer the number of spam complaints received during the hour
unsubs integer the number of unsubscribes received during the hour
opens integer the number of emails opened during the hour
unique_opens integer the number of unique opens generated by messages sent during the hour
clicks integer the number of tracked URLs clicked during the hour
unique_clicks integer the number of unique clicks generated by messages sent during the hour
Errors
Invalid_Key The provided API key is not a valid Mandrill API key
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.