Fetch an asset's preview
const url = 'https://api.pixonaut.app/v1/assets/example/content?fit=cover';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/v1/assets/example/content?fit=cover' \ --header 'Authorization: Bearer <token>'Operation ID: assets.content.get
The asset’s preview when it has one, else the file as stored: what a thumbnail or a canvas shows. A publishable key reads a customer’s upload only with the designer session header it was uploaded with, and a library asset only once it is public or shown or offered by a published version of a template; anything else answers 404, as a missing asset does. width serves it no larger than the box it is drawn in; each resize asked for with a key or through a link spends the tenant’s render budget, and is refused rate_limited once it is spent. The etag names the stored bytes and the size asked for, so If-None-Match answers 304 for as long as a cached copy is good.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Query Parameters
Section titled “Query Parameters”The asset’s contentKey. When it matches, the answer is cached immutable.
The asset’s contentKey. When it matches, the answer is cached immutable.
The width in pixels the image is drawn at. The long edge served is derived from the image’s own ratio, never larger than the stored image, and clamped to the sizes the api serves.
The width in pixels the image is drawn at. The long edge served is derived from the image’s own ratio, never larger than the stored image, and clamped to the sizes the api serves.
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.
Header Parameters
Section titled “Header Parameters”The designer’s browser session, which the SDK sends so one visitor’s uploads and proofs are told apart from another’s on the same key: 6 to 64 letters, digits, _ or -. Any other value is ignored.
The designer’s browser session, which the SDK sends so one visitor’s uploads and proofs are told apart from another’s on the same key: 6 to 64 letters, digits, _ or -. Any other value is ignored.
Responses
Section titled “Responses”The file’s bytes
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 uploaded file’s height in pixels, when it is known. The bytes served may be a smaller preview.
The uploaded file’s width in pixels, when it is known. The bytes served may be a smaller preview.
Not modified: the If-None-Match etag still holds
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 such finished asset (plain text)
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: invalid_query
object
Examples
invalid_query
{ "error": "invalid_query"}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.
Refused: db_error. A request that failed unexpectedly answers as text instead.
object
Examples
db_error
{ "error": "db_error"}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].