Skip to content

Start an upload

POST
/v1/assets
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}.

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.

Media typeapplication/json
object
heightMm
number | null
> 0
kind
string
Allowed values: library design-upload mockup
layerId
string | null
mime

The file’s mime type. A template the upload names may take fewer than the platform does.

string
Allowed values: image/png image/jpeg image/webp image/heic image/heif
name
string
<= 200 characters
role

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.

string
Allowed values: picture blank-photo
sizeBytes

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.

integer
>= 1 <= 268435456
templateId
string | null
visibility
string
Allowed values: public private
widthMm
number | null
> 0
key
additional properties

Examples

Exampleexample

Example

{
"heightMm": 305,
"kind": "library",
"mime": "image/png",
"name": "Summer logo",
"sizeBytes": 1843200,
"visibility": "public",
"widthMm": 254
}

The upload is ready for its bytes

Media typeapplication/json
object
absoluteUploadUrl
required

uploadUrl on this API’s public address, for a caller that holds no base to resolve it against.

string
assetId
required
string
uploadUrl
required
string

Examples

Exampleexample

Example

{
"absoluteUploadUrl": "https://api.pixonaut.example/u/eyJhIjoiN2EzZTliMTAifQ.k3Jx9TqLw2",
"assetId": "7a3e9b10-2c4d-4e5f-9a6b-1c2d3e4f5a6b",
"uploadUrl": "/u/eyJhIjoiN2EzZTliMTAifQ.k3Jx9TqLw2"
}
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: bad_json

Media typeapplication/json
object
error
required
string

Examples

Examplebad_json

bad_json

{
"error": "bad_json"
}
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.

Refused: not_found

Media typeapplication/json
object
error
required
string

Examples

Examplenot_found

not_found

{
"error": "not_found"
}
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: unsupported_mime, size_out_of_bounds, payload_too_large, invalid_input, invalid_kind, invalid_visibility, invalid_role

Media typeapplication/json
object
allowed

Always sent with unsupported_mime.

Array<string>
bytes

Sent with payload_too_large.

number
error
required
string
maxBytes

Always sent with size_out_of_bounds, payload_too_large.

number

Examples

invalid_input

{
"error": "invalid_input"
}
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.

Refused: lock_timeout

Media typeapplication/json
object
error
required
string

Examples

Examplelock_timeout

lock_timeout

{
"error": "lock_timeout"
}
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: 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.

Media typeapplication/json
object
error
required
string
quotaBytes

Always sent with storage_quota_exceeded.

number
usedBytes

Always sent with storage_quota_exceeded.

number

Examples

storage_quota_exceeded

{
"error": "storage_quota_exceeded"
}
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