# Smart Resize API

> Provider: **Smart Resize**
> Source: https://www.pixazo.ai/models/smart-resize

Intelligently resize images while preserving important content and visual quality.

## Smart Resize 1.0

### Image to Image

## Base URL

```
https://gateway.pixazo.ai/smart-resize/v1
```

## Authentication

All requests require an API key passed via header.

Header

Type

Required

Description

Ocp-Apim-Subscription-Key

string

Yes

Your API subscription key

## Smart Resize generate request - Smart Resize

## Request Code

HTTP Python JavaScript cURL

```
POST /smart-resize-request HTTP/1.1
Host: gateway.pixazo.ai
Content-Type: application/json
Cache-Control: no-cache
Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY

{
  "image_url": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/Image.jpeg",
  "target_sizes": [
    "1024x1024",
    "1920x1080"
  ]
}
```

```
import requests

url = "https://gateway.pixazo.ai/smart-resize/v1/smart-resize-request"
headers = {
    "Content-Type": "application/json",
    "Cache-Control": "no-cache",
    "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}
data = {
    "image_url": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/Image.jpeg",
    "target_sizes": [
        "1024x1024",
        "1920x1080"
    ]
}

response = requests.post(url, json=data, headers=headers)
print(response.json())
```

```
const url = 'https://gateway.pixazo.ai/smart-resize/v1/smart-resize-request';
const headers = {
  'Content-Type': 'application/json',
  'Cache-Control': 'no-cache',
  'Ocp-Apim-Subscription-Key': 'YOUR_SUBSCRIPTION_KEY'
};
const data = {
  image_url: 'https://pub-582b7213209642b9b995c96c95a30381.r2.dev/Image.jpeg',
  target_sizes: [
    '1024x1024',
    '1920x1080'
  ]
};

fetch(url, {
  method: 'POST',
  headers: headers,
  body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```

```
curl -X POST "https://gateway.pixazo.ai/smart-resize/v1/smart-resize-request" \
  -H "Content-Type: application/json" \
  -H "Cache-Control: no-cache" \
  -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
  --data-raw '{
    "image_url": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/Image.jpeg",
    "target_sizes": [
      "1024x1024",
      "1920x1080"
    ]
  }'
```

## Output

```
{
  "images": [
    {
      "file_name": "nano-banana-pro-edit-output.png",
      "content_type": "image/png",
      "url": "[RESPONSE_URL]"
    }
  ],
  "description": ""
}
```

