# Upscale Image

This operation costs **3 credits**.&#x20;

#### Endpoint

```
POST /api/images/upscale
```

#### Parameters

<table><thead><tr><th width="219">Parameter</th><th>Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td><code>image_id</code></td><td>string</td><td>Yes</td><td>The identifier of the selected image.</td></tr><tr><td><code>callback</code></td><td>string</td><td>No</td><td>A URL that will be called when the prompt is done processing. If not provided, the endpoint will run in <strong>sync mode</strong> and return the response when the image generation is complete.</td></tr></tbody></table>

#### Callback

The `callback` parameter behaves similarly to the ["generate image"](/docs/api-endpoints/handling-images/generate-image.md) endpoint.

#### Request Example

```bash
curl -X POST "https://api.deepmode.ai/api/images/upscale" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_SECRET_API_KEY" \
-d '{
  "image_id": "c6b8a9f7e5d1c3a2f91e3"
}'
```

#### Response

Upon successful upscaling, the API returns the following response:

```json
// Response for request in async mode (i.e. callback provided)
{"message": "Upscaling images..."}

// Response for request in sync mode & for callback in async mode
{
  "id": "c6b8a9f7e5d1c3a2f91e3",
  "file_name": "120e453f-3a73-4016-ad6a-5cd5e00ddd45.jpeg",
  "model_id": "a9f7e5d1c3a2f91e3d5c6",
  "image_url": "https://deepmodeimage.blob.core.windows.net/deepmode-user-image/120e453f-3a73-4016-ad6a-5cd5e00ddd45.jpeg?st=2024-04-29T14%3A28%3A02Z&se=2024-04-29T15%3A28%3A02Z&sp=r&sv=2023-11-03&sr=b&sig=NaLrBA8mqrBMiFL1e9gCbuQAvgEMmG39D6iyHkbuy2E%3D",
  "prompt": "A beautiful landscape with mountains and a river.",
  "negative_prompt": "rainy, foggy",
  "upscaled": true,
  "ratio": "square"
}
```

***


---

# 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://deepmode.gitbook.io/docs/api-endpoints/handling-images/upscale-image.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.
