v1.0.0
OpenAPI 3.1.0

Create a collection

US region

Client Libraries

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.

Body
application/json
    • data
      Type: array object[]
      required

      An array of data objects that you want to reference in this collection.

    • name
      Type: string
      required

      The name of the collection. This is how you'll reference your collection in messages—{{collection_name.data-property}}.

    • delete_field
      Type: string
      max length:  
      255

      An attribute that marks a row for deletion, like deleted. When a row in a write request or a synced file sets this attribute to true, or to the text true, 1, or yes in 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.

    • key_field
      Type: string

      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.

Responses
  • application/json
  • 400

    Your request was malformed.

  • application/json
Request Example for post/v1/collections
{
  "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
  }
}