Skip to content

Cut out a customer's upload

POST
/v1/assets/{id}/cut-out
curl --request POST \
--url https://api.pixonaut.app/v1/assets/example/cut-out \
--header 'Authorization: Bearer <token>'

Operation ID: assets.cutOut

Cuts a customer’s upload into a picture that cuts out (cutOut on the picture’s constraints) out of its background, in the background: answers 202 at once, and GET /v1/assets/{id}/cut-out says how it stands. Done, the cut-out is a new upload for the same picture, to put in the upload’s place; the upload is left as it was, so the customer may always go on with it uncut. Paid from the tenant’s credits once the cut-out is kept; one that fails charges nothing and may be asked once more (retryable). Asked again while it runs or once it is done, it answers how it stands (200) and charges nothing.

id
required
string
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 cut-out asked already, as it stands: asked again, as when an answer was lost

Media typeapplication/json
object
attempts
required

How often the cut-out was asked, at most 2: a cut-out that failed may be asked once more.

integer
cutOut
required

The cut-out, once done: a new upload for the same picture, to put in the upload’s place. Null while it runs, after it failed, or once it is no longer kept.

object
assetId
required
string
contentKey
required
string
heightPx
required
number
widthPx
required
number
retryable
required

Failed, and it may be asked again. Once false on a failed cut-out, the customer goes on with the upload as it was.

boolean
status
required

running while it is being cut out; done once the cut-out is kept; failed when it could not be cut out, which charged nothing.

string

Examples

Exampleexample

Example

{
"attempts": 1,
"cutOut": {
"assetId": "c41d0e2f-8b7a-4c6d-9e1f-2a3b4c5d6e7f",
"contentKey": "ck_9b2e4d6f1a3c",
"heightPx": 1500,
"widthPx": 1200
},
"retryable": false,
"status": "done"
}
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.

The cut-out, accepted and running

Media typeapplication/json
object
attempts
required

How often the cut-out was asked, at most 2: a cut-out that failed may be asked once more.

integer
cutOut
required

The cut-out, once done: a new upload for the same picture, to put in the upload’s place. Null while it runs, after it failed, or once it is no longer kept.

object
assetId
required
string
contentKey
required
string
heightPx
required
number
widthPx
required
number
retryable
required

Failed, and it may be asked again. Once false on a failed cut-out, the customer goes on with the upload as it was.

boolean
status
required

running while it is being cut out; done once the cut-out is kept; failed when it could not be cut out, which charged nothing.

string

Examples

Exampleexample

Example

{
"attempts": 1,
"cutOut": null,
"retryable": false,
"status": "running"
}
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: insufficient_credits. The tenant’s credits cannot cover this action, its spending cap has no room left for it, it is on the Free plan and Free workspaces together have reached the platform’s daily ceiling on credit spending (it resets at midnight UTC), a storefront’s customer asked and the tenant’s daily storefront ceiling has no room left, or the account that created the tenant has not confirmed its email address yet, so none of it was done. reason says which: balance, spending_cap, free_plan_ceiling, storefront_ceiling or email_unverified. requiredCredits, availableCredits and reason are left out for a publishable key.

Media typeapplication/json
object
availableCredits

Always sent with insufficient_credits.

number
error
required
string
reason

Always sent with insufficient_credits.

string
requiredCredits

Always sent with insufficient_credits.

number

Examples

insufficient_credits

{
"error": "insufficient_credits"
}
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, forbidden, feature_disabled, 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: cut_out_exhausted

Media typeapplication/json
object
attempts

How often the cut-out was asked, at most 2: a cut-out that failed may be asked once more. Always sent with cut_out_exhausted.

integer
cutOut

The cut-out, once done: a new upload for the same picture, to put in the upload’s place. Null while it runs, after it failed, or once it is no longer kept. Always sent with cut_out_exhausted.

object
assetId
required
string
contentKey
required
string
heightPx
required
number
widthPx
required
number
error
required
string
retryable

Failed, and it may be asked again. Once false on a failed cut-out, the customer goes on with the upload as it was. Always sent with cut_out_exhausted.

boolean
status

running while it is being cut out; done once the cut-out is kept; failed when it could not be cut out, which charged nothing. Always sent with cut_out_exhausted.

string

Examples

Examplecut_out_exhausted

cut_out_exhausted

{
"attempts": 0,
"cutOut": {
"assetId": "string",
"contentKey": "string",
"heightPx": 0,
"widthPx": 0
},
"error": "cut_out_exhausted",
"retryable": false,
"status": "running"
}
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: cut_out_not_offered, payload_too_large

Media typeapplication/json
object
bytes

Sent with payload_too_large.

number
error
required
string
maxBytes

Always sent with payload_too_large.

number

Examples

cut_out_not_offered

{
"error": "cut_out_not_offered"
}
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, cut_out_unavailable

Media typeapplication/json
object
error
required
string

Examples

cut_out_unavailable

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

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