### List Orders (JavaScript) Source: https://docs.autoenhance.ai/orders/managing-orders/listing-and-pagination Example of how to list orders using JavaScript. This demonstrates making a GET request to the API endpoint with the necessary headers. ```JavaScript fetch('https://api.autoenhance.ai/v3/orders/', { method: 'GET', headers: { 'x-api-key': 'YOUR_API_KEY', 'Accept': '*/*' } }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` -------------------------------- ### Process Order (cURL) Source: https://docs.autoenhance.ai/getting-started/quickstart/hdr This example shows how to initiate the order processing after all brackets have been uploaded, using cURL. You can specify the AI version and how brackets should be grouped per image. ```APIDOC ## Process Order ### Description Initiates the processing of an order after all associated image brackets have been uploaded. Allows specifying AI version and bracket grouping. ### Method POST ### Endpoint `https://api.autoenhance.ai/v3/orders/{YOUR_ORDER_ID}/process` ### Parameters #### Path Parameters - **YOUR_ORDER_ID** (string) - Required - The unique identifier for the order. #### Request Body - **ai_version** (string) - Optional - Specifies the AI version to use. Example: `"5.x"`. - **number_of_brackets_per_image** (integer) - Optional - Defines how many brackets should be grouped into a single image. Autoenhance sorts brackets by capture time if this is set. ### Headers - **Content-Type**: `application/json` - **x-api-key**: Your API key ### Request Example (cURL) ```bash curl -X POST \ https://api.autoenhance.ai/v3/orders/YOUR_ORDER_ID/process \ -H 'Content-Type: application/json' \ -H 'x-api-key: YOUR_API_KEY' \ -d '{"ai_version": "5.x" }' ``` ``` -------------------------------- ### Create and Upload Image with Enhancements (PHP) Source: https://docs.autoenhance.ai/images/basic-enhancements/usage-example This PHP example demonstrates creating and uploading an image using the AutoEnhance AI API with various enhancements. It utilizes stream contexts for HTTP requests and requires a local image file. ```php $api_key = 'YOUR_API_KEY'; $preferences = array( 'enhance_type' => 'property', 'sky_replacement' => true, 'cloud_type' => 'CLEAR', 'vertical_correction' => true, 'auto_privacy' => true ); function create_image($api_key, $preferences) { $data = array_merge(array( 'image_name' => 'your-image-name', 'contentType' => 'image/jpeg' ), $preferences); $url = "https://api.autoenhance.ai/v3/images/"; $options = array( 'http' => array( 'header' => "Content-Type: application/json\r\n" . "x-api-key: $api_key", 'method' => 'POST', 'content' => json_encode($data), ), ); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); if ($result === FALSE) { return 'Error creating image'; } $response = json_decode($result, true); $s3PutObjectUrl = $response['s3PutObjectUrl']; $image_path = '/path/to/your/image.jpg'; $image_data = file_get_contents($image_path); $upload_options = array( 'http' => array( 'header' => "Content-Type: image/jpeg\r\n" . "x-api-key: $api_key", 'method' => 'PUT', 'content' => $image_data, ), ); $upload_context = stream_context_create($upload_options); $upload_result = file_get_contents($s3PutObjectUrl, false, $upload_context); if ($upload_result === FALSE) { return 'Error uploading image'; } return 'Image successfully uploaded'; } ``` -------------------------------- ### HTTP Request Example Source: https://docs.autoenhance.ai/images/managing-images/retrieveing Demonstrates the raw HTTP GET request structure to retrieve an image from the Autoenhance.ai API. ```HTTP GET /v3/images/{id} HTTP/1.1 Host: api.autoenhance.ai Accept: */* ``` -------------------------------- ### Webhook Setup Source: https://docs.autoenhance.ai/webhooks Describes the process of setting up a webhook subscription through the Autoenhance.ai web application. This involves providing a webhook URL and an optional authentication value. ```APIDOC ## Webhook Setup ### Description Configure your webhook URL and authentication in the API page of the Autoenhance.ai web application to receive real-time updates. ### Method POST ### Endpoint /api/webhooks/setup ### Parameters #### Request Body - **webhook_url** (string) - Required - The URL to which webhook notifications will be sent. - **authentication_value** (string) - Optional - The authentication token to be included in webhook requests. ### Request Example ```json { "webhook_url": "https://your-domain.com/webhook-receiver", "authentication_value": "your-secret-token" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the webhook settings have been updated. #### Response Example ```json { "message": "Webhook settings updated successfully." } ``` ### Event Triggered A POST request with the event `webhook_updated` is sent to the configured webhook URL upon successful setup. ``` -------------------------------- ### GET /images/:image_id:/preview Source: https://docs.autoenhance.ai/getting-started/quickstart/web-sdk-beta Provides a preview of the enhanced image without consuming credits. This is useful for allowing users to see the result before committing to a download. ```APIDOC ## GET /images/:image_id:/preview ### Description Provides a preview of the enhanced image without consuming credits. This is useful for allowing users to see the result before committing to a download. ### Method GET ### Endpoint /images/:image_id:/preview ### Parameters #### Path Parameters - **image_id** (string) - Required - The unique identifier for the image. ### Request Example ``` GET https://api.autoenhance.ai/v3/images/img_abc/preview Headers: x-api-key: YOUR_API_KEY ``` ### Response #### Success Response (200) - The response body contains a URL or data for the image preview. #### Response Example ```json { "image_id": "img_abc", "preview_url": "https://cdn.autoenhance.ai/path/to/preview_image.jpg" } ``` ``` -------------------------------- ### Create and Upload Image (JavaScript) Source: https://docs.autoenhance.ai/images/basic-enhancements/usage-example This snippet shows how to create an image and upload it using JavaScript, including setting enhancement preferences. ```APIDOC ## POST /v3/images/ ### Description Creates a new image entry and provides an S3 URL for uploading the image. It allows specifying various enhancement preferences. ### Method POST ### Endpoint https://api.autoenhance.ai/v3/images/ ### Parameters #### Request Body - **image_name** (string) - Required - The name for the image. - **contentType** (string) - Required - The content type of the image, e.g., 'image/jpeg'. - **enhance_type** (string) - Optional - The type of enhancement, e.g., 'property'. - **sky_replacement** (boolean) - Optional - Whether to replace the sky. - **cloud_type** (string) - Optional - The type of cloud to use for replacement (e.g., 'CLEAR'). - **vertical_correction** (boolean) - Optional - Whether to apply vertical correction. - **auto_privacy** (boolean) - Optional - Whether to apply auto-privacy settings. ### Request Example ```json { "image_name": "your-image-name", "contentType": "image/jpeg", "enhance_type": "property", "sky_replacement": true, "cloud_type": "CLEAR", "vertical_correction": true, "auto_privacy": true } ``` ### Response #### Success Response (200) - **s3PutObjectUrl** (string) - The S3 URL to upload the image to. - **order_id** (string) - The ID of the order associated with the image. - **image_id** (string) - The ID of the created image. #### Response Example ```json { "s3PutObjectUrl": "https://your-s3-bucket.s3.amazonaws.com/your-image-name?AWSAccessKeyId=...", "order_id": "ord_12345", "image_id": "img_abcde" } ``` ## PUT /upload/image ### Description Uploads the image file to the provided S3 URL. ### Method PUT ### Endpoint [S3 Put Object URL provided in the POST response] ### Parameters #### Request Body - **Image File** (binary) - The image file content. ### Request Example [Binary data of the image file] ### Response #### Success Response (200) Indicates the image was successfully uploaded. ``` -------------------------------- ### Create and Upload Image with Enhancements (JavaScript) Source: https://docs.autoenhance.ai/images/basic-enhancements/usage-example This JavaScript example demonstrates how to create an image and upload it using the AutoEnhance AI API. It includes basic enhancements like sky replacement and vertical correction. Requires the fetch API. ```javascript 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'); } }; ``` -------------------------------- ### Full HTML Example with Autoenhance Uploader Source: https://docs.autoenhance.ai/web-sdk-beta A complete HTML structure demonstrating the integration of the Autoenhance.ai Web SDK and the `image-uploader` component within a form. ```html My Application

