Render a template on a product photo
const url = 'https://api.pixonaut.app/t/example/mockup.png?blankId=example&placementId=example';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/mockup.png?blankId=example&placementId=example' \ --header 'Authorization: Bearer <token>'Operation ID: templates.mockup.get
The published template id (baseId@version) drawn into the print area a blank placement’s mockup photo marks, as a PNG a storefront shows. A draft, an unknown blank, placement or mockup, and a mockup whose photo is gone are all 404, so the route says nothing about which of them is missing. size caps the long edge in pixels. showcase draws one of the template’s showcases in place of its defaults, cached as the defaults are; an id the template holds no showcase under is 404 showcase_not_found. Naming neither mockupId nor viewId draws on the placement’s first view. A studio member reads it with their session, in the workspace the x-tenant-id header names, holding templates:read.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”A published template id, baseId@version.
A published template id, baseId@version.
Query Parameters
Section titled “Query Parameters”The blank whose placement the mockup is of.
The blank whose placement the mockup is of.
The placement on that blank.
The placement on that blank.
One of the placement’s mockup photos. Name it or viewId, not both; neither draws on the placement’s first view.
One of the placement’s mockup photos. Name it or viewId, not both; neither draws on the placement’s first view.
One of the placement’s views: the render uses its photo of variant, else its default photo. Name it or mockupId, not both.
One of the placement’s views: the render uses its photo of variant, else its default photo. Name it or mockupId, not both.
A variant ref of the blank, with viewId: the render uses the view’s photo that shows it.
A variant ref of the blank, with viewId: the render uses the view’s photo that shows it.
The long edge in pixels, clamped to the sizes the api renders.
The long edge in pixels, clamped to the sizes the api renders.
Refused: a full-bleed reference cannot be composited.
Refused: a full-bleed reference cannot be composited.
The id of one of the template’s showcases, as its read lists them: the template is drawn with that set’s values in place of its defaults.
The id of one of the template’s showcases, as its read lists them: the template is drawn with that set’s values in place of its defaults.
Responses
Section titled “Responses”The template on the product photo
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: bleed_not_compositable
object
Examples
bleed_not_compositable
{ "error": "bleed_not_compositable"}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, blank, placement or mockup answers to these ids, 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: mockup_rect_unusable, mockup_rect_outside_photo, mockup_placed_box_empty, photo_decode_failed, mockup_mesh_unusable, mockup_cut_unusable, mockup_mask_decode_failed, mockup_uv_decode_failed, mockup_uv_pass_mismatch, unknown_variant, variant_retired, variant_has_no_photo, mockup_mask_unreadable, mockup_uv_unreadable, asset_map_too_large, invalid_query
object
Always sent with asset_map_too_large.
Always sent with asset_map_too_large.
Always sent with unknown_variant, variant_retired, variant_has_no_photo.
Always sent with unknown_variant.
With variant_retired: The retired variant’s ref. With variant_has_no_photo: The variant’s ref. Always sent with variant_retired, variant_has_no_photo.
The view’s label. Always sent with variant_has_no_photo.
Always sent with variant_has_no_photo.
Examples
asset_map_too_large
{ "bytes": 0, "error": "asset_map_too_large", "maxBytes": 0}invalid_query
{ "error": "invalid_query"}mockup_cut_unusable
{ "error": "mockup_cut_unusable"}mockup_mask_decode_failed
{ "error": "mockup_mask_decode_failed"}mockup_mask_unreadable
{ "error": "mockup_mask_unreadable"}mockup_mesh_unusable
{ "error": "mockup_mesh_unusable"}mockup_placed_box_empty
{ "error": "mockup_placed_box_empty"}mockup_rect_outside_photo
{ "error": "mockup_rect_outside_photo"}mockup_rect_unusable
{ "error": "mockup_rect_unusable"}mockup_uv_decode_failed
{ "error": "mockup_uv_decode_failed"}mockup_uv_pass_mismatch
{ "error": "mockup_uv_pass_mismatch"}mockup_uv_unreadable
{ "error": "mockup_uv_unreadable"}photo_decode_failed
{ "error": "photo_decode_failed"}unknown_variant
{ "error": "unknown_variant", "reason": "string", "ref": "string"}variant_has_no_photo
{ "error": "variant_has_no_photo", "reason": "string", "variant": "string", "view": "string", "viewId": "string"}variant_retired
{ "error": "variant_retired", "reason": "string", "variant": "string"}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: artwork_decode_failed, encode_failed, downscale_size_overflow, input_too_large, mockup_warp_unreadable, mockup_mesh_unreadable, mockup_cut_unreadable, mockup_uv_view_missing, composite_failed, template_defaults_invalid, db_error. A request that failed unexpectedly answers as text instead.
object
Examples
artwork_decode_failed
{ "error": "artwork_decode_failed"}composite_failed
{ "error": "composite_failed"}db_error
{ "error": "db_error"}downscale_size_overflow
{ "error": "downscale_size_overflow"}encode_failed
{ "error": "encode_failed"}input_too_large
{ "error": "input_too_large"}mockup_cut_unreadable
{ "error": "mockup_cut_unreadable"}mockup_mesh_unreadable
{ "error": "mockup_mesh_unreadable"}mockup_uv_view_missing
{ "error": "mockup_uv_view_missing"}mockup_warp_unreadable
{ "error": "mockup_warp_unreadable"}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, asset_store_unavailable, assets_unavailable
object
Examples
asset_store_unavailable
{ "error": "asset_store_unavailable"}assets_unavailable
{ "error": "assets_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].