Render a template's preview image
const url = 'https://api.pixonaut.app/t/example/preview.png?fit=cover&compact=1';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.pixonaut.app/t/example/preview.png?fit=cover&compact=1' \ --header 'Authorization: Bearer <token>'Operation ID: templates.preview.get
The published template drawn with its own default values and clipped to its die-cut shape, as a PNG a storefront shows as a thumbnail. id is baseId@version. Every answer carries an ETag, and a matching if-none-match answers 304. An image read with a key is served no-cache: its URL names no workspace, and a text naming dynamic values, such as {date.year}, draws anew as days pass. A studio thumbnail of a published version never changes and is served immutable. size caps the long edge in pixels; bleed=1 draws the unclipped full-bleed reference instead; its extent is the tenant’s default bleed, which can change, so it is served no-cache and revalidated with its ETag. A key reads published versions only: any other id is 404. showcase draws one of the template’s showcases in place of its defaults, cached and revalidated as the defaults are; an id the template holds no showcase under is 404 showcase_not_found. The image carries no “Powered by Pixonaut” mark on any plan: a shop shows it as its own product image.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”A template id, baseId@version.
A template id, baseId@version.
Query Parameters
Section titled “Query Parameters”The long edge in pixels, clamped to the sizes the api renders.
The long edge in pixels, clamped to the sizes the api renders.
The width in pixels the image is drawn at, for a caller that does not know its ratio: the long edge is derived from the template’s declared ratio, and clamped as size is. Taken over size when both are given.
The width in pixels the image is drawn at, for a caller that does not know its ratio: the long edge is derived from the template’s declared ratio, and clamped as size is. Taken over size when both are given.
cover when the image is cropped to fill its box: width is then its short edge.
cover when the image is cropped to fill its box: width is then its short edge.
1 for the unclipped full-bleed reference.
1 for the unclipped full-bleed reference.
1 for as few bytes as show the same picture: a JPEG when nothing in it is transparent and that is smaller, else the PNG. The answer’s content-type says which. Ignored with bleed=1.
1 for as few bytes as show the same picture: a JPEG when nothing in it is transparent and that is smaller, else the PNG. The answer’s content-type says which. Ignored with bleed=1.
The id of one of the template’s showcases, as its read lists them: the image is drawn with that set’s values in place of the defaults.
The id of one of the template’s showcases, as its read lists them: the image is drawn with that set’s values in place of the defaults.
Responses
Section titled “Responses”The preview image
Headers
Section titled “Headers”Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.
The caller’s copy, named by its ETag, is current
Headers
Section titled “Headers”Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.
Refused: unauthorized
object
Examples
unauthorized
{ "error": "unauthorized"}Headers
Section titled “Headers”Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.
Refused: origin_forbidden, feature_disabled, forbidden, workspace_suspended
object
The feature the tenant does not have. Always sent with feature_disabled.
Examples
feature_disabled
{ "error": "feature_disabled", "feature": "api"}forbidden
{ "error": "forbidden"}origin_forbidden
{ "error": "origin_forbidden"}workspace_suspended
{ "error": "workspace_suspended"}Headers
Section titled “Headers”Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.
No published template has this id, or showcase_not_found: the template holds no showcase with the id showcase names
object
Examples
showcase_not_found
{ "error": "showcase_not_found"}Headers
Section titled “Headers”Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.
Refused: draft_invalid, template_defaults_invalid, draft_has_no_artwork, asset_map_too_large, invalid_query
object
Always sent with asset_map_too_large.
Always sent with asset_map_too_large.
Always sent with draft_invalid.
Examples
asset_map_too_large
{ "bytes": 0, "error": "asset_map_too_large", "maxBytes": 0}draft_has_no_artwork
{ "error": "draft_has_no_artwork"}draft_invalid
{ "error": "draft_invalid", "reason": "string"}invalid_query
{ "error": "invalid_query"}template_defaults_invalid
{ "error": "template_defaults_invalid"}Headers
Section titled “Headers”Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.
Refused: rate_limited
object
Examples
rate_limited
{ "error": "rate_limited"}Headers
Section titled “Headers”Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.
The caller left before the render started
object
Examples
client_closed_request
{ "error": "client_closed_request"}Headers
Section titled “Headers”Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.
Refused: template_defaults_invalid, db_error. A request that failed unexpectedly answers as text instead.
object
Examples
db_error
{ "error": "db_error"}template_defaults_invalid
{ "error": "template_defaults_invalid"}Headers
Section titled “Headers”Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.
Refused: print_box_unavailable, assets_unavailable, preview_unavailable
object
Examples
assets_unavailable
{ "error": "assets_unavailable"}preview_unavailable
{ "error": "preview_unavailable"}print_box_unavailable
{ "error": "print_box_unavailable"}Headers
Section titled “Headers”Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.
Questions? Write to [email protected].