[Try Now](https://api.pixazo.ai/api-details#api=smart-resize&operation=smart-resize-request)

## Request Parameters - Smart Resize generate request

Field

Type

Required

Default

Description

image\_url

string

Yes

—

URL of the source image to resize. Must be publicly accessible.

target\_sizes

string\[\]

Yes

—

Array of target dimensions in format "widthxheight", e.g., \["1920x1080", "1024x1024"\].

prompt

string

No

""

Optional extra instruction to guide the resizing process (e.g., "keep face centered", "preserve details").

num\_images\_per\_size

integer

No

1

Number of variant images to generate for each target size.

resolution

enum

No

"1K"

Output resolution quality. Allowed: \`1K\`, \`2K\`, \`4K\`.

output\_format

enum

No

"png"

Output image format. Allowed: \`jpeg\`, \`png\`, \`webp\`.

safety\_tolerance

enum

No

"4"

Safety filtering intensity level. Allowed: \`1\`, \`2\`, \`3\`, \`4\`, \`5\`, \`6\`. Higher values are more restrictive.

seed

integer

No

—

Random seed for reproducible results. Use the same seed to generate identical outputs.

sync\_mode

boolean

No

false

If true, returns base64-encoded data URIs instead of CDN URLs in the output.

## Minimum Request

```
{
  "image_url": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/Image.jpeg",
  "target_sizes": [
    "1024x1024"
  ]
}
```

## Full Request (all options)

```
{
  "image_url": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/Image.jpeg",
  "target_sizes": [
    "1024x1024",
    "1920x1080"
  ],
  "prompt": "keep face centered",
  "num_images_per_size": 2,
  "resolution": "2K",
  "output_format": "webp",
  "safety_tolerance": "5",
  "seed": 42,
  "sync_mode": false
}
```

## Response

```
{
  "request_id": "smart-resize_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "status": "QUEUED",
  "polling_url": "https://gateway.pixazo.ai/v2/requests/status/smart-resize_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
```

## Response Fields - Smart Resize generate request

Field

Type

Description

request\_id

string

Unique identifier for the request to use when polling for results.

status

string

Current status of the request (e.g., QUEUED, PROCESSING).

polling\_url

string

URL to use for checking the status of the request.

## Request Headers

Header

Value

Content-Type

application/json

Cache-Control

no-cache

Ocp-Apim-Subscription-Key

Your API subscription key

## Response Handling

Common status codes for Smart Resize generate request.

Code

Meaning

200

Success

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

429

Too Many Requests

500

Internal Server Error

## Error Responses

### 400 Validation Error

```
{
  "error": "Invalid target_sizes format",
  "details": "Each item in target_sizes must be in format 'widthxheight'"
}
```

### 404 Not Found

```
{
  "error": "Resource not found",
  "details": "The requested endpoint does not exist"
}
```

## Status Values

Status

Description

QUEUED

Request accepted, waiting to be processed

PROCESSING

Being processed by the model

COMPLETED

Done — output contains the result

FAILED

Failed — check error field for details

ERROR

System error occurred — request was not charged

### Status Flow

QUEUED → PROCESSING → COMPLETED/FAILED/ERROR

### Typical Workflow

1.  Submit image request via /smart-resize-request
2.  Receive request\_id in response
3.  Poll /v2/requests/status/{request\_id} every 2-3 seconds
4.  When status is COMPLETED, extract image URLs from output.media\_url
5.  If FAILED or ERROR, check error field for diagnostic information

## Smart Resize check status - Smart Resize

## Request Code

HTTP Python JavaScript cURL

```
POST /smart-resize-request-result HTTP/1.1
Host: gateway.pixazo.ai
Content-Type: application/json
Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY

{
  "request_id": "smart-resize_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
```

```
import requests

url = "https://gateway.pixazo.ai/v2/requests/status/smart-resize_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
headers = {
    "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}

response = requests.get(url, headers=headers)
print(response.json())
```

```
const requestId = 'smart-resize_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
const url = \`https://gateway.pixazo.ai/v2/requests/status/\${requestId}\`;
const headers = {
  'Ocp-Apim-Subscription-Key': 'YOUR_SUBSCRIPTION_KEY'
};

fetch(url, {
  method: 'GET',
  headers: headers
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```

```
curl -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
  "https://gateway.pixazo.ai/v2/requests/status/smart-resize_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
```

## Output

```
{
  "images": [
    {
      "file_name": "nano-banana-pro-edit-output.png",
      "content_type": "image/png",
      "url": "[RESPONSE_URL]"
    }
  ],
  "description": ""
}
```

[Try Now](https://api.pixazo.ai/api-details#api=smart-resize&operation=smart-resize-request-result)

## Request Parameters - Smart Resize check status

Field

Type

Required

Default

Description

request\_id

string

Yes

—

The request\_id returned from the original /smart-resize-request submission.

## Minimum Request

```
{
  "request_id": "smart-resize_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
```

## Full Request (all options)

```
{
  "request_id": "smart-resize_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
```

## Response

```
{
  "request_id": "smart-resize_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "status": "COMPLETED",
  "model_id": "smart-resize",
  "error": null,
  "output": {
    "media_url": [
      "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/v1/smart-resize_019dxxxx/output_1024x1024_0.png",
      "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/v1/smart-resize_019dxxxx/output_1920x1080_0.png",
      "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/v1/smart-resize_019dxxxx/output_768x1344_0.png"
    ],
    "media_type": "image/png"
  },
  "created_at": "2026-03-31T10:00:00.000Z",
  "updated_at": "2026-03-31T10:00:15.000Z",
  "completed_at": "2026-03-31T10:00:15.000Z"
}
```

## Response Fields - Smart Resize check status

Field

Type

Description

request\_id

string

Unique identifier for the request.

status

string

Current status of the request (e.g., COMPLETED, FAILED).

model\_id

string

The model used to process the request.

error

string/null

Error message if the request failed, otherwise null.

output.media\_url

string\[\]

Array of public URLs for the generated images.

output.media\_type

string

The MIME type of the generated images (e.g., image/png).

created\_at

string

Timestamp when the request was created (ISO 8601).

updated\_at

string

Timestamp when the request was last updated (ISO 8601).

completed\_at

string

Timestamp when the request was completed (ISO 8601).

## Request Headers

Header

Value

Ocp-Apim-Subscription-Key

Your API subscription key

## Response Handling

Common status codes for Smart Resize check status.

Code

Meaning

200

Success

400

Bad Request

401

Unauthorized

404

Not Found

429

Too Many Requests

500

Internal Server Error

## Notes & Tips

1.  Poll the status endpoint every 2–3 seconds until status is COMPLETED, FAILED, or ERROR.
2.  Implement exponential backoff for retry logic on 5xx HTTP errors.
3.  Use the seed parameter for consistent results during testing or iterative refinement.
4.  For production use, validate image\_url accessibility before submission.
5.  Prefer output\_format: webp for smaller file sizes with high quality.
6.  Use sync\_mode: true only for small batches or local testing — data URIs increase response size significantly.
7.  Processing time typically takes 10–30 seconds depending on image size and complexity.
8.  The API generates one image per target\_size x num\_images\_per\_size, so a single request with two target sizes and two variants per size will produce 4 output images.
