Web SDK
The Web SDK provides the same pre-built components used in our Web app to power your application.

Integrating SDK
To install the SDK into your application is as simple as adding a script tag and providing your API key as an attribute in the HTML.
You can specify a specific version of the SDK according to the rules documented here https://unpkg.com
To add the Autoenhance uploader into your application, you simply add our image-uploader Web component
Now when the page has loaded you should see automatically the Autoenhance uploader. Your code should now look something like this:
Attributes
Name
To specify that of the form filed sent to your server containing the order_id, then just provide a name attribute just like you would with any input field
Required
To specify that it's required to upload images to Autoenhance then just provide a required attribute just like you would with any input field
Preferences
You can control the default enhancement settings sent to Autoenhance by providing a preferencesattrbiute containing JSON in the same format documented in our Reprocessing documentation
For example to specify the API version
Disable Status Bar
To hide the default upload bar shown in the uploader, simply pass true
Max Files
To maximum files a user can upload, simply pass a number. Defaults to 500 files.
Max Height
To set up how large in height the upload box can grow at maximum. It accepts string values and it must include the units after a number eg. 300px or 25rem.
Changing the theme - light or dark mode
To change the appearance (eg. dark mode) of the uploader specify a theme property. The property accepts two values - light or dark. The default value is set to light
Handling Uploading Orders
There are two ways for your application to react to the user uploading an order with the image uploader.
Form Fields
If your image uploader is contained within a form, the Order ID for the Autoenhance Order will be submitted along side the rest of your form's data. Your server can then use this ID to communicate with the Autoenhance API to retrieve it's status and download the images.
Events
You can use event listeners to listen to the change, complete, progress and error events, in order to updae your applications UI state in response to a user's interaction with the uploader.
Here is an example
Properties And Methods
Files
You can access the files selected to be uploaded by the user by accessing the files property
Upload
You can programatically trigger the upload using the upload method on the web component
Value
To get the order ID that will be used by the uploader, you can use the value property the same as any other input field.
Example Projects
You can see some example projects which demonstrate how to use the Web SDK https://github.com/Autoenhance-ai/API-Code-Examples
Last updated