Cut out a customer's upload
const url = 'https://api.pixonaut.app/v1/assets/example/cut-out';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
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/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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path 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.
Responses
Section titled “Responses”The cut-out asked already, as it stands: asked again, as when an answer was lost
object
How often the cut-out was asked, at most 2: a cut-out that failed may be asked once more.
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
Failed, and it may be asked again. Once false on a failed cut-out, the customer goes on with the upload as it was.
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.
Examples
Example
{ "attempts": 1, "cutOut": { "assetId": "c41d0e2f-8b7a-4c6d-9e1f-2a3b4c5d6e7f", "contentKey": "ck_9b2e4d6f1a3c", "heightPx": 1500, "widthPx": 1200 }, "retryable": false, "status": "done"}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.
The cut-out, accepted and running
object
How often the cut-out was asked, at most 2: a cut-out that failed may be asked once more.
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
Failed, and it may be asked again. Once false on a failed cut-out, the customer goes on with the upload as it was.
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.
Examples
Example
{ "attempts": 1, "cutOut": null, "retryable": false, "status": "running"}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: 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.
object
Always sent with insufficient_credits.
Always sent with insufficient_credits.
Always sent with insufficient_credits.
Examples
insufficient_credits
{ "error": "insufficient_credits"}insufficient_credits (requiredCredits, availableCredits, reason)
{ "availableCredits": 0, "error": "insufficient_credits", "reason": "email_unverified", "requiredCredits": 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.
Refused: origin_forbidden, forbidden, feature_disabled, 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: cut_out_exhausted
object
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.
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
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.
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.
Examples
cut_out_exhausted
{ "attempts": 0, "cutOut": { "assetId": "string", "contentKey": "string", "heightPx": 0, "widthPx": 0 }, "error": "cut_out_exhausted", "retryable": false, "status": "running"}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: cut_out_not_offered, payload_too_large
object
Sent with payload_too_large.
Always sent with payload_too_large.
Examples
cut_out_not_offered
{ "error": "cut_out_not_offered"}payload_too_large
{ "error": "payload_too_large", "maxBytes": 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.
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, cut_out_unavailable
object
Examples
cut_out_unavailable
{ "error": "cut_out_unavailable"}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].