Listing and Pagination

The orders endpoint allows you to retrieve your orders with support for pagination using an offset. This enables you to efficiently navigate through large sets of orders. The endpoint supports per_page and offset query parameters. To retrieve orders with pagination, you must provide a valid API key.

Retrieving a list of orders with a set per page limit

const apiKey = "YOUR_API_KEY";
const perPage = 16;

const getOrders = async (perPage, apiKey) => {
    const getOrdersResponse = await fetch(
      `https://api.autoenhance.ai/v3/orders?per_page=${perPage}`,
      { 
        method: "GET",
        headers:{
          "x-api-key": apiKey,  
        }
      }
    );

    const { orders, pagination } = await getOrdersResponse.json();
}

As you can see, the response returns an orders, and pagination object. The orders object contains the list of your orders, and pagination contains two values: per_page, and next_offset.

Retrieving a paginated list of orders

If you want to load more orders with a pagination (next batch of orders without the initial orders that you've already fetched), you will need to use the next_offset value in your next request.

The value next_offset is returned from in the object that is returned from retrieving a list of orders with a set per page limit

const apiKey = "YOUR_API_KEY";
const pagination = { per_page:16, next_offset:"string" };

const loadMoreOrders = async (perPage, nextOffset, apiKey) => {
    const loadMoreOrdersResponse = await fetch(
      `https://api.autoenhance.ai/v3/orders?per_page=${perPage}&offset=${nextOffset}`,
      { 
        method: "GET",
        headers:{
          "x-api-key": apiKey,  
        }
      }
    );

    const { orders, pagination } = await getOrdersResponse.json();
}

Important note The response will always return pagination object with values that will enable you to fetch next batch of orders if you still have more orders to fetch.

Specification

List Orders

Lists the orders for the current user.

GEThttps://api.autoenhance.ai//v3/orders/
Authorization
Query parameters
Response

Successful response

Body
ordersarray of OrderOut (object)
paginationPagination (object)
Request
const response = await fetch('https://api.autoenhance.ai//v3/orders/', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "orders": [
    {
      "created_at": "2024-11-21T06:29:56.744Z",
      "images": [
        {
          "ai_version": "text",
          "brightness_boost": "NONE",
          "brightness_boost_external": "NONE",
          "brightness_boost_internal": "NONE",
          "clarity_level": "NONE",
          "cloud_type": "CLEAR",
          "contrast_boost": "NONE",
          "contrast_boost_external": "NONE",
          "contrast_boost_internal": "NONE",
          "denoise_level": "NONE",
          "downloaded": false,
          "enhance": true,
          "enhance_type": "property",
          "image_id": "123e4567-e89b-12d3-a456-426614174000",
          "image_name": "text",
          "image_type": "text",
          "lens_correction": true,
          "order_id": "text",
          "privacy": false,
          "saturation_level": "NONE",
          "scene": "text",
          "sharpen_level": "NONE",
          "sky_replacement": false,
          "status": "waiting",
          "user_id": "text",
          "vertical_correction": false,
          "window_pull": false
        }
      ],
      "is_merging": false,
      "last_updated_at": "2024-11-21T06:29:56.744Z",
      "name": "text",
      "order_id": "text",
      "status": "waiting"
    }
  ],
  "pagination": {
    "next_offset": "text"
  }
}

Last updated