Usage Example
const apiKey = 'YOUR_API_KEY';
const preferences = {
enhance_type: 'property',
sky_replacement: true,
cloud_type: 'CLEAR',
vertical_correction: true,
auto_privacy: true,
};
const createImage = async (apiKey, preferences) => {
const createImageResponse = await fetch('https://api.autoenhance.ai/v3/images/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': apiKey,
},
body: JSON.stringify({
image_name: 'your-image-name',
contentType: 'image/jpeg',
...preferences
}),
});
const { s3PutObjectUrl, order_id, image_id } = await createImageResponse.json();
const uploadImageResponse = await fetch(s3PutObjectUrl, {
method: 'PUT',
headers: {
'Content-Type': 'image/jpeg',
'x-api-key': apiKey,
},
body: blob,
});
if (uploadImageResponse.ok) {
console.log('Image successfully uploaded');
} else {
console.log('Error uploading image');
}
};Last updated
Was this helpful?