Upload a photo to enhance

``` -------------------------------- ### Check Status and Download Image (cURL) Source: https://docs.autoenhance.ai/getting-started/quickstart/hdr Examples using cURL to interact with the Autoenhance.ai API. One command checks the status of an image, and the other downloads the enhanced image, requiring an API key. ```curl Check image status curl -X GET \ https://api.autoenhance.ai/v3/images/ID_OF_YOUR_IMAGE \ -H 'Content-Type: application/json' Download image curl -X GET \ https://api.autoenhance.ai/v3/images/ID_OF_YOUR_IMAGE/enhanced \ -H 'Content-Type: application/json' \ -H 'x-api-key: YOUR_API_KEY' ``` -------------------------------- ### Create Image (cURL) Source: https://docs.autoenhance.ai/images/basic-enhancements/usage-example This snippet shows how to create an image using cURL, including the necessary headers and request body. ```APIDOC ## POST /v3/images/ ### Description Creates a new image entry and provides an S3 URL for uploading the image. It allows specifying various enhancement preferences. ### Method POST ### Endpoint https://api.autoenhance.ai/v3/images/ ### Parameters #### Request Body - **image_name** (string) - Required - The name for the image. - **contentType** (string) - Required - The content type of the image, e.g., 'image/jpeg'. - **enhance_type** (string) - Optional - The type of enhancement, e.g., 'property'. - **sky_replacement** (boolean) - Optional - Whether to replace the sky. - **cloud_type** (string) - Optional - The type of cloud to use for replacement (e.g., 'CLEAR'). - **vertical_correction** (boolean) - Optional - Whether to apply vertical correction. - **auto_privacy** (boolean) - Optional - Whether to apply auto-privacy settings. ### Request Example ```json { "image_name": "your-image-name", "contentType": "image/jpeg", "enhance_type": "property", "sky_replacement": true, "cloud_type": "CLEAR", "vertical_correction": true, "auto_privacy": true } ``` ### Response #### Success Response (200) - **s3PutObjectUrl** (string) - The S3 URL to upload the image to. - **order_id** (string) - The ID of the order associated with the image. - **image_id** (string) - The ID of the created image. #### Response Example ```json { "s3PutObjectUrl": "https://your-s3-bucket.s3.amazonaws.com/your-image-name?AWSAccessKeyId=...", "order_id": "ord_12345", "image_id": "img_abcde" } ``` ``` -------------------------------- ### Upload Brackets (cURL) Source: https://docs.autoenhance.ai/getting-started/quickstart/hdr This example demonstrates how to upload individual image brackets using cURL. Each bracket upload requires the order ID, API key, and the image file name. ```APIDOC ## Upload Brackets ### Description Uploads individual image brackets to the Autoenhance.ai API. ### Method POST ### Endpoint `https://api.autoenhance.ai/v3/brackets/` ### Parameters #### Request Body - **order_id** (string) - Required - The unique identifier for the order. - **name** (string) - Required - The name of the image file. ### Headers - **Content-Type**: `application/json` - **x-api-key**: Your API key ### Request Example (cURL) ```bash curl -X POST \ https://api.autoenhance.ai/v3/brackets/ \ -H 'Content-Type: application/json' \ -H 'x-api-key: YOUR_API_KEY' \ -d '{ \ "order_id": "YOUR_ORDER_ID", \ "name": "your-image-name.jpg" \ }' ``` ``` -------------------------------- ### List Orders (Python) Source: https://docs.autoenhance.ai/orders/managing-orders/listing-and-pagination Example of how to list orders using Python with the 'requests' library. This shows how to set up the request with the API key in the headers. ```Python import requests api_key = 'YOUR_API_KEY' url = 'https://api.autoenhance.ai/v3/orders/' headers = { 'x-api-key': api_key, 'Accept': '*/*' } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") ``` -------------------------------- ### Create and Upload Image with Enhancements (Python) Source: https://docs.autoenhance.ai/images/basic-enhancements/usage-example This Python example uses the 'requests' library to create an image and upload it via the AutoEnhance AI API. It showcases various enhancements and requires a local image file path. ```python import requests api_key = 'YOUR_API_KEY' preferences = { 'enhance_type': 'property', 'sky_replacement': True, 'cloud_type': 'CLEAR', 'vertical_correction': True, 'auto_privacy': True, } def create_image(api_key, preferences, image_path): create_image_response = requests.post( 'https://api.autoenhance.ai/v3/images/', headers={ 'Content-Type': 'application/json', 'x-api-key': api_key, }, json={ 'image_name': 'your-image-name', 'contentType': 'image/jpeg', **preferences } ) if create_image_response.status_code != 200: print('Error creating image') return create_image_data = create_image_response.json() s3_put_object_url = create_image_data['s3PutObjectUrl'] order_id = create_image_data['order_id'] image_id = create_image_data['image_id'] with open(image_path, 'rb') as image_file: upload_image_response = requests.put( s3_put_object_url, headers={ 'Content-Type': 'image/jpeg', 'x-api-key': api_key, }, data=image_file ) if upload_image_response.status_code == 200: print('Image successfully uploaded') else: print('Error uploading image') ``` -------------------------------- ### Create Order - cURL Source: https://docs.autoenhance.ai/getting-started/quickstart/hdr A command-line example using cURL to create an order for HDR bracket processing via the Autoenhance.ai API. It performs a POST request to the /orders endpoint, setting the 'Content-Type' and 'x-api-key' headers. ```curl curl -X POST \ https://api.autoenhance.ai/v3/orders/ \ -H 'Content-Type: application/json' \ -H 'x-api-key: YOUR_API_KEY' ``` -------------------------------- ### Install Autoenhance.ai Web SDK Source: https://docs.autoenhance.ai/web-sdk-beta Integrates the Autoenhance.ai Web SDK into your application by adding a script tag to your HTML. Requires an API key provided as an attribute. You can specify a version by adjusting the URL. ```html ``` -------------------------------- ### Check Image Status and Download Enhanced Image (JavaScript) Source: https://docs.autoenhance.ai/getting-started/quickstart/single-bracket This snippet demonstrates how to check the status of an image processing job and then download the enhanced image using JavaScript. It makes GET requests to the Autoenhance AI API. Dependencies include the Fetch API. ```javascript const apiKey = "YOUR_API_KEY"; const imageId = "ID_OF_YOUR_IMAGE"; const checkImageStatus = async (imageId) => { const response = await fetch(`https://api.autoenhance.ai/v3/images/${imageId}`,{ method: "GET" }) const {enhanced, error} = await response.json(); return { enhanced:enhanced, error:error } } const downloadImage = async (imageId, apiKey) => { const imageStatus = await checkImageStatus(imageId); if(!imageStatus.error && imageStatus.enhanced){ const response = await fetch( `https://api.autoenhance.ai/v3/images/${imageId}/enhanced`, { method: "GET", headers: { "x-api-key": apiKey, }, }); const imageSource = await response.json() return imageSource } } ``` -------------------------------- ### Upload Bracket and Image using cURL Source: https://docs.autoenhance.ai/getting-started/quickstart/hdr This section provides cURL commands for uploading image brackets to Autoenhance AI. It includes two commands: the first is a POST request to create a bracket record and get an upload URL, requiring your API key and order ID. The second command is a PUT request to upload the actual image file to the obtained URL, using the `--data-binary` flag to specify the file path. ```bash Create image curl -X POST \ https://api.autoenhance.ai/v3/brackets/ \ -H 'Content-Type: application/json' \ -H 'x-api-key: YOUR_API_KEY' \ -d '{ "order_id": "YOUR_ORDER_ID", "name": "your-image-name.jpg", }' Upload Image Replace UPLOAD_URL with the value of s3PutObjectUrl received from the previous response curl -X PUT \ UPLOAD_URL \ -H 'Content-Type: application/octet-stream' \ -H 'x-api-key: YOUR_API_KEY' \ --data-binary @path/to/your/image.jpg ``` -------------------------------- ### List Orders (cURL) Source: https://docs.autoenhance.ai/orders/managing-orders/listing-and-pagination Example of how to list orders using cURL. This requires your API key and specifies the host and accepted content type. ```HTTP GET /v3/orders/ HTTP/1.1 Host: api.autoenhance.ai x-api-key: YOUR_API_KEY Accept: */* ``` -------------------------------- ### Upload Brackets and Process Order Source: https://docs.autoenhance.ai/getting-started/quickstart/hdr This section details how to upload multiple image brackets for an order and then process the order. ```APIDOC ## POST /v3/brackets/ ### Description Uploads an individual image bracket to a specified order. ### Method POST ### Endpoint https://api.autoenhance.ai/v3/brackets/ ### Parameters #### Headers - **x-api-key** (string) - Required - Your API key for authentication. - **Content-Type** (string) - Required - Should be 'application/json'. #### Request Body - **order_id** (string) - Required - The ID of the order to associate the bracket with. - **name** (string) - Required - The name of the image file (e.g., 'your-image-name.jpg'). ### Request Example ```json { "order_id": "YOUR_ORDER_ID", "name": "your-image-name.jpg" } ``` ### Response #### Success Response (200) Returns a JSON object containing the `bracket_id` for the uploaded bracket. #### Response Example ```json { "bracket_id": "some_unique_bracket_id" } ``` ## POST /v3/orders/{order_id}/process ### Description Processes an order by merging uploaded brackets, optionally specifying the number of brackets per image. ### Method POST ### Endpoint https://api.autoenhance.ai/v3/orders/{order_id}/process ### Parameters #### Path Parameters - **order_id** (string) - Required - The ID of the order to process. #### Headers - **x-api-key** (string) - Required - Your API key for authentication. - **Content-Type** (string) - Required - Should be 'application/json'. #### Request Body - **images** (array) - Required - An array of objects, where each object contains a `bracket_ids` array. - **bracket_ids** (array of strings) - Required - An array of bracket IDs to be grouped for processing. - **number_of_brackets_per_image** (integer) - Optional - Specifies how many brackets to use per image. - **ai_version** (string) - Optional - Specifies the AI version to use (e.g., '5.x'). ### Request Example ```json { "images": [ { "bracket_ids": ["bracket_id_1", "bracket_id_2", "bracket_id_3"] } ], "number_of_brackets_per_image": 5, "ai_version": "5.x" } ``` ### Response #### Success Response (200) Returns a JSON object containing a URL to the Autoenhance web application where the order can be viewed. #### Response Example ```json { "url": "https://app.autoenhance.ai/orders/YOUR_UNIQUE_ORDER_ID" } ``` ``` -------------------------------- ### POST /v3/images/ Source: https://docs.autoenhance.ai/getting-started/quickstart/single-bracket Registers a new image with Autoenhance.ai to prepare for enhancement. This endpoint creates a record for the image and provides a unique upload URL in the response. ```APIDOC ## POST /v3/images/ ### Description Registers a new image with Autoenhance.ai for enhancement. This process involves creating a record for the image and generating a unique upload URL. ### Method POST ### Endpoint https://api.autoenhance.ai/v3/images/ ### Parameters #### Request Body - **image_name** (string) - Required - The name of the image file. - **image_id** (uuid) - Optional - A unique identifier for the image (UUID v4 recommended). - **order_id** (uuid) - Optional - A unique identifier to group multiple images into the same order (UUID v4 recommended). ### Request Example ```json { "image_name": "your-image-name" } ``` ### Response #### Success Response (200) - **upload_url** (string) - The URL where the image file should be uploaded. - **order_id** (string) - The ID of the order the image belongs to. - **image_id** (string) - The unique ID of the registered image. #### Response Example ```json { "upload_url": "https://s3.amazonaws.com/bucket/image.jpg?AWSAccessKeyId=...", "order_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "image_id": "123e4567-e89b-12d3-a456-426614174000" } ``` ``` -------------------------------- ### Download Enhanced Image Source: https://docs.autoenhance.ai/getting-started/quickstart/hdr Downloads the enhanced version of an image. Requires the image to be processed and enhanced first. ```APIDOC ## GET /v3/images/{imageId}/enhanced ### Description Downloads the enhanced version of an image. Requires the image to be processed and enhanced first. ### Method GET ### Endpoint /v3/images/{imageId}/enhanced ### Parameters #### Path Parameters - **imageId** (string) - Required - The unique identifier of the image. #### Request Headers - **x-api-key** (string) - Required - Your AutoEnhance AI API key. ### Response #### Success Response (200) - The response body will contain the enhanced image data. ``` -------------------------------- ### Process and Enhance Images in Orders (PHP) Source: https://docs.autoenhance.ai/getting-started/quickstart/web-sdk-beta This snippet iterates through images associated with an order. If an image is marked for enhancement, it downloads the image and adds the enhanced version to a list. It depends on a `download_image` function and an `$apiKey` and `$baseUrl`. ```php foreach ($order['images'] ?? [] as $img) { if (!empty($img['enhance'])) { list($downloaded, $dErr) = download_image($img['image_id'], $apiKey, $baseUrl); if (!$dErr) { $enhancedImages[] = $downloaded; } } } echo json_encode(['order' => $order, 'enhanced_images' => $enhancedImages]); ``` -------------------------------- ### Upload Brackets and Process Order (Python) Source: https://docs.autoenhance.ai/getting-started/quickstart/hdr This Python function uploads image brackets and then processes the order. It uses the `requests` library for HTTP requests and returns a URL to view the order. ```APIDOC ## Upload Brackets and Process Order (Python) ### Description Uploads image brackets for an order and then initiates the order processing. Returns a URL to the Autoenhance web application for the order. ### Method POST ### Endpoint `https://api.autoenhance.ai/v3/orders/{order_id}/process` ### Parameters #### Path Parameters - **order_id** (string) - Required - The unique identifier for the order. #### Request Body (for process endpoint) - **number_of_brackets_per_image** (integer) - Optional - Specifies how many brackets to group per image. Autoenhance sorts by capture time if provided. ### Request Example (Python) ```python import requests def upload_all_brackets(api_key, files, order_id): # Assuming upload_bracket function exists and handles individual file uploads for file in files: upload_bracket(order_id, api_key, file) merge_url = f"https://api.autoenhance.ai/v3/orders/{order_id}/process" merge_headers = {"x-api-key": api_key} merge_response = requests.post(merge_url, headers=merge_headers, json={ "number_of_brackets_per_image": 5 }) if merge_response.status_code != 200: raise Exception(f"Failed to merge order: {merge_response.text}") #This is an URL to our web application where you can #take a look at your order, you don't need to return it. return f"https://app.autoenhance.ai/orders/{order_id}" api_key = "YOUR_API_KEY" files = [open('file1.jpg', 'rb'), open('file2.jpg', 'rb'), open('file3.jpg', 'rb')] # List of file objects order_id = "YOUR_UNIQUE_ORDER_ID" # Ideally generated with uuid.uuid4() order_url = upload_all_brackets(api_key, files, order_id) ``` ``` -------------------------------- ### Upload Brackets and Process Order (JavaScript) Source: https://docs.autoenhance.ai/getting-started/quickstart/hdr This JavaScript function handles uploading image brackets and then processing the order. It uses async/await for handling asynchronous operations and returns a URL to view the order. ```APIDOC ## Upload Brackets and Process Order (JavaScript) ### Description Uploads image brackets for an order and then initiates the order processing. Returns a URL to the Autoenhance web application for the order. ### Method POST ### Endpoint `/v3/orders/${orderId}/process` ### Parameters #### Path Parameters - **orderId** (string) - Required - The unique identifier for the order. #### Request Body (for process endpoint) - **number_of_brackets_per_image** (integer) - Optional - Specifies how many brackets to group per image. Autoenhance sorts by capture time if provided. ### Request Example (JavaScript) ```javascript const uploadAllBrackets = async (apiKey, files, orderId) => { // Assuming uploadBracket function exists and handles individual file uploads const promises = files.map(file => uploadBracket(orderId, apiKey, file)); await Promise.all(promises); const mergeResponse = await fetch( `https://api.autoenhance.ai/v3/orders/${orderId}/process`, { method: "POST", headers: { "x-api-key": apiKey, }, body: JSON.stringify({ number_of_brackets_per_image: 5 }) } ); // This is an URL to our web application where you can // take a look at your order, you don't need to return it. return `https://app.autoenhance.ai/orders/${orderId}` }; const apiKey = YOUR_API_KEY; const files = [File, File, File] // Array of Files or Blobs const orderId = "YOUR_UNIQUE_ORDER_ID" // Ideally generated with uuidv4 uploadAllBrackets(apiKey, files, orderId) ``` ``` -------------------------------- ### Upload and Process Brackets (JavaScript) Source: https://docs.autoenhance.ai/getting-started/quickstart/hdr Uploads multiple bracket photos for an order and initiates the AI processing for grouping and enhancement. It sends an API request to the Autoenhance server with specified preferences. ```javascript const uploadAllBrackets = async (apiKey, files, orderId) => { const promises = files.map(file => uploadBracket(orderId, apiKey, file)); await Promise.all(promises); const preferences = { ai_version: '5.x' }; const mergeResponse = await fetch( `https://api.autoenhance.ai/v3/orders/${orderId}/process`, { method: "POST", headers: { "x-api-key": apiKey, } body: preferences } ); // This is an URL to our web application where you can // take a look at your order, you don't need to return it. return `https://app.autoenhance.ai/orders/${orderId}` }; const apiKey = YOUR_API_KEY; const files = [File, File, File] // Array of Files or Blobs const orderId = "YOUR_UNIQUE_ORDER_ID" // Ideally generated with uuidv4 uploadAllBrackets(apiKey, files, orderId) ``` -------------------------------- ### Upload Brackets and Process Order (PHP) Source: https://docs.autoenhance.ai/getting-started/quickstart/hdr This PHP function uploads multiple image brackets for a given order and then initiates the order processing. It returns a URL to the web application where the order can be viewed. ```APIDOC ## Upload Brackets and Process Order ### Description Uploads multiple image brackets for a given order and then initiates the order processing. Returns a URL to the web application where the order can be viewed. ### Method POST ### Endpoint `/v3/orders/{order_id}/process` ### Parameters #### Path Parameters - **order_id** (string) - Required - The unique identifier for the order. #### Request Body - **ai_version** (string) - Optional - Specifies the AI version to use for processing. Defaults to "5.x". - **number_of_brackets_per_image** (integer) - Optional - If provided, Autoenhance will sort brackets by capture time and group them into images. For example, if set to 3, every 3 brackets will form one image. ### Request Example (PHP) ```php "5.x" ]; $merge_options = array( 'http' => array( 'header' => "x-api-key: $api_key", 'method' => 'POST', 'content' => json_encode($preferences), ), ); $merge_context = stream_context_create($merge_options); $merge_result = file_get_contents($merge_url, false, $merge_context); if ($merge_result === FALSE) { return 'Error merging brackets'; } // Return the URL to the web application return "https://app.autoenhance.ai/orders/$order_id"; } $api_key = "YOUR_API_KEY"; $files = [/* Array of Files or Blobs */]; $order_id = "YOUR_UNIQUE_ORDER_ID"; upload_all_brackets($api_key, $files, $order_id); ?> ``` ### Response #### Success Response (200) Returns a URL to the Autoenhance web application for the processed order. #### Response Example ``` https://app.autoenhance.ai/orders/YOUR_UNIQUE_ORDER_ID ``` ``` -------------------------------- ### Create Image Request (cURL, JavaScript, Python) Source: https://docs.autoenhance.ai/images/managing-images/creating-and-uploading This snippet demonstrates how to create an image using the Autoenhance.ai API. It includes request parameters for image enhancement, sky replacement, and other options. The examples are provided in cURL, JavaScript, and Python for easy integration. ```curl POST /v3/images/ HTTP/1.1 Host: api.autoenhance.ai x-api-key: YOUR_API_KEY Content-Type: application/json Accept: */* Content-Length: 389 { "ai_version": "text", "cloud_type": "CLEAR", "enhance": true, "enhance_type": "property", "finetune_settings": {}, "image_name": "text", "lens_correction": true, "metadata": { "ANY_ADDITIONAL_PROPERTY": "anything" }, "order_id": "text", "privacy": true, "rating": 1, "sky_replacement": true, "threesixty": true, "upscale": true, "vertical_correction": true, "window_pull_type": "NONE", "ANY_ADDITIONAL_PROPERTY": "anything" } ``` ```javascript const request = require('request'); const options = { 'method': 'POST', 'url': 'https://api.autoenhance.ai/v3/images/', 'headers': { 'x-api-key': 'YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ "ai_version": "text", "cloud_type": "CLEAR", "enhance": true, "enhance_type": "property", "finetune_settings": {}, "image_name": "text", "lens_correction": true, "metadata": { "ANY_ADDITIONAL_PROPERTY": "anything" }, "order_id": "text", "privacy": true, "rating": 1, "sky_replacement": true, "threesixty": true, "upscale": true, "vertical_correction": true, "window_pull_type": "NONE", "ANY_ADDITIONAL_PROPERTY": "anything" }) }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); }); ``` ```python import requests import json url = "https://api.autoenhance.ai/v3/images/" payload = json.dumps({ "ai_version": "text", "cloud_type": "CLEAR", "enhance": True, "enhance_type": "property", "finetune_settings": {}, "image_name": "text", "lens_correction": True, "metadata": { "ANY_ADDITIONAL_PROPERTY": "anything" }, "order_id": "text", "privacy": True, "rating": 1, "sky_replacement": True, "threesixty": True, "upscale": True, "vertical_correction": True, "window_pull_type": "NONE", "ANY_ADDITIONAL_PROPERTY": "anything" }) headers = { 'x-api-key': 'YOUR_API_KEY', 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) ``` -------------------------------- ### Upload Image using cURL Source: https://docs.autoenhance.ai/getting-started/quickstart/single-bracket Demonstrates uploading an image using a cURL command. It specifies the PUT method, sets the 'Content-Type' and 'x-api-key' headers, and uses '--data-binary' to send the raw image file content. ```bash curl -X PUT \ UPLOAD_URL \ -H 'Content-Type: application/octet-stream' \ -H 'x-api-key: YOUR_API_KEY' \ --data-binary @path/to/your/image.jpg ``` -------------------------------- ### PUT [upload_url] - Upload Image File Source: https://docs.autoenhance.ai/getting-started/quickstart/hdr Uploads the actual image file to the provided upload URL. This endpoint is used after successfully creating a bracket registration. ```APIDOC ## PUT [upload_url] ### Description Uploads the actual image file to the provided upload URL. This endpoint is used after successfully creating a bracket registration. ### Method PUT ### Endpoint [upload_url] (Received from the POST /v3/brackets/ response) ### Parameters #### Request Body - **File** (binary) - Required - The bracket image file content. ### Request Example ```bash curl -X PUT \ UPLOAD_URL \ -H 'Content-Type: application/octet-stream' \ -H 'x-api-key: YOUR_API_KEY' \ --data-binary @path/to/your/image.jpg ``` ### Response #### Success Response (200) Indicates the image was successfully uploaded. Specific response body may vary. #### Response Example ``` OK ``` ``` -------------------------------- ### Upload and Merge Brackets (cURL) Source: https://docs.autoenhance.ai/getting-started/quickstart/hdr This section provides cURL commands to upload image brackets and merge them into an order. It demonstrates the use of POST requests with JSON payloads and API keys for authentication. ```cURL for file in file1 file2 file3; do # Replace file1, file2, file3 with the actual paths to your files curl -X POST \ https://api.autoenhance.ai/v3/brackets/ \ -H 'Content-Type: application/json' \ -H 'x-api-key: YOUR_API_KEY' \ -d '{ "order_id": "YOUR_ORDER_ID", "name": "your-image-name.jpg" }' done Merge brackets curl -X POST \ https://api.autoenhance.ai/v3/orders/YOUR_ORDER_ID/process \ -H 'Content-Type: application/json' \ -H 'x-api-key: YOUR_API_KEY' \ -d '{"ai_version": "5.x" }' ``` -------------------------------- ### Download Preview Image using cURL Source: https://docs.autoenhance.ai/images/downloading-images/preview Demonstrates how to download a preview image from Autoenhance.ai using a cURL command. This command performs a GET request to the specified API endpoint with the image ID. ```bash curl -X GET \ 'https://api.autoenhance.ai/v3/images/YOUR_IMAGE_ID/preview' \ -H 'Content-Type: application/json' ``` -------------------------------- ### POST /v3/brackets/ - Upload Bracket Source: https://docs.autoenhance.ai/getting-started/quickstart/hdr Registers a bracket for a given order and provides an upload URL for the image file. The `order_id` links the bracket to a specific order, and the `name` property sets the filename for the final merged image. ```APIDOC ## POST /v3/brackets/ ### Description Registers a bracket for a given order and provides an upload URL for the image file. The `order_id` links the bracket to a specific order, and the `name` property sets the filename for the final merged image. ### Method POST ### Endpoint https://api.autoenhance.ai/v3/brackets/ ### Parameters #### Request Body - **order_id** (string) - Required - The ID of the order to which this bracket belongs. - **name** (string) - Required - The name of the bracket, which influences the final image's name. ### Request Example ```json { "order_id": "YOUR_ORDER_ID", "name": "your-image-name.jpg" } ``` ### Response #### Success Response (200) - **upload_url** (string) - The URL where the bracket image can be uploaded. #### Response Example ```json { "upload_url": "https://your-s3-upload-url.com/path/to/image.jpg?signature=..." } ``` ``` -------------------------------- ### HTTP Request Example for Editing Order Source: https://docs.autoenhance.ai/orders/managing-orders/editing Illustrates the raw HTTP request structure for patching an order via the Autoenhance.ai API. This includes the method, host, headers, and body for updating order details. ```http PATCH /v3/orders/{id} HTTP/1.1 Host: api.autoenhance.ai x-api-key: YOUR_API_KEY Content-Type: application/json Accept: */* Content-Length: 33 { "name": "text", "order_id": "text" } ``` -------------------------------- ### GET /orders/:order_id:/ Source: https://docs.autoenhance.ai/getting-started/quickstart/web-sdk-beta Retrieves the status of a specific order using its order ID. This is useful for tracking the processing of an uploaded image. ```APIDOC ## GET /orders/:order_id:/ ### Description Retrieves the status of a specific order using its order ID. This is useful for tracking the processing of an uploaded image. ### Method GET ### Endpoint /orders/:order_id:/ ### Parameters #### Path Parameters - **order_id** (string) - Required - The unique identifier for the order. ### Request Example ``` GET https://api.autoenhance.ai/v3/orders/12345/ Headers: x-api-key: YOUR_API_KEY ``` ### Response #### Success Response (200) - **status** (string) - The current processing status of the order (e.g., "processing", "processed"). - **images** (array) - A list of images associated with the order, each containing an `image_id` and an `enhance` boolean. #### Response Example ```json { "order_id": "12345", "status": "processed", "images": [ { "image_id": "img_abc", "enhance": true } ] } ``` ``` -------------------------------- ### GET /images/:image_id:/enhanced Source: https://docs.autoenhance.ai/getting-started/quickstart/web-sdk-beta Downloads the enhanced version of an image using its image ID. This endpoint is used after an order has been successfully processed. ```APIDOC ## GET /images/:image_id:/enhanced ### Description Downloads the enhanced version of an image using its image ID. This endpoint is used after an order has been successfully processed. ### Method GET ### Endpoint /images/:image_id:/enhanced ### Parameters #### Path Parameters - **image_id** (string) - Required - The unique identifier for the image. ### Request Example ``` GET https://api.autoenhance.ai/v3/images/img_abc/enhanced Headers: x-api-key: YOUR_API_KEY ``` ### Response #### Success Response (200) - The response body contains the enhanced image data. #### Response Example ```json { "image_id": "img_abc", "enhanced_image_url": "https://cdn.autoenhance.ai/path/to/enhanced_image.jpg" } ``` ```