# Image Upscaler API

The Image Upscaler feature allows clients to upscale images using advanced AI technology. This feature is accessible through RESTful API endpoints, supporting operations such as initiating an upscaling process, monitoring progress, and downloading the upscaled images.

***

### Endpoints Overview <a href="#endpoints-overview" id="endpoints-overview"></a>

#### 1. **Start Image Upscaling Process** <a href="#id-1-start-image-upscaling-process" id="id-1-start-image-upscaling-process"></a>

**Description:**\
Initiates the image upscaling process for a given image.

**Details:**\
**URL**:\
`POST /api/v1/Image/Upscaling/AdCreative`\
**Full Path**:\
`https://api.adcreative.ai/api/v1/Image/Upscaling/AdCreative`

**Authorization**:\
Requires a Bearer Token and the following headers:

| Header          | Description                     | Example Value                  |
| --------------- | ------------------------------- | ------------------------------ |
| `Authorization` | Bearer token for authentication | `Bearer YOUR_BEARER_TOKEN`     |
| `x-api-key`     | API Key for the application     | `a1c3b5d7e9f6a8c4d2e9b3f7c5a9` |
| `x-api-secret`  | Secret Key for the application  | `f5c6a7b8e9d4f1a3c7b6e8f3a9d5` |
| `Content-Type`  | Specifies the data format       | `multipart/form-data`          |
| `Accept`        | Expected response format        | `application/json`             |

**Request Body (form-data)**:

<table data-full-width="true"><thead><tr><th width="250">Field</th><th width="125">Type</th><th width="127">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>applicationId</code></td><td><code>GUID</code></td><td>Yes</td><td>Unique identifier for the application initiating the request.</td></tr><tr><td><code>userId</code></td><td><code>GUID</code></td><td>Yes</td><td>Unique identifier for the user for whom the upscaling is performed.</td></tr><tr><td><code>uploadedImage</code></td><td><code>File</code></td><td>Yes</td><td>Image file to be upscaled (e.g., <code>.jpg</code> or <code>.png</code>).</td></tr></tbody></table>

***

#### Example Request

**cURL Command**:

```bash
curl --location 'https://api.adcreative.ai/api/v1/Image/Upscaling/AdCreative' \\
--header 'Content-Type: multipart/form-data' \\
--header 'Accept: application/json' \\
--header 'Authorization: Bearer <YOUR_BEARER_TOKEN>' \\
--header 'x-api-key: <YOUR_API_KEY>' \\
--header 'x-api-secret: <YOUR_API_SECRET>' \\
--form 'applicationId="4f7d8a9c-b5e6-4d3e-b7a9-d5c3e1b7a4f6"' \\
--form 'userId="2581c740-8e9d-4d63-96bc-5665bb9a646b"' \\
--form 'uploadedImage=@"/path/to/your/image.jpg"'
```

***

#### Example Responses

**Successful Response**

**HTTP Status Code**: `200 OK`\
**Response Body**:

```json
{
  "$id": "1",
  "messageType": "ImageUpscalingProgress",
  "requestRenderState": 1,
  "applicationId": "4f7d8a9c-b5e6-4d3e-b7a9-d5c3e1b7a4f6",
  "userId": "2581c740-8e9d-4d63-96bc-5665bb9a646b",
  "imageRenderProcessId": "e6c59f37-a794-468d-81aa-c9ef79dc042c",
  "totalTaskCount": 1,
  "completedTaskCount": 0,
  "progress": 0,
  "tasks": {
    "$id": "2",
    "50d04155-2bd9-46c1-85cb-47fa18cd02d7": 1
  },
  "renderType": 8,
  "isSuccessful": true,
  "errorMessage": ""
}
```

***

**Validation Error Response**

**HTTP Status Code**: `400 Bad Request`\
**Response Body**:

