Single Image
1. Registering an image
const apiKey = "YOUR_API_KEY";
const blob = Blob // Blob or File of your image
const createImage = async (apiKey, blob) => {
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"
}),
}
);
const { upload_url, order_id, image_id } = await createImageResponse.json();
}import requests
import json
api_key = "YOUR_API_KEY"
def create_image(api_key, image_name, file):
url = "https://api.autoenhance.ai/v3/images/"
headers = {
"Content-Type": "application/json",
"x-api-key": api_key,
}
payload = {
"image_name": image_name
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
if response.status_code == 200:
data = response.json()
s3_put_object_url = data.get('upload_url')
order_id = data.get('order_id')
image_id = data.get('image_id')
return s3_put_object_url, order_id, image_id
else:
response.raise_for_status()
2. Uploading image
3. Downloading image
Last updated
Was this helpful?