Customer.io Collections API
Manage collections of data used in message personalization.
Manage collections of data used in message personalization.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/customer-io-collections-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
openapi: 3.2.0
info:
version: 1.0.0
title: Customer.io App Collections API
description: 'Our App API provides ways to trigger messages and retrieve information about people, campaigns, broadcasts, and more.
# Overview
The App API provides methods to send newsletters, transactional messages, and API-triggered broadcasts. You can create newsletters from scratch and update transactional messages and API-triggered broadcasts.
For transactional messages and API-triggered broadcasts, your payload acts as a message "trigger" and can contain `data` that you reference in your messages using liquid—`{{trigger.<data>}}`.
The other endpoints help you retrieve information about people, segments, campaigns, broadcasts, etc; it also lets you update campaign actions, messages, newsletter variants, etc. Aside from the [API-triggered broadcast](#triggerBroadcast) (1 per 10 seconds) and [Transactional](#sendEmail) (100 per second) endpoints, requests are limited to 10 per second.
# Use our Postman collection
We''ve generated a Postman collection to help you get started with our APIs.
If you fork this collection, you might want to disable the *Watch original collection* option. We automatically update our Postman collection whenever we release changes to our documentation, even if we don''t change our APIs—which happens daily! Rather than being flooded with Postman notifications, you can check out our [Release Notes](/release-notes/) for updates to our APIs.
**NOTE**: Postman endpoints default to our US APIs. If you''re in our European (EU) region, you''ll need to add `-eu` to the server variables (`track_api_url` and `app_api_url`).
[<img src="https://run.pstmn.io/button.svg" alt="Run In Postman" style="width: 128px; height: 32px;">](https://god.gw.postman.com/run-collection/23697545-2931c004-e63d-4cdc-bf4b-e685ba6da42d?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%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lZCI6dHJ1ZX0seyJrZXkiOiJmb3JtX2lkIiwidHlwZSI6ImRlZmF1bHQiLCJ2YWx1ZSI6IiIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoiaWRlbnRpZmllciIsInR5cGUiOiJkZWZhdWx0IiwidmFsdWUiOiIiLCJlbmFibGVkIjp0cnVlfSx7ImtleSI6ImRldmljZV9pZCIsInR5cGUiOiJkZWZhdWx0IiwidmFsdWUiOiIiLCJlbmFibGVkIjp0cnVlfSx7ImtleSI6ImRlbGl2ZXJ5X2lkIiwidHlwZSI6ImRlZmF1bHQiLCJ2YWx1ZSI6IiIsImVuYWJsZWQiOnRydWV9XQ==)
# Server addresses: US and EU
Customer.io hosts services in the United States (US) and European Union. Select the appropriate server address for your region.
| Region | Server Address |
| :-- | :-- |
| US | https://api.customer.io |
| EU | https://api-eu.customer.io |
# Authentication
All requests to the Customer.io App API use an [App API Key](#App-API-Key).
To authenticate, provide your key as a Bearer token in a HTTP Authorization header. You can create and manage your API keys—including keys with different scopes—in [your account settings page](https://fly.customer.io/settings/api_credentials?keyType=app). Each operation on this page references the authorization header it requires.
# Rate Limits
Most endpoints on this page are limited to 10 requests per second. The exceptions are:
* The [transactional email](#operation/sendEmail) endpoint is limited to 100 requests per second.
* The [API-triggered broadcast endpoint](#operation/triggerBroadcast) is limited to 1 request every 10 seconds.
**Rate limits are subject to change. We may adjust these thresholds to ensure stable performance for all customers.**
'
servers:
- url: https://api.customer.io
description: The base URL for broadcasts, transactional messages, and data-retrieval APIs. These endpoints use bearer authorization, and require a [token that you generate in the UI](https://fly.customer.io/settings/api_credentials?keyType=app).
- url: https://api-eu.customer.io
description: The base URL for broadcasts, transactional messages, and data-retrieval APIs (EU region). These endpoints use bearer authorization, and require a [token that you generate in the UI](https://fly.customer.io/settings/api_credentials?keyType=app).
tags:
- name: Collections
description: 'Collections are arbitrary sets of data that you want to use in campaign messages or workflows independent of attributes or events. They might represent things like upcoming events, coupons/promotions, etc.
'
paths:
/v1/collections:
servers:
- url: https://api.customer.io
description: This API uses bearer authorization, requiring a [token that you generate in the UI](https://fly.customer.io/settings/api_credentials?keyType=app).
post:
summary: Create a collection
description: 'Create a new collection and provide the `data` that you''ll access from the collection or the `url` that you''ll download CSV or JSON data from.
**Note**: A collection cannot be more than 10 MB in size. No individual row in the collection can be more than 10 KB.
'
tags:
- Collections
operationId: addCollection
security:
- Bearer-Auth: []
requestBody:
content:
application/json:
schema:
oneOf:
- title: Local data
type: object
required:
- name
- data
properties:
name:
type: string
description: The name of the collection. This is how you'll reference your collection in messages—`{{collection_name.data-property}}`.
data:
type: array
description: An array of data objects that you want to reference in this collection.
items:
type: object
additionalProperties:
x-additionalPropertiesName: collection data
- title: Data by URL
type: object
required:
- name
- url
properties:
name:
type: string
description: The name of the collection. This is how you'll reference your collection in messages—`{{collection_name.data-property}}`.
url:
type: string
format: url
description: 'The URL for your CSV or JSON data. If your URL does not return a `Content-Type`, we use the file extension; otherwise, Customer.io assumes your data is JSON.
'
example:
name: events
data:
- eventName: christmas
eventDate: '2021-12-25T12:00:00.000Z'
presents:
something_you_want: toys
something_you_need: socks
total: 2
- eventName: birthday
eventDate: '2021-03-15T12:00:00.000Z'
presents:
something_you_want: video games
something_you_need: books
total: 2
responses:
'200':
description: The collection was created successfully.
content:
application/json:
schema:
type: object
properties:
collection:
x-scalar-ignore: true
type: object
properties:
bytes:
type: integer
description: The size of the collection in bytes.
example: 296
created_at:
x-scalar-ignore: true
type: integer
format: unix timestamp
description: The date time when the referenced ID was created.
example: 1552341937
readOnly: true
updated_at:
x-scalar-ignore: true
type: integer
format: unix timestamp
description: The date time when the referenced ID was last updated.
example: 1552341937
readOnly: true
id:
type: integer
description: The identifier for the collection. This is how you'll reference the collection from the API.
example: 1
name:
type: string
description: The name of the collection. This is how you'll reference the collection in liquid, e.g. `{{collection_name.data_property}}`.
example: upcoming events
rows:
type: integer
description: Represents the number of objects in the `data` array or CSV rows in your collection schema.
example: 2
schema:
type: array
description: Lists the top-level keys that you can reference within this collection. Customer.io does not enforce any of these keys as required from your `data`.
items:
type: string
example:
- eventDate
- eventName
- presents
'400':
description: Your request was malformed.
'429':
description: Your request is over the 10-per-second limit.
x-codeSamples:
- lang: json
label: JSON
source: "{\n \"name\": \"events\",\n \"data\": [\n {\n \"eventName\": \"christmas\",\n \"eventDate\": \"2021-12-25T12:00:00.000Z\",\n \"presents\": {\n \"something_you_want\": \"toys\",\n \"something_you_need\": \"socks\",\n \"total\": 2\n }\n },\n {\n \"eventName\": \"birthday\",\n \"eventDate\": \"2021-03-15T12:00:00.000Z\",\n \"presents\": {\n \"something_you_want\": \"video games\",\n \"something_you_need\": \"books\",\n \"total\": 2\n }\n }\n ]\n}"
- lang: Shell + Curl
source: "curl --request POST \\\n --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \\\n --url https://api.customer.io/v1/collections \\\n --header 'content-type: application/json' \\\n --data '{\"name\":\"string\",\"data\":[{\"collection data1\":null,\"collection data2\":null}]}'"
- lang: Node + Native
source: "const http = require(\"https\");\n\nconst options = {\n \"method\": \"POST\",\n \"hostname\": \"api.customer.io\",\n \"port\": null,\n \"path\": \"/v1/collections\",\n \"headers\": {\n \"content-type\": \"application/json\"\n }\n};\n\nconst req = http.request(options, function (res) {\n const chunks = [];\n\n res.on(\"data\", function (chunk) {\n chunks.push(chunk);\n });\n\n res.on(\"end\", function () {\n const body = Buffer.concat(chunks);\n console.log(body.toString());\n });\n});\n\nreq.write(JSON.stringify({name: 'string', data: [{'collection data1': null, 'collection data2': null}]}));\nreq.end();"
- lang: Ruby + Native
source: 'require ''uri''
require ''net/http''
require ''openssl''
url = URI("https://api.customer.io/v1/collections")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = ''application/json''
request.body = "{\"name\":\"string\",\"data\":[{\"collection data1\":null,\"collection data2\":null}]}"
response = http.request(request)
puts response.read_body'
- lang: Python + Python3
source: 'import http.client
conn = http.client.HTTPSConnection("api.customer.io")
payload = "{\"name\":\"string\",\"data\":[{\"collection data1\":null,\"collection data2\":null}]}"
headers = { ''content-type'': "application/json" }
conn.request("POST", "/v1/collections", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))'
- lang: Go + Native
source: "package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.customer.io/v1/collections\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"string\\\",\\\"data\\\":[{\\\"collection data1\\\":null,\\\"collection data2\\\":null}]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"content-type\", \"application/json\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
get:
operationId: getCollections
summary: List your collections
description: Returns a list of all of your collections, including the `name` and `schema` for each collection.
tags:
- Collections
security:
- Bearer-Auth: []
responses:
'200':
description: Returns metadata about your collection.
content:
application/json:
schema:
type: object
properties:
collections:
type: array
items:
x-scalar-ignore: true
type: object
properties:
bytes:
type: integer
description: The size of the collection in bytes.
example: 296
created_at:
x-scalar-ignore: true
type: integer
format: unix timestamp
description: The date time when the referenced ID was created.
example: 1552341937
readOnly: true
updated_at:
x-scalar-ignore: true
type: integer
format: unix timestamp
description: The date time when the referenced ID was last updated.
example: 1552341937
readOnly: true
id:
type: integer
description: The identifier for the collection. This is how you'll reference the collection from the API.
example: 1
name:
type: string
description: The name of the collection. This is how you'll reference the collection in liquid, e.g. `{{collection_name.data_property}}`.
example: upcoming events
rows:
type: integer
description: Represents the number of objects in the `data` array or CSV rows in your collection schema.
example: 2
schema:
type: array
description: Lists the top-level keys that you can reference within this collection. Customer.io does not enforce any of these keys as required from your `data`.
items:
type: string
example:
- eventDate
- eventName
- presents
'429':
description: Your request is over the 10-per-second limit.
x-codeSamples:
- lang: Shell + Curl
source: "curl --request GET \\\n --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \\\n --url https://api.customer.io/v1/collections"
- lang: Node + Native
source: "const http = require(\"https\");\n\nconst options = {\n \"method\": \"GET\",\n \"hostname\": \"api.customer.io\",\n \"port\": null,\n \"path\": \"/v1/collections\",\n \"headers\": {}\n};\n\nconst req = http.request(options, function (res) {\n const chunks = [];\n\n res.on(\"data\", function (chunk) {\n chunks.push(chunk);\n });\n\n res.on(\"end\", function () {\n const body = Buffer.concat(chunks);\n console.log(body.toString());\n });\n});\n\nreq.end();"
- lang: Ruby + Native
source: 'require ''uri''
require ''net/http''
require ''openssl''
url = URI("https://api.customer.io/v1/collections")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body'
- lang: Python + Python3
source: 'import http.client
conn = http.client.HTTPSConnection("api.customer.io")
conn.request("GET", "/v1/collections")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))'
- lang: Go + Native
source: "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.customer.io/v1/collections\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
/v1/collections/{collection_id}:
parameters:
- name: collection_id
description: The identifier for a collection.
in: path
required: true
schema:
type: integer
servers:
- url: https://api.customer.io
description: This API uses bearer authorization, requiring a [token that you generate in the UI](https://fly.customer.io/settings/api_credentials?keyType=app).
get:
summary: Lookup a collection
description: Retrieves details about a collection, including the `schema` and `name`. This request does not include the `content` of the collection (the values associated with keys in the schema).
tags:
- Collections
operationId: getCollection
security:
- Bearer-Auth: []
responses:
'200':
description: Returns metadata about your collection.
content:
application/json:
schema:
type: object
properties:
collection:
x-scalar-ignore: true
type: object
properties:
bytes:
type: integer
description: The size of the collection in bytes.
example: 296
created_at:
x-scalar-ignore: true
type: integer
format: unix timestamp
description: The date time when the referenced ID was created.
example: 1552341937
readOnly: true
updated_at:
x-scalar-ignore: true
type: integer
format: unix timestamp
description: The date time when the referenced ID was last updated.
example: 1552341937
readOnly: true
id:
type: integer
description: The identifier for the collection. This is how you'll reference the collection from the API.
example: 1
name:
type: string
description: The name of the collection. This is how you'll reference the collection in liquid, e.g. `{{collection_name.data_property}}`.
example: upcoming events
rows:
type: integer
description: Represents the number of objects in the `data` array or CSV rows in your collection schema.
example: 2
schema:
type: array
description: Lists the top-level keys that you can reference within this collection. Customer.io does not enforce any of these keys as required from your `data`.
items:
type: string
example:
- eventDate
- eventName
- presents
'404':
description: The collection `id` does not exist.
'429':
description: Your request is over the 10-per-second limit.
x-codeSamples:
- lang: Shell + Curl
source: "curl --request GET \\\n --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \\\n --url https://api.customer.io/v1/collections/{collection_id}"
- lang: Node + Native
source: "const http = require(\"https\");\n\nconst options = {\n \"method\": \"GET\",\n \"hostname\": \"api.customer.io\",\n \"port\": null,\n \"path\": \"/v1/collections/%7Bcollection_id%7D\",\n \"headers\": {}\n};\n\nconst req = http.request(options, function (res) {\n const chunks = [];\n\n res.on(\"data\", function (chunk) {\n chunks.push(chunk);\n });\n\n res.on(\"end\", function () {\n const body = Buffer.concat(chunks);\n console.log(body.toString());\n });\n});\n\nreq.end();"
- lang: Ruby + Native
source: 'require ''uri''
require ''net/http''
require ''openssl''
url = URI("https://api.customer.io/v1/collections/%7Bcollection_id%7D")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body'
- lang: Python + Python3
source: 'import http.client
conn = http.client.HTTPSConnection("api.customer.io")
conn.request("GET", "/v1/collections/%7Bcollection_id%7D")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))'
- lang: Go + Native
source: "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.customer.io/v1/collections/%7Bcollection_id%7D\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
delete:
summary: Delete a collection
description: Remove a collection and associated contents. Before you delete a collection, make sure that you aren't referencing it in active campaign messages or broadcasts; references to a deleted collection will appear empty and may prevent your messages from making sense to your audience.
tags:
- Collections
operationId: deleteCollection
security:
- Bearer-Auth: []
responses:
'204':
description: The collection is deleted.
'404':
description: The collection `id` does not exist.
'429':
description: Your request is over the 10-per-second limit.
x-codeSamples:
- lang: Shell + Curl
source: "curl --request DELETE \\\n --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \\\n --url https://api.customer.io/v1/collections/{collection_id}"
- lang: Node + Native
source: "const http = require(\"https\");\n\nconst options = {\n \"method\": \"DELETE\",\n \"hostname\": \"api.customer.io\",\n \"port\": null,\n \"path\": \"/v1/collections/%7Bcollection_id%7D\",\n \"headers\": {}\n};\n\nconst req = http.request(options, function (res) {\n const chunks = [];\n\n res.on(\"data\", function (chunk) {\n chunks.push(chunk);\n });\n\n res.on(\"end\", function () {\n const body = Buffer.concat(chunks);\n console.log(body.toString());\n });\n});\n\nreq.end();"
- lang: Ruby + Native
source: 'require ''uri''
require ''net/http''
require ''openssl''
url = URI("https://api.customer.io/v1/collections/%7Bcollection_id%7D")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body'
- lang: Python + Python3
source: 'import http.client
conn = http.client.HTTPSConnection("api.customer.io")
conn.request("DELETE", "/v1/collections/%7Bcollection_id%7D")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))'
- lang: Go + Native
source: "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.customer.io/v1/collections/%7Bcollection_id%7D\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
put:
summary: Update a collection
description: "Update the `name` or replace the contents of a collection. Updating the `data` or `url` for your collection fully replaces the contents of the collection.\n\n**Note**: \n* If you reference your collection by name in active campaign messages, changing the name of the collection will cause references to the previous name to return an empty data set.\n* A collection cannot be more than 10 MB in size. No individual row in the collection can be more than 10 KB.\n"
tags:
- Collections
operationId: updateCollection
security:
- Bearer-Auth: []
requestBody:
content:
application/json:
schema:
oneOf:
- title: Local data
type: object
properties:
name:
type: string
description: The name of the collection. This is how you'll reference your collection in messages—`{{collection_name.data-property}}`.
data:
type: array
description: An array of data objects that you want to reference in this collection.
items:
type: object
additionalProperties:
x-additionalPropertiesName: collection data
- title: Data by URL
type: object
properties:
name:
type: string
description: The name of the collection. This is how you'll reference your collection in messages—`{{collection_name.data-property}}`.
url:
type: string
format: url
description: 'The URL for your CSV or JSON data. If your URL does not return a `Content-Type`, we use the file extension; otherwise, Customer.io assumes your data is JSON.
'
example:
name: events
data:
- eventName: christmas
eventDate: '2021-12-25T12:00:00.000Z'
presents:
something_you_want: toys
something_you_need: socks
total: 2
- eventName: birthday
eventDate: '2021-03-15T12:00:00.000Z'
presents:
something_you_want: video games
something_you_need: books
total: 2
responses:
'200':
description: The collection was created successfully.
content:
application/json:
schema:
type: object
properties:
collection:
x-scalar-ignore: true
type: object
properties:
bytes:
type: integer
description: The size of the collection in bytes.
example: 296
created_at:
x-scalar-ignore: true
type: integer
format: unix timestamp
description: The date time when the referenced ID was created.
example: 1552341937
readOnly: true
updated_at:
x-scalar-ignore: true
type: integer
format: unix timestamp
description: The date time when the referenced ID was last updated.
example: 1552341937
readOnly: true
id:
type: integer
description: The identifier for the collection. This is how you'll reference the collection from the API.
example: 1
name:
type: string
description: The name of the collection. This is how you'll reference the collection in liquid, e.g. `{{collection_name.data_property}}`.
example: upcoming events
rows:
type: integer
description: Represents the number of objects in the `data` array or CSV rows in your collection schema.
example: 2
schema:
type: array
description: Lists the top-level keys that you can reference within this collection. Customer.io does not enforce any of these keys as required from your `data`.
items:
type: string
# --- truncated at 32 KB (47 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/customer-io/refs/heads/main/openapi/customer-io-collections-api-openapi.yml