Create a collection
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 that you upload or send in an API request can be up to 10 MB. A collection that you load from files, with write requests or a sync, can be larger: each file can be up to 500 MB and 1,000,000 rows. Each top-level field in a row can hold up to 10,000 characters. The total size of all collections in your account can't exceed 5 GB. Customer.io rejects a request that would take your account over that limit.
- Type: array object[]datarequired
An array of data objects that you want to reference in this collection.
- Type: stringnamerequired
The name of the collection. This is how you'll reference your collection in messages—
{{collection_name.data-property}}. - Type: stringdelete
_field max length:255An attribute that marks a row for deletion, like
deleted. When a row in a write request or a synced file sets this attribute totrue, or to the texttrue,1, oryesin any case, Customer.io deletes the row with the same key instead of saving it. Deleting a key that doesn't exist does nothing. Customer.io never keeps a row that this attribute marks. When you create or replace a collection, Customer.io leaves marked rows out. When you set a delete field on an existing collection, Customer.io deletes the rows it already marks. A row that isn't marked keeps the attribute as you sent it. The delete field can't be the same as the key field. Send an empty string to remove it. - Type: stringkey
_field The attribute that holds each row's unique key, like
sku, similar to a primary key in a database table. Set a key field to add, change, delete, or read individual rows without replacing the whole collection. Each row needs a unique, non-empty string or number in this attribute, up to 1,024 bytes.
- application/json
- 400
Your request was malformed.
- application/json
{
"data": [
{
"eventName": "christmas",
"eventDate": {},
"presents": {
"something_you_want": "toys",
"something_you_need": "socks",
"total": 2
}
},
{
"eventName": "birthday",
"eventDate": {},
"presents": {
"something_you_want": "video games",
"something_you_need": "books",
"total": 2
}
}
],
"name": "events"
}
{
"collection": {
"bytes": 296,
"created_at": 1552341937,
"delete_field": "deleted",
"id": 1,
"key_field": "sku",
"name": "upcoming events",
"rows": 2,
"schema": [
"eventDate",
"eventName",
"presents"
],
"updated_at": 1552341937
}
}The collection was created successfully.