v1.0.0
OpenAPI 3.1.0

Create a snippet

US region

Client Libraries

Create a snippet

Create a new snippet. If a snippet with that name already exists, we'll return a 422 error. If the value contains Liquid, we validate it.

Body
application/json

Request body for creating or updating a snippet. Only name and value are accepted; updated_at is returned in responses only.

  • name
    Type: string
    max length:  
    150
    required

    The name of the snippet, must be unique. Trimmed of leading and trailing whitespace before storage.

  • value
    Type: string
    required

    The contents of the snippet (plain text or Liquid). Trimmed of leading and trailing whitespace before storage. Max length is environment-specific (default 16000).

Responses
  • application/json
  • 401

    Unauthorized request. Make sure that you provided the right credentials.

  • application/json
  • 429

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

  • 500

    Internal server error (for example, render service failure when validating Liquid).

Request Example for post/v1/snippets
curl https://api.customer.io/v1/snippets \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --data '{
  "name": "address",
  "value": "<strong>My Company</strong></br>1234 Fake St<br/>Fake,NY<br/>10111"
}'
{
  "snippet": {
    "name": "address",
    "value": "<strong>My Company</strong></br>1234 Fake St<br/>Fake,NY<br/>10111",
    "updated_at": 1582500000
  }
}