Skip to content

Fetch an asset's preview

GET
/v1/assets/{id}/content
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.

id
required
string
v

The asset’s contentKey. When it matches, the answer is cached immutable.

string

The asset’s contentKey. When it matches, the answer is cached immutable.

width

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.

string
/^\d+$/

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.

fit

cover when the image is cropped to fill its box: width is then its short edge.

string
Allowed values: cover

cover when the image is cropped to fill its box: width is then its short edge.

x-pixonaut-session

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.

string

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 file’s bytes

string
X-Request-Id
required
string

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.

x-pixonaut-original-height
integer

The uploaded file’s height in pixels, when it is known. The bytes served may be a smaller preview.

x-pixonaut-original-width
integer

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

X-Request-Id
required
string

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

Media typeapplication/json
object
error
required
string

Examples

Exampleunauthorized

unauthorized

{
"error": "unauthorized"
}
X-Request-Id
required
string

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

Media typeapplication/json
object
error
required
string
feature

The feature the tenant does not have. Always sent with feature_disabled.

string

Examples

feature_disabled

{
"error": "feature_disabled",
"feature": "api"
}
X-Request-Id
required
string

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)

X-Request-Id
required
string

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

Media typeapplication/json
object
error
required
string

Examples

Exampleinvalid_query

invalid_query

{
"error": "invalid_query"
}
X-Request-Id
required
string

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

Media typeapplication/json
object
error
required
string

Examples

Examplerate_limited

rate_limited

{
"error": "rate_limited"
}
X-Request-Id
required
string

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
error
required
string

Examples

Exampledb_error

db_error

{
"error": "db_error"
}
X-Request-Id
required
string

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].

Status · Terms of service · Privacy policy · Subprocessors