For the complete documentation index, see llms.txt. This page is also available as Markdown.

Premium Edits

Apply a premium edit such as Day to Dusk to an image you have already processed

Premium edits are restaging options that create a new image from one you have already processed, instead of changing the original. Currently the only premium edit is Day to Dusk (see Restaging).

Because the edit is applied after the first enhancement, you review the standard result first and choose which images are worth a premium edit.

This guide assumes you already have an API key and an image that has finished processing. If not, see the Quickstart guides first.

1

Upload and process the image

Create and upload the image as usual and wait for it to finish processing. Do not include restage.environment in this request, or it is rejected with a 422 and the error code PREMIUM_RESTAGE_ON_INITIAL_PROCESSING.

2

Request the premium edit

Update the processed image, using its image_id, with the premium edit in the restage object. The request is a PUT to /v3/images/{image_id}.

const apiKey = "YOUR_API_KEY";
const imageId = "ID_OF_YOUR_IMAGE";

const requestPremiumEdit = async (imageId, apiKey) => {
    const response = await fetch(
      `https://api.autoenhance.ai/v3/images/${imageId}`,
      {
        method: "PUT",
        headers: {
          "Content-Type": "application/json",
          "x-api-key": apiKey,
        },
        body: JSON.stringify({
          restage: { environment: "DUSK" }
        }),
      }
    );

    // 201 Created: the new image is at the Location header
    const location = response.headers.get("Location");
    const newImageId = location.split("/").pop();

    return newImageId;
}

The response is 201 Created. The body is the original image, unchanged. The Location header is the path of the new image, for example /images/<new_image_id>.

3

Wait for the new image to process

The new image is processed like any other image. Check its status with a GET request to /images/:image_id:/ using the new image's ID, until the status is "processed", or use webhooks. Its parent_image_id is the image you started from.

4

Download the result

Download the new image with the /images/:image_id:/enhanced endpoint, as you would any enhanced image. Day to Dusk images are billed through their add-on, so the download does not use a plan credit.

Things to know

  • The original image keeps its standard enhancement. Each premium edit request creates another new image.

  • To change how the new image is finished, send finetune_settings or preset_id in the same request. Send nothing else alongside restage, otherwise the original is reprocessed instead.

  • If you see PREMIUM_RESTAGE_ON_INITIAL_PROCESSING, move environment out of your upload or order request and into this follow-up update.

Was this helpful?