Upload a file's bytes
const url = 'https://api.pixonaut.app/u/example';const options = {method: 'PUT'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.pixonaut.app/u/exampleOperation ID: assets.upload
The uploadUrl POST /v1/assets answered with. The body is the file itself, exactly the mime and the number of bytes declared there; no key is needed, since the signed token in the path is the credential. A small image is accepted with a warning (and warningKey, warningParams for translation) rather than refused.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Responses
Section titled “Responses”The file is stored
object
The asset’s contentKey, as its listing reports it: pass it as v to /v1/assets/{id}/content and the answer is cached immutable.
Set when this upload is below the minimum print resolution at its size and may be improved before the proof (POST /v1/assets/{id}/improve-resolution), to this size: the template allows upscaling, the tenant’s plan and credits cover it, and the shortfall is within one upscale. Null otherwise.
object
Examples
Example
{ "assetId": "7a3e9b10-2c4d-4e5f-9a6b-1c2d3e4f5a6b", "contentKey": "ck_4f7a1c9e2b8d", "effectiveDpi": 300, "heightPx": 3600, "improveResolution": null, "warning": null, "warningKey": null, "warningParams": null, "widthPx": 3000}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: unknown_upload
object
Examples
unknown_upload
{ "error": "unknown_upload"}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: upload_expired
object
Examples
upload_expired
{ "error": "upload_expired"}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: size_mismatch, unsupported_mime, animation_not_supported, not_a_valid_image, pixel_dimensions_too_large, size_out_of_bounds
object
Always sent with unsupported_mime.
Always sent with pixel_dimensions_too_large, pixel_dimensions_too_large.
Always sent with size_out_of_bounds.
Always sent with pixel_dimensions_too_large.
Always sent with pixel_dimensions_too_large.
Always sent with pixel_dimensions_too_large, pixel_dimensions_too_large.
Examples
animation_not_supported
{ "error": "animation_not_supported"}not_a_valid_image
{ "error": "not_a_valid_image"}pixel_dimensions_too_large (maxEdgePx, widthPx, heightPx)
{ "error": "pixel_dimensions_too_large", "heightPx": 0, "maxEdgePx": 0, "widthPx": 0}pixel_dimensions_too_large (maxPixels, widthPx, heightPx)
{ "error": "pixel_dimensions_too_large", "heightPx": 0, "maxPixels": 0, "widthPx": 0}size_mismatch
{ "error": "size_mismatch"}size_out_of_bounds
{ "error": "size_out_of_bounds", "maxBytes": 0}unsupported_mime
{ "allowed": [ "string" ], "error": "unsupported_mime"}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: preview_failed. A request that failed unexpectedly answers as text instead.
object
Examples
preview_failed
{ "error": "preview_failed"}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: lock_timeout
object
Examples
lock_timeout
{ "error": "lock_timeout"}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: storage_quota_exceeded. The tenant’s storage quota would be exceeded. usedBytes and quotaBytes are left out for a publishable key.
object
Always sent with storage_quota_exceeded.
Always sent with storage_quota_exceeded.
Examples
storage_quota_exceeded
{ "error": "storage_quota_exceeded"}storage_quota_exceeded (usedBytes, quotaBytes)
{ "error": "storage_quota_exceeded", "quotaBytes": 0, "usedBytes": 0}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].