« Back to Documentation Overview

get_message_stats

Section: Messages
Version: 1.5.0


Get message statistics.

    Conditions:
  • message (mandatory) – MESSAGE_ID.
  • grouping (optional) – Determines period of time by which stats are aggregated. Allowed values are: hourly (result keys in "YYYY-MM-DD HH" format), daily (result keys in "YYYY-MM-DD" format), monthly (result keys in "YYYY-MM" format) and yearly (result keys in "YYYY" format). Default is daily.
  • created_on (optional) – Use time operators to narrow down search results to specific contact creation date. Multiple operators are allowed and logic AND is used so date range can also be expressed.

Hint: It is normal to have stats for given date with sent equals 0 and other values positive because opens, clicks, bounces and complaints take place also during a few days after message was sent.
Warning: Graduation may not be continuous. Given time period is present in result only if it has at least one positive value in it.
Warning: Unique action is always counted in period of time where action first occured. If contact opened message on day A and on day B then only day A will have positive unique_opened.


Parameters
stringAPI_KEY
object
stringmessageMESSAGE_ID
stringgroupingdaily
objectcreated_on
stringOPERATORvalue
Return Value
object2010-01-01
integersent1024
integeropened512
integerunique_opened256
integerclicked128
integerunique_clicked64
integergoals8
integerunique_goals4
integerforwarded2
integerunsubscribes1
integerbounces_user_unknown8
integerbounces_user_recycled1
integerbounces_mailbox_full2
integerbounces_block_contentget_message_stats_bounces_block_content_0_integer
integerbounces_block_timeoutget_message_stats_bounces_block_timeout_0_integer
integerbounces_block_other1
integerbounces_other_soft16
integerbounces_other_hard2
integercomplaints_handled1
integercomplaints_unhandledget_message_stats_complaints_unhandled_0_integer
object2010-01-02
integersentget_message_stats_sent_0_integer
integeropened64
integerunique_opened32
integerclicked16
integerunique_clicked8
integergoals2
integerunique_goalsget_message_stats_unique_goals_0_integer
integerforwardedget_message_stats_forwarded_0_integer
integerunsubscribesget_message_stats_unsubscribes_0_integer
integerbounces_user_unknownget_message_stats_bounces_user_unknown_0_integer
integerbounces_user_recycledget_message_stats_bounces_user_recycled_0_integer
integerbounces_mailbox_full1
integerbounces_block_contentget_message_stats_bounces_block_content_0_integer
integerbounces_block_timeoutget_message_stats_bounces_block_timeout_0_integer
integerbounces_block_otherget_message_stats_bounces_block_other_0_integer
integerbounces_other_soft2
integerbounces_other_hardget_message_stats_bounces_other_hard_0_integer
integercomplaints_handled1
integercomplaints_unhandledget_message_stats_complaints_unhandled_0_integer

Example Request JSON

[
    "API_KEY",
    {
        "message": "MESSAGE_ID",
        "grouping": "daily",
        "created_on": {
            "OPERATOR": "value"
        }
    }
]

Example Response JSON

{
    "2010-01-01": {
        "sent": 1024,
        "opened": 512,
        "unique_opened": 256,
        "clicked": 128,
        "unique_clicked": 64,
        "goals": 8,
        "unique_goals": 4,
        "forwarded": 2,
        "unsubscribes": 1,
        "bounces_user_unknown": 8,
        "bounces_user_recycled": 1,
        "bounces_mailbox_full": 2,
        "bounces_block_content": 0,
        "bounces_block_timeout": 0,
        "bounces_block_other": 1,
        "bounces_other_soft": 16,
        "bounces_other_hard": 2,
        "complaints_handled": 1,
        "complaints_unhandled": 0
    },
    "2010-01-02": {
        "sent": 0,
        "opened": 64,
        "unique_opened": 32,
        "clicked": 16,
        "unique_clicked": 8,
        "goals": 2,
        "unique_goals": 0,
        "forwarded": 0,
        "unsubscribes": 0,
        "bounces_user_unknown": 0,
        "bounces_user_recycled": 0,
        "bounces_mailbox_full": 1,
        "bounces_block_content": 0,
        "bounces_block_timeout": 0,
        "bounces_block_other": 0,
        "bounces_other_soft": 2,
        "bounces_other_hard": 0,
        "complaints_handled": 1,
        "complaints_unhandled": 0
    }
}

Example Error Response JSON

{
    "code": -1,
    "message": "Missing message"
}
Method-specific Errors
Missing message
API-wide Errors
API key verification failed API key verification failed
API client IP not allowed API client IP not allowed
Invalid params Attribute params must be reference to hash