> ## Documentation Index
> Fetch the complete documentation index at: https://novita.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Upscale V2

<Warning>
  **The Upscale V2 API is deprecated and will be removed in the future. Please migrate to [Upscale V3](/api-reference/model-apis-upscale).**
</Warning>

## POST Upscale V2

An indispensable tool for improving the quality of images generated by Stable Diffusion.

## Request Headers

<ParamField header="Authorization" type="string" required={true} />

## Request Body

<ParamField body="image" type="string" required={true}>
  Base64 encoded image
</ParamField>

<ParamField body="upscaler_1" type="string|null" required={false}>
  AI upscalers are models trained with massive amounts of data.
</ParamField>

<ParamField body="resize_mode" type="integer|null" required={false}>
  Resizing mode:
</ParamField>

<ParamField body="upscaling_resize" type="number|null" required={false}>
  The magnification factor of the image. For example, if you input upscaling\_resize:2 with an image size of 512x512, it will return images of 1024x1024 (the maximum image size is 2048).
</ParamField>

<ParamField body="upscaling_resize_w" type="integer|null" required={false}>
  The target image width; the maximum image size is 2048.
</ParamField>

<ParamField body="upscaling_resize_h" type="integer|null" required={false}>
  The target image height; the maximum image size is 2048.
</ParamField>

<ParamField body="upscaling_crop" type="boolean|null" required={false}>
  Zoom in after cropping.
</ParamField>

<ParamField body="upscaler_2" type="string|null" required={false}>
  AI upscalers are models trained with massive amounts of data.
</ParamField>

<ParamField body="extras_upscaler_2_visibility" type="number|null" required={false}>
  Range \[0\~1], Extras upscaler 2 visibility.
</ParamField>

<ParamField body="gfpgan_visibility" type="number|null" required={false}>
  Range \[0\~1], GFPGAN visibility.
</ParamField>

<ParamField body="codeformer_visibility" type="number|null" required={false}>
  Range \[0\~1], CodeFormer visibility.
</ParamField>

<ParamField body="codeformer_weight" type="number|null" required={false}>
  Range \[0\~1], CodeFormer weight (0 = maximum effect, 1 = minimum effect).
</ParamField>

<ParamField body="img_expire_ttl" type="integer" required={false}>
  Image storage time (seconds). Range \[0, 604800].
</ParamField>

## Response

<ResponseField name="code" type="integer" required={false}>
  CodeNormal=0, CodeInternalError=-1, CodeInvalidJSON=1, CodeModelNotExist=2, CodeTaskIdNotExist=3, CodeInvalidAuth=4, CodeHostUnavailable=5, CodeParamRangeOutOfLimit=6, CodeCostBalanceFailure=7, CodeSamplerNotExist=8, CodeTimeout=9, CodeNotSupport=10
</ResponseField>

<ResponseField name="msg" type="string" required={false} />

<ResponseField name="data" type="object" required={false}>
  <Expandable title="properties" defaultOpen={false}>
    <ResponseField name="task_id" type="string" required={false} />

    <ResponseField name="warn" type="string" required={false} />
  </Expandable>
</ResponseField>

## Example

request

```bash theme={"system"}
curl --location 'https://api.novita.ai/v2/upscale' \
--header 'Authorization: Bearer {{API Key}}' \
--header 'Content-Type: application/json' \
--data '{
  'image': '{{base64 encoded image}}',
  'upscaler_1': 'R-ESRGAN 4x+',
  'resize_mode': 1,
  'upscaling_resize': null,
  'upscaling_resize_w': 1024,
  'upscaling_resize_h': 1024,
  'upscaling_crop': true,
  'upscaler_2': 'R-ESRGAN 4x+',
  'extras_upscaler_2_visibility': 0.5,
  'gfpgan_visibility': 0.5,
  'codeformer_visibility': 0.5,
  'codeformer_weight': 0.5,
  'img_expire_ttl': null
}'
```

response

```json theme={"system"}
{
  "code": null,
  "msg": "",
  "data": {
    "task_id": "",
    "warn": ""
  }
}
```