```json
{
  "$id": "1",
  "type": "https://tools.ietf.org/html/rfc9110#section-15.5.1",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "errors": {
    "$id": "2",
    "UploadedImage": [
      "UploadedImage is required.",
      "The request does not contain a file. Please make sure to upload the file."
    ]
  },
  "traceId": "00-35fea5107319e5521fddbcc6daeeef12-474bf812d683ae81-00"
}
```

**Authorization Error Response**

**HTTP Status Code**: `401 Unauthorized`\
**Response Body**:

```json
{
  "errors": {
    "business:": [
      "Token is missing, invalid or ApplicationId is not found in the token."
    ]
  },
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "One or more errors occurred.",
  "status": 401,
  "detail": null,
  "instance": null,
  "extensions": {
    "traceId": "00-735817749634d9300906511b8291993f-15940a2feb6bac0a-00"
  }
}
```

***

#### Notes on Errors

* **400 Bad Request**: Missing required fields or invalid image format.
* **401 Unauthorized**: Missing or invalid token, or incorrect API credentials.

Ensure all required fields are provided and valid.&#x20;

***

#### 2. **Check User Progress** <a href="#id-2-check-user-progress" id="id-2-check-user-progress"></a>

**Description:**\
Retrieves the progress of the upscaling process for a specific user.

**Details:**

* **URL**:\
  `GET /api/v1/Image/Upscaling/CheckUserProgress`
* **Full Path**:\
  `https://api.adcreative.ai/api/v1/Image/Upscaling/CheckUserProgress`
* **Authorization**:\
  Requires a Bearer Token and the following headers:

***

### Headers

<table data-full-width="true"><thead><tr><th width="245">Header Name</th><th width="278">Value</th><th>Description</th></tr></thead><tbody><tr><td>Authorization</td><td>Bearer <code>&#x3C;YOUR_TOKEN></code></td><td>Required for authentication.</td></tr><tr><td>x-api-key</td><td><code>&#x3C;YOUR_API_KEY></code></td><td>API Key for accessing the endpoint.</td></tr><tr><td>x-api-secret</td><td><code>&#x3C;YOUR_API_SECRET></code></td><td>API Secret for accessing the endpoint.</td></tr><tr><td>Accept</td><td>application/json</td><td>Specifies the response format.</td></tr></tbody></table>

***

### Query Parameters

<table data-full-width="true"><thead><tr><th width="292">Parameter</th><th width="135">Type</th><th width="124">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>userId</code></td><td><code>Guid</code></td><td>Yes</td><td>The unique identifier for the user.</td></tr><tr><td><code>imageUpscalerProcessId</code></td><td><code>Guid</code></td><td>No</td><td>(Optional) The ID of the specific upscaling process.</td></tr></tbody></table>

***

### Example Request

#### cURL Command:

```bash
curl --location 'https://api.adcreative.ai/api/v1/Image/Upscaling/CheckUserProgress?userId=2581c740-8e9d-4d63-96bc-5665bb9a646b&imageUpscalerProcessId=e6c59f37-a794-468d-81aa-c9ef79dc042c' \\
--header 'Accept: application/json' \\
--header 'Authorization: Bearer <YOUR_BEARER_TOKEN>' \\
--header 'x-api-key: <YOUR_API_KEY>' \\
--header 'x-api-secret: <YOUR_API_SECRET>'
```

***

### Example Responses

#### Successful Response

* **HTTP Status Code**: `200 OK`
* **Response Body**:

```json
{
    "$id": "1",
    "$values": [
        {
            "$id": "2",
            "messageType": "ImageUpscalingProgress",
            "requestRenderState": 5,
            "applicationId": "4f7d8a9c-b5e6-4d3e-b7a9-d5c3e1b7a4f6",
            "userId": "2581c740-8e9d-4d63-96bc-5665bb9a646b",
            "imageRenderProcessId": "e6c59f37-a794-468d-81aa-c9ef79dc042c",
            "totalTaskCount": 1,
            "completedTaskCount": 1,
            "progress": 100,
            "tasks": {
                "$id": "3",
                "50d04155-2bd9-46c1-85cb-47fa18cd02d7": 5
            },
            "renderType": 8,
            "isSuccessful": true,
            "errorMessage": ""
        }
    ]
}
```

