Guides & Tutorials

Action log

GET /api/message/action/log.php

This endpoint can be used to fetch subscriber’s message actions (e.g. sent message, clicks, opt-outs, etc).

Note! Message Action Log contains only actions from the last 30 days.

Request parameters

Note! Either since_seq_id, message_id, or start_at and end_at parameter(s) must be provided.

Parameter Value
since_seq_id Return results only after specified action sequence number.

In order to fetch actions from first, please query actions with value 0.

Default: None
message_id Message ID to get actions for.

Default: None
start_at Actions range start date.

Value has to be an UNIX timestamp and in UTC time.

Default: None
end_at Actions range start date.

Value has to be an UNIX timestamp and in UTC time.

Default: None
limit Number of actions to return with request.

Value is capped at 10000.

Default: 10000
offset Page number.

0 returns actions from 0 to 10000. 1 returns 10001 to 20000 etc. Offset cannot be used when querying actions by since_seq_id.

Default: 0

Response parameters

Response is a JSON list of JSON objects.

Response is ordered by seq_id when requested using since_seq_id or message_id, and by date when requested using start_at and end_at.

Parameter Value
seq_id Action sequence number. Value is a 64-bit unsigned long.
message_id Message ID action applies to. Value is a 64-bit unsigned long.
email Recipient of the message.
campaign_id Campaign or Automation ID for the message.
section_id Campaign's section or Automation's Send Message action ID.
action Action type.

Possible values are - bounce, click, complaint, optout, send and view.
value Action meta information.

Value is a JSON object, and its structure is described in type-specific sections.
created_at Action creation time.

Value is RFC3339 formatted date. For example 2021-04-26T10:01:23.456+03:00

Value structure for bounce action

Parameter Value
smtp_status_code Normalize classification of bounce. Represented as a numeric value. Common response codes

Value structure for click action

Parameter Value
url Non-rendered URL of visited link.

Value structure for view action

Parameter Value
ip IP-address of images loader.
os Operating system of images loader.
client Email client of images loader.
country ISO alpha-2 code of images loader.

Examples

Get actions since sequential ID

$ curl -X GET -u "${USERNAME}:${PASSWORD}" \
  "https://${SUBDOMAIN}.sendsmaily.net/api/message/action/log.php?since_seq_id=1"

(JavaScript/JSON)

[
  {
    "seq_id": 2,
    "message_id": 140737488355328,
    "email": "recipient@domain.tld",
    "campaign_id": 1,
    "section_id": 0,
    "action": "send",
    "value": {},
    "created_at": "2021-04-26T10:01:26.456+03:00"
  },
  {
    "seq_id": 3,
    "message_id": 213737488355328,
    "email": "recipient@domain.tld",
    "campaign_id": 1,
    "section_id": 1619440303,
    "action": "bounce",
    "value": {
      "smtp_status_code": 511
    },
    "created_at": "2021-04-26T10:01:23.456+03:00"
  },
  {
    "seq_id": 4,
    "message_id": 140737488355328,
    "email": "support@smaily.com",
    "campaign_id": 1,
    "section_id": 1619440303,
    "action": "click",
    "value": {
      "url": "https://smaily.com"
    },
    "created_at": "2021-04-26T10:01:35.678+03:00"
  },
  {
    "seq_id": 5,
    "message_id": 140737488355328,
    "email": "support@smaily.com",
    "campaign_id": 1,
    "section_id": 1619440303,
    "action": "view",
    "value": {
      "ip": "127.0.0.1",
      "os": "iOS",
      "client": "Mobile Safari",
      "country": "EE"
    },
    "created_at": "2021-04-26T10:01:35.678+03:00"
  }
]

Get actions in time range

$ curl -X GET -u "${USERNAME}:${PASSWORD}" \
  "https://${SUBDOMAIN}.sendsmaily.net/api/message/action/log.php?start_at=1619420400&end_at=1619424000"

(JavaScript/JSON)

[ 
  {
    "seq_id": 3,
    "message_id": 213737488355328,
    "email": "recipient@domain.tld",
    "campaign_id": 1,
    "section_id": 1619440303,
    "action": "bounce",
    "value": {
      "smtp_status_code": 511
    },
    "created_at": "2021-04-26T10:01:23.456+03:00"
  },
  {
    "seq_id": 2,
    "message_id": 140737488355328,
    "email": "recipient@domain.tld",
    "campaign_id": 1,
    "section_id": 0,
    "action": "send",
    "value": {},
    "created_at": "2021-04-26T10:01:26.456+03:00"
  }
]

Get actions of a message

$ curl -X GET -u "${USERNAME}:${PASSWORD}" \
  "https://${SUBDOMAIN}.sendsmaily.net/api/message/action/log.php?message_id=213737488355328"

(JavaScript/JSON)

[
  {
    "seq_id": 1,
    "message_id": 213737488355328,
    "email": "recipient@domain.tld",
    "campaign_id": 1,
    "section_id": 1619440303,
    "action": "send",
    "value": {},
    "created_at": "2021-04-26T10:00:23.456+03:00"
  },
  {
    "seq_id": 3,
    "message_id": 213737488355328,
    "email": "recipient@domain.tld",
    "campaign_id": 1,
    "section_id": 1619440303,
    "action": "bounce",
    "value": {
      "smtp_status_code": 511
    },
    "created_at": "2021-04-26T10:01:26.456+03:00"
  }
]