Manage reusable snippets
Create reusable text blocks, read their serialized content, and replace or remove them by stable identity.
Snippets store reusable content such as a signature or boilerplate. They belong to the account, rather than an individual newsroom. Storing one does not insert it into a story or submit an email.
All snippet endpoints require an integration API key; personal tokens are unsupported. Choose your credential and load it into PREZLY_API_TOKEN on your server.
Find existing content
curl --fail-with-body --silent --show-error 'https://api.prezly.com/v2/snippets' \
--header "Authorization: Bearer $PREZLY_API_TOKEN" \
--header 'Accept: application/json'The response contains an unpaginated snippets array ordered by title. Store the returned uuid; detail routes also accept a numeric id. Titles are labels, not a unique import key.
curl --fail-with-body --silent --show-error 'https://api.prezly.com/v2/snippets/YOUR_SNIPPET_UUID' \
--header "Authorization: Bearer $PREZLY_API_TOKEN" \
--header 'Accept: application/json'The detail envelope is snippet. Its content is a JSON string, serialized as document format 0.50. Parse the string once to inspect the document; story content-format headers do not change this response. block_types summarizes non-empty top-level blocks, not the complete content.
List snippets → · Get snippet →
Create a named snippet
Save this as snippet-create.json. The outer content value is serialized document JSON, not HTML, plain text, or a raw object:
{
"title": "Acme press signature",
"content": "{\"type\":\"document\",\"children\":[{\"type\":\"paragraph\",\"children\":[{\"text\":\"Acme Press Team\"}]}],\"version\":\"0.50\"}"
}curl --fail-with-body --silent --show-error --request POST 'https://api.prezly.com/v2/snippets' \
--header "Authorization: Bearer $PREZLY_API_TOKEN" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-binary @snippet-create.jsonThe response is 201 Created with snippet. Retain its UUID before further edits. Both title and content are required; titles must contain 1–255 characters. A repeated POST creates another snippet, so reconcile a lost creation response against the account's list rather than blindly retrying.
Change selected fields or remove a snippet
A title-only PATCH preserves content:
curl --fail-with-body --silent --show-error --request PATCH 'https://api.prezly.com/v2/snippets/YOUR_SNIPPET_UUID' \
--header "Authorization: Bearer $PREZLY_API_TOKEN" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{"title":"Acme media enquiries signature"}'The response is 200 OK with snippet. Supplying content replaces the whole document; read the latest content and preserve the blocks you want to keep. There is no content-version conflict check on this endpoint. Coordinate simultaneous edits to avoid overwriting another author's changes. For inserting content into a story or email, follow the destination's story or campaign format rather than copying an entire snippet response.
After checking that an integration no longer needs the snippet:
curl --fail-with-body --silent --show-error --request DELETE 'https://api.prezly.com/v2/snippets/YOUR_SNIPPET_UUID' \
--header "Authorization: Bearer $PREZLY_API_TOKEN" \
--header 'Accept: application/json'Deletion returns 204 No Content. Keep local references in sync and do not parse the empty body as JSON. See Handling errors for HTTP failures.