***

#### Validation Error Response

* **HTTP Status Code**: `400 Bad Request`
* **Response Body**:

```json
{
    "$id": "1",
    "type": "https://tools.ietf.org/html/rfc9110#section-15.5.1",
    "title": "One or more validation errors occurred.",
    "status": 400,
    "errors": {
        "$id": "2",
        "userId": [
            "The userId field is required."
        ]
    },
    "traceId": "00-35fea5107319e5521fddbcc6daeeef12-474bf812d683ae81-00"
}
```

***

#### Authorization Error Response

* **HTTP Status Code**: `401 Unauthorized`
* **Response Body**:

```json
{
    "errors": {
        "business:": ["Token is missing, invalid or ApplicationId is not found in the token."]
    },
    "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
    "title": "One or more errors occurred.",
    "status": 401,
    "detail": null,
    "instance": null,
    "extensions": {
        "traceId": "00-735817749634d9300906511b8291993f-15940a2feb6bac0a-00"
    }
}
```

***

### Notes on Errors

* **400 Bad Request**: Occurs when required parameters (`userId`) are missing or invalid.
* **401 Unauthorized**: Happens when the token is missing, invalid, or API credentials are incorrect.
* Ensure all required headers and query parameters are provided correctly.

***

#### 3. Check Application All Progresses <a href="#id-2-check-user-progress" id="id-2-check-user-progress"></a>

**Description:**\
Checks the progress of all image upscaling processes for a specific application.

**Details:**

* **Method**: `GET`
* **URL**: `/api/v1/Image/Upscaling/CheckApplicationAllProgresses`
* **Full Path**: `https://api.adcreative.ai/api/v1/Image/Upscaling/CheckApplicationAllProgresses`

### Authorization

* **Required**: Bearer Token
* **Headers**:
  * `Accept: application/json`
  * `Authorization: Bearer <YOUR_BEARER_TOKEN>`
  * `x-api-key: <YOUR_API_KEY>`
  * `x-api-secret: <YOUR_API_SECRET>`

### Query Parameters

| Parameter       | Type   | Required | Description                               |
| --------------- | ------ | -------- | ----------------------------------------- |
| `applicationId` | `Guid` | Yes      | The unique identifier of the application. |

### Example Request

#### cURL Command

```bash
curl --location 'https://api.adcreative.ai/api/v1/Image/Upscaling/CheckApplicationAllProgresses?applicationId=4f7d8a9c-b5e6-4d3e-b7a9-d5c3e1b7a4f6' \\
--header 'Accept: application/json' \\
--header 'Authorization: Bearer <YOUR_BEARER_TOKEN>' \\
--header 'x-api-key: <YOUR_API_KEY>' \\
--header 'x-api-secret: <YOUR_API_SECRET>'
```

### Responses

#### Successful Response

* **HTTP Status Code**: `200 OK`
* **Response Body**:

```json
{
    "$id": "1",
    "$values": [
        {
            "$id": "2",
            "messageType": "ImageUpscalingProgress",
            "requestRenderState": 1,
            "applicationId": "4f7d8a9c-b5e6-4d3e-b7a9-d5c3e1b7a4f6",
            "userId": "2581c740-8e9d-4d63-96bc-5665bb9a646b",
            "imageRenderProcessId": "0f2b39a9-104a-4b8c-b52e-d126413504ac",
            "totalTaskCount": 1,
            "completedTaskCount": 0,
            "progress": 0,
            "tasks": {
                "$id": "3",
                "8dffe58f-3ea7-45aa-ae76-5c4fe6945d86": 1
            },
            "renderType": 8,
            "isSuccessful": true,
            "errorMessage": ""
        },
        {
            "$id": "4",
            "messageType": "ImageUpscalingProgress",
            "requestRenderState": 1,
            "applicationId": "4f7d8a9c-b5e6-4d3e-b7a9-d5c3e1b7a4f6",
            "userId": "2581c740-8e9d-4d63-96bc-5665bb9a646b",
            "imageRenderProcessId": "b747fd87-0ebc-4112-afd0-53af8ce56ce7",
            "totalTaskCount": 1,
            "completedTaskCount": 0,
            "progress": 0,
            "tasks": {
                "$id": "5",
                "95c30efa-95cd-47d6-bb7a-fc5ca44fc3b5": 1
            },
            "renderType": 8,
            "isSuccessful": true,
            "errorMessage": ""
        }
    ]
}
```

