latestSwagger 2.02026-08-10148196271.0 KB

afaab604b58c

snippets

Create or update a snippet

Create or update a snippet by ID (numeric) or name (string). For names, creates the snippet if it doesn't exist. For IDs, only updates existing snippets. Numeric identifiers are treated as IDs, string identifiers as names.

put/api/snippets/{identifier}

Path parameters

identifierstring required

Snippet ID (numeric) or name (string). Numeric identifiers are treated as IDs, string identifiers as names. For name-based identifiers, creates the snippet if it doesn't exist.

Request body

contentstring required

Content of the snippet. Handlebars must be valid. Disallowed content: script tags with JS sources or non-JSON content, inline JS event handlers (e.g., <code>onload="..."</code>), and <code>javascript:</code> in <code>href</code> or <code>src</code> attributes (anchors and iframes).

createdByUserIdstring

User ID (email) of the updater. If not provided, defaults to the project creator.

descriptionstring

Description of the snippet.

variablesstring[]

List of variable names used in the content with a Handlebars expression such as {{myField}}. Variable names are case-sensitive and should be simple identifiers (letters, numbers, underscores). To learn more about using Handlebars in Snippets, see <a href="https://support.iterable.com/hc/articles/4414796078868\">Customizing Snippets with Variables</a>.

Response

Snippet updated successfully