Maton

Customer.io

Access the Customer.io App API with managed authentication. Look up people, segments, campaigns, broadcasts, transactional messages, and delivery metrics; send transactional messages and trigger broadcasts. All access runs through the Maton gateway and the maton CLI.

Permissions

Suggested read access

In the Console, Read limits the connection to these 127 read-only endpoints, plus deny rules for any write endpoint a broader rule would otherwise match. Endpoints Maton has found to return credentials, start jobs, or spend credits are left out; a few reads that can change state or return a secret depending on their parameters stay in, and their descriptions say how. It is a suggestion: the saved rules are exactly the ones you see, and you can change them with Custom. See Access policy.

Reference

Paths start with v1/: https://api.customer.io/v1/segments becomes /customer-io/v1/segments.

Connect with maton connection create customer-io; the Customer.io connection guide shows where to create the App API key.

Workspaces

maton api '/customer-io/v1/workspaces'

Response:

{
  "workspaces": [
    {"id": 123456, "name": "Acme Production", "messages_sent": 15230, "billable_messages_sent": 15230, "people": 8421}
  ]
}

People

Find People

maton api '/customer-io/v1/customers?email=alex@example.com'
maton api '/customer-io/v1/customers' -X POST -H 'Content-Type: application/json' --input - <<'JSON'
{"filter": {"and": [{"segment": {"id": 7}}, {"attribute": {"field": "plan", "operator": "eq", "value": "pro"}}]}}
JSON

GET v1/customers?email= returns the people with that email (results, each with id, email, and cio_id). The POST is a search and a read: it takes a filter of and, or, and not groups over segment and attribute conditions (operator eq or exists) and returns identifiers and ids, up to limit (default 50, up to 1,000) per page, with next to pass back as start. POST v1/customers/attributes with {"ids": [...]} returns the attributes and devices of up to 100 people at once.

Get a Person

maton api '/customer-io/v1/customers/{customer_id}/attributes'
maton api '/customer-io/v1/customers/{customer_id}/segments'
maton api '/customer-io/v1/customers/{customer_id}/messages?limit=20'
maton api '/customer-io/v1/customers/{customer_id}/activities?limit=20'

{customer_id} is the person's id by default; add id_type=email, id_type=phone, or id_type=cio_id to look them up by email, phone, or cio_id instead (email and phone only when the workspace uses them as identifiers). .../relationships, .../subscription_preferences, and .../optouts return the person's object relationships, subscription preferences, and opt-outs.

Segments

maton api '/customer-io/v1/segments'
maton api '/customer-io/v1/segments/{segment_id}/customer_count'
maton api '/customer-io/v1/segments/{segment_id}/membership?limit=100'

membership returns identifiers and ids with next for the following page. POST v1/segments creates a manual segment ({"segment": {"name": "...", "description": "..."}}); people are added to manual segments through the Track API, which this connection can't reach.

Campaigns, Broadcasts, and Transactional Messages

Campaigns (Automations)

maton api '/customer-io/v1/campaigns'
maton api '/customer-io/v1/campaigns/{campaign_id}/metrics'
maton api '/customer-io/v1/campaigns/{campaign_id}/actions'

metrics returns sends, deliveries, opens, clicks, conversions, bounces, and unsubscribes over time (see the Customer.io documentation for its time-range parameters); .../journey_metrics, .../metrics/links, and per-action .../actions/{action_id}/metrics break them down further.

One-Time Sends and API-Triggered Broadcasts

maton api '/customer-io/v1/newsletters?limit=20'
maton api '/customer-io/v1/newsletters/{newsletter_id}/metrics'
maton api '/customer-io/v1/broadcasts'
maton api '/customer-io/v1/campaigns/{broadcast_id}/triggers' -X POST -H 'Content-Type: application/json' --input - <<'JSON'
{"emails": ["alex@example.com"], "data": {"headline": "Our December update"}}
JSON

The trigger sends the broadcast to the people in emails or ids, to a per_user_data list, to a recipients filter, or, with none of them, to the broadcast's own audience; data fills its Liquid variables. It returns an id to check with GET v1/campaigns/{broadcast_id}/triggers/{trigger_id} (and .../errors). Customer.io accepts one trigger request every 10 seconds across the workspace.

Transactional Messages

maton api '/customer-io/v1/transactional'
maton api '/customer-io/v1/send/email' -X POST -H 'Content-Type: application/json' --input - <<'JSON'
{"transactional_message_id": "3", "to": "alex@example.com", "identifiers": {"email": "alex@example.com"}, "message_data": {"order_id": "A-1001"}}
JSON

transactional_message_id is the template's ID or trigger name from v1/transactional; identifiers takes one of id, email, or cio_id; message_data fills its Liquid variables. The send returns a delivery_id. v1/send/sms, v1/send/push, v1/send/in_app, v1/send/inbox_message, v1/send/web_push, and v1/send/whatsapp work the same way for their channels.

Messages and Activity

maton api '/customer-io/v1/messages?type=email&limit=50'
maton api '/customer-io/v1/messages/{message_id}'
maton api '/customer-io/v1/activities?type=email_sent&limit=50'

Messages are deliveries, filterable by type (email, sms, push, in_app, slack, webhook), metric (sent, delivered, opened, clicked, bounced, failed, and others), campaign_id, newsletter_id, and action_id, with start_ts and end_ts (Unix seconds).

Also Available

  • Design Studio: emails, SMS, WhatsApp templates, components, and folders under v1/design_studio/; POST v1/design_studio/emails/{email_id}/preview renders an email and is a read, while .../publish and .../test_send are writes.
  • Objects and collections: GET v1/object_types, POST v1/objects (a search), v1/objects/{type_id}/{object_id}/attributes; collections under v1/collections.
  • Exports and imports: GET v1/exports; POST v1/exports/customers and v1/exports/deliveries start an export.
  • Subscription center, sender identities, snippets, opt-outs, ESP suppression, audit logs, reporting webhooks (v1/reporting_webhooks, which forward delivery events to a URL), and v1/info/ip_addresses.

Notes

  • App API only: the Track API (identifying people and sending events) and Data Pipelines use their own keys and aren't reachable through this connection.
  • Authentication and region: the connection holds an App API key, sent as a Bearer token. Private keys starting with sk_eu_ go to api-eu.customer.io; every other key, including legacy App API keys, goes to api.customer.io, so a legacy key only works for a US workspace.
  • Trailing slashes are stripped by the gateway, since Customer.io redirects them.
  • Naming: v1/campaigns are campaigns (automations) in the Customer.io UI, v1/newsletters are broadcasts (one-time sends), and v1/broadcasts are API-triggered broadcasts.
  • Connection metadata: workspace_id and workspace_name when the key reaches one workspace, or workspace_count when it reaches several.
  • Errors: 400 an invalid request ({"meta": {"error": "..."}}), 401 a wrong or revoked key, or a legacy key used for an EU workspace, 404 not found, 429 rate limited.
  • Pagination: limit and start, where start is the next value of the previous page; an empty next is the last page.
  • Rate limits: the App API allows 10 requests a second, and broadcast triggers one request every 10 seconds per workspace; transactional sends aren't rate limited by Customer.io.
  • Timestamps are Unix seconds.

Resources

On this page