#### Validation Error Response

* **HTTP Status Code**: `400 Bad Request`
* **Response Body**:

```json
{
  "$id": "1",
  "type": "https://tools.ietf.org/html/rfc9110#section-15.5.1",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "errors": {
    "applicationId": ["The applicationId field is required."]
  },
  "traceId": "00-35fea5107319e5521fddbcc6daeeef12-474bf812d683ae81-00"
}
```

#### Authorization Error Response

* **HTTP Status Code**: `401 Unauthorized`
* **Response Body**:

```json
{
    "errors": {
        "business:": [
            "Token is missing, invalid or ApplicationId is not found in the token."
        ]
    },
    "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
    "title": "One or more errors occurred.",
    "status": 401,
    "detail": null,
    "instance": null,
    "extensions": {
        "traceId": "00-735817749634d9300906511b8291993f-15940a2feb6bac0a-00"
    }
}
```

#### Not Found Error Response

* **HTTP Status Code**: `404 Not Found`
* **Response Body**:

```json
{
    "errors": {
        "engine: CheckProgress": [
            "No running or incomplete ImageFaceEnhancingProcess was not found for the User: N/A or the Application: b747fd87-0ebc-4112-afd0-53af8ce56ce7"
        ],
        "business: CheckApplicationAllProgresses": [
            "Not found error occurred while checking image upscaling process for the ApplicationId: b747fd87-0ebc-4112-afd0-53af8ce56ce7"
        ]
    },
    "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
    "title": "One or more errors occurred.",
    "status": 404,
    "detail": null,
    "instance": null,
    "extensions": {
        "traceId": "00-1252ddef5b95d69e25141fc0ead96042-a0c01c9be85419ef-00"
    }
}
```

***

### Error Notes

* **400 Bad Request**: Occurs if `applicationId` is missing or invalid.
* **401 Unauthorized**: Bearer token is missing, invalid, or API credentials are incorrect.
* **404 Not Found**: No progress data is found for the provided `applicationId`.

***

#### 4. **Download Upscaled Image** <a href="#id-3-download-upscaled-image" id="id-3-download-upscaled-image"></a>

### Description:

Retrieves the upscaled image content stream based on the provided query parameters.

***

### Details:

* **Method:** `GET`
* **URL:** `/api/v1/Image/Upscaling/Download`
* **Full Path:** `https://api.adcreative.ai/api/v1/Image/Upscaling/Download`

***

### Authorization:

* Requires a Bearer Token.
* The following headers must be included:

| Header          | Description                       | Example Value                |
| --------------- | --------------------------------- | ---------------------------- |
| `Authorization` | Bearer token for authentication   | `Bearer <YOUR_BEARER_TOKEN>` |
| `x-api-key`     | API key for client identification | `<YOUR_API_KEY>`             |
| `x-api-secret`  | API secret for secure access      | `<YOUR_API_SECRET>`          |
| `Accept`        | Expected response format          | `application/json`           |

***

### Query Parameters:

