v1.0.0
OpenAPI 3.1.0

Get metrics for a test or translation variant of a newsletter

US region

Client Libraries

Get metrics for a test or translation variant of a newsletter

Returns a metrics for an individual newsletter variant—either an individual language in a multi-language newsletter or a message in an A/B test. This endpoint returns metrics both in total and in steps (days, weeks, etc) over a period of time. Stepped series metrics are arranged from oldest to newest (i.e. the 0-index for any result is the oldest period/step).

You cannot request fewer than 2 steps of any period (2 hours, 2 days, 2 weeks, or 2 months). For instance, ?period=days&steps=1 means two days - the 48 hours before the API request was made. ?period=days&steps=0 returns the same as the maximum of the period - ?period=days&steps=45. See the steps parameter below for the maximum count of each period.

Path Parameters
  • newsletter_id
    Type: integer
    required

    The identifier of a newsletter.

  • content_id
    Type: integer
    required

    The identifier of a message in a newsletter. If your newsletter has an A/B test group or includes multiple languages, each variant has its own content_id, separate from the newsletter_id.

    Use List variants of a newsletter to find the content_id associated with the right variant.

Query Parameters
  • period
    Type: stringenum

    The unit of time for your report.

    values
    • hours
    • days
    • weeks
    • months
  • steps
    Type: integer

    The number of periods you want to return. Defaults to the maximum available, or 12 if the period is in months. Maximums are 24 hours, 45 days, 12 weeks, or 121 months. Days start at 00:00 EST. Weeks start at 00:00 EST on Sunday. Months start at 00:00 EST on the 1st of the month.

  • type
    Type: stringenum

    The type of item you want to return metrics for. When empty, the response contains metrics for all possible types.

    values
    • email
    • webhook
    • twilio
    • push
    • in_app
    • inbox
Responses
  • application/json
  • 404

    The newsletter and/or variant does not exist.

  • 429

    Your request is over the 10-per-second limit.

Request Example for get/v1/newsletters/{newsletter_id}/contents/{content_id}/metrics
curl 'https://api.customer.io/v1/newsletters/1/contents/1/metrics?period=days&steps=1&type=email' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "metric": {
    "type": "email",
    "series": {
      "2xx": [
        1
      ],
      "3xx": [
        1
      ],
      "4xx": [
        1
      ],
      "5xx": [
        1
      ],
      "attempted": [
        1
      ],
      "bounced": [
        1
      ],
      "clicked": [
        1
      ],
      "human_clicked": [
        1
      ],
      "prefetch_clicked": [
        1
      ],
      "converted": [
        1
      ],
      "created": [
        1
      ],
      "deferred": [
        1
      ],
      "delivered": [
        1
      ],
      "drafted": [
        1
      ],
      "failed": [
        1
      ],
      "opened": [
        1
      ],
      "human_opened": [
        1
      ],
      "prefetch_opened": [
        1
      ],
      "sent": [
        1
      ],
      "spammed": [
        1
      ],
      "suppressed": [
        1
      ],
      "undeliverable": [
        1
      ],
      "topic_unsubscribed": [
        1
      ],
      "unsubscribed": [
        1
      ]
    }
  }
}