Start an upload
const url = 'https://api.pixonaut.app/v1/assets';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"heightMm":305,"kind":"library","mime":"image/png","name":"Summer logo","sizeBytes":1843200,"visibility":"public","widthMm":254}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.pixonaut.app/v1/assets \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "heightMm": 305, "kind": "library", "mime": "image/png", "name": "Summer logo", "sizeBytes": 1843200, "visibility": "public", "widthMm": 254 }'Operation ID: assets.create
Declares the file about to be uploaded and answers with an uploadUrl to PUT its bytes to, good once and for 10 minutes. A publishable key’s upload is always a design upload, deleted when the tenant’s retention runs out unless an order holds it. A secret key’s is a library asset unless kind is design-upload; visibility: "public" publishes a library asset at /m/{id}.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”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.
Request Bodyrequired
Section titled “Request Bodyrequired”object
The file’s mime type. A template the upload names may take fewer than the platform does.
A library asset’s role: picture, the default, or blank-photo for a blank’s product photo, which is listed apart and in no category.
The file’s size in bytes. The upload must send exactly this many. At most 268435456 for a PNG and 83886080 for any other format, and a template the upload names may allow fewer.
Examples
Example
{ "heightMm": 305, "kind": "library", "mime": "image/png", "name": "Summer logo", "sizeBytes": 1843200, "visibility": "public", "widthMm": 254}Responses
Section titled “Responses”The upload is ready for its bytes
object
uploadUrl on this API’s public address, for a caller that holds no base to resolve it against.
Examples
Example
{ "absoluteUploadUrl": "https://api.pixonaut.example/u/eyJhIjoiN2EzZTliMTAifQ.k3Jx9TqLw2", "assetId": "7a3e9b10-2c4d-4e5f-9a6b-1c2d3e4f5a6b", "uploadUrl": "/u/eyJhIjoiN2EzZTliMTAifQ.k3Jx9TqLw2"}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: bad_json
object
Examples
bad_json
{ "error": "bad_json"}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.
Refused: not_found
object
Examples
not_found
{ "error": "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: unsupported_mime, size_out_of_bounds, payload_too_large, invalid_input, invalid_kind, invalid_visibility, invalid_role
object
Always sent with unsupported_mime.
Sent with payload_too_large.
Always sent with size_out_of_bounds, payload_too_large.
Examples
invalid_input
{ "error": "invalid_input"}invalid_kind
{ "error": "invalid_kind"}invalid_role
{ "error": "invalid_role"}invalid_visibility
{ "error": "invalid_visibility"}payload_too_large
{ "error": "payload_too_large", "maxBytes": 0}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: 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.
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. A publishable key or a share link is also refused this way once the tenant’s customers have uploaded their plan’s daily allowance in the last 24 hours.
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].