<table data-full-width="true"><thead><tr><th width="255">Parameter</th><th width="83">Type</th><th width="98">Required</th><th width="250">Description</th><th>Example Value</th></tr></thead><tbody><tr><td><code>applicationId</code></td><td><code>Guid</code></td><td>Yes</td><td>ID of the application making the request</td><td><code>4f7d8a9c-b5e6-4d3e-b7a9-d5c3e1b7a4f6</code></td></tr><tr><td><code>taskId</code></td><td><code>Guid</code></td><td>Yes</td><td>Unique identifier for the specific task</td><td><code>e6c59f37-a794-234f-56yu-c9ef79dc042c</code></td></tr><tr><td><code>imageUpscalerProcessId</code></td><td><code>Guid</code></td><td>Yes</td><td>ID of the image upscaling process</td><td><code>e6c59f37-a794-468d-81aa-c9ef79dc042c</code></td></tr><tr><td><code>lowResolution</code></td><td><code>bool</code></td><td>No</td><td>Indicates whether the image is in low resolution</td><td><code>false</code></td></tr></tbody></table>

***

### Example Request:

**cURL Command:**

```bash
curl --location 'https://api.adcreative.ai/api/v1/Image/Upscaling/Download?applicationId=4f7d8a9c-b5e6-4d3e-b7a9-d5c3e1b7a4f6&taskId=e6c59f37-a794-234f-56yu-c9ef79dc042c&imageUpscalerProcessId=e6c59f37-a794-468d-81aa-c9ef79dc042c&lowResolution=false' \\
--header 'Accept: application/json' \\
--header 'Authorization: Bearer <YOUR_BEARER_TOKEN>' \\
--header 'x-api-key: <YOUR_API_KEY>' \\
--header 'x-api-secret: <YOUR_API_SECRET>'
```

***

### Example Responses:

#### **Successful Response:**

* **HTTP Status Code:** `200 OK`
* **Response Type:** `FileStream`
* **Details:** The requested image file stream will be directly downloaded.

***

#### Authorization Error Response

* **HTTP Status Code**: `401 Unauthorized`
* **Response Body**:

```json
{
    "errors": {
        "business:": [
            "Token is missing, invalid or ApplicationId is not found in the token."
        ]
    },
    "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
    "title": "One or more errors occurred.",
    "status": 401,
    "detail": null,
    "instance": null,
    "extensions": {
        "traceId": "00-735817749634d9300906511b8291993f-15940a2feb6bac0a-00"
    }
}
```

***

#### **Validation Error Response:**

* **HTTP Status Code:** `400 Bad Request`
* **Response Body:**

```json
{
    "$id": "1",
    "type": "https://tools.ietf.org/html/rfc9110#section-15.5.1",
    "title": "One or more validation errors occurred.",
    "status": 400,
    "errors": {
        "$id": "2",
        "taskId": [
            "The value 'e6c59f37-a794-234f-56yu-c9ef79dc042c' is not valid."
        ]
    },
    "traceId": "00-7f9b779a099abe1bc26babff88ab4d5d-707fdfff822f63ed-00"
}
```

***

#### **Not Found Error Response:**

* **HTTP Status Code:** `404 Not Found`
* **Response Body:**

```json
{
    "errors": {
        "engine: Upscaling/Download": [
            "Image content not found."
        ],
        "business: Upscaling/Download": [
            "Not found error occurred while getting original image content stream"
        ]
    },
    "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
    "title": "One or more errors occurred.",
    "status": 404,
    "detail": null,
    "instance": null,
    "extensions": {
        "traceId": "00-87979cce38eb3aaa532fc90bdc73f9df-82aedb262968bc6a-00"
    }
}
```

***

### Error Notes:

* **400 Bad Request:**
  * Occurs when the `taskId` or other parameters are invalid.
  * Ensure all query parameters are properly formatted.
* **404 Not Found:**
  * No image content is found for the provided identifiers.
  * Verify that `applicationId`, `taskId`, and `imageUpscalerProcessId` are correct.
* **401 Unauthorized:**
  * Bearer token is missing or invalid.
  * Ensure proper API key and secret are used in the headers.

***

### **Validation Notes** <a href="#validation-notes" id="validation-notes"></a>

1. **Required Fields:** All required fields must be provided in the request.
2. **File Formats:** Uploaded files must meet the required formats (e.g., `jpeg`).
3. **Notification Channel:** If notifications are enabled, ensure a valid notification channel is configured.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api-docs.adcreative.ai/docs/features/image-upscaler-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
