# P Image API

> Provider: **Pruna AI**
> Source: https://www.pixazo.ai/models/p-image

AI-powered image editing and transformation model by Pruna AI.

## P Image v1

### Image to Image (Image Editing)

## Base URL

```
https://gateway.pixazo.ai/p-image/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

## Image Request - P Image

## Request Code

HTTP Python JavaScript cURL

```
POST https://gateway.pixazo.ai/p-image/v1/p-image-edit/generate
Content-Type: application/json
Cache-Control: no-cache
Ocp-Apim-Subscription-Key: YOUR_API_KEY

{
  "prompt": "The woman dress is changed to black",
  "images": [
    "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/f1.png"
  ]
}
```

```
import requests

url = "https://gateway.pixazo.ai/p-image/v1/p-image-edit/generate"
headers = {
    "Content-Type": "application/json",
    "Cache-Control": "no-cache",
    "Ocp-Apim-Subscription-Key": "YOUR_API_KEY"
}
data = {
    "prompt": "The woman dress is changed to black",
    "images": ["https://pub-582b7213209642b9b995c96c95a30381.r2.dev/f1.png"]
}

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

```
const url = 'https://gateway.pixazo.ai/p-image/v1/p-image-edit/generate';

fetch(url, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Cache-Control': 'no-cache',
    'Ocp-Apim-Subscription-Key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    prompt: 'The woman dress is changed to black',
    images: ['https://pub-582b7213209642b9b995c96c95a30381.r2.dev/f1.png']
  })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```

```
curl -v -X POST "https://gateway.pixazo.ai/p-image/v1/p-image-edit/generate" \
  -H "Content-Type: application/json" \
  -H "Cache-Control: no-cache" \
  -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \
  --data-raw '{
    "prompt": "The woman dress is changed to black",
    "images": ["https://pub-582b7213209642b9b995c96c95a30381.r2.dev/f1.png"]
  }'
```

## Output

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

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

## Webhook (Optional)

Add the `X-Webhook-URL` header to your generate request to receive a POST callback instead of polling.

```
X-Webhook-URL: https://your-server.com/webhook/callback
```

## Request Parameters - Image Request

Field

Type

Required

Default

Description

prompt

string

Yes

—

Text prompt describing the desired image edit. You can refer to images as "image 1", "image 2", etc.

images

array of strings (URI)

Yes

—

Input image URLs. For editing tasks, provide the main image as the first image

turbo

boolean

No

true

Faster generation with additional optimizations. Turn off for complicated tasks

seed

integer

No

—

Random seed for reproducible generation

aspect\_ratio

string

No

"match\_input\_image"

Aspect ratio for the generated image. Valid values: "match\_input\_image", "1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3"

disable\_safety\_checker

boolean

No

false

Disable safety checker for generated images

webhook

string

No

—

Webhook URL for async notifications when generation completes

webhook\_events\_filter

array

No

—

Event types to receive (e.g. \["completed"\])

## Minimum Request

```
{
  "prompt": "The woman dress is changed to black",
  "images": [
    "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/f1.png"
  ]
}
```

## Full Request (all options)

```
{
  "prompt": "The woman dress is changed to black",
  "images": [
    "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/f1.png"
  ],
  "turbo": true,
  "seed": 42,
  "aspect_ratio": "1:1",
  "disable_safety_checker": false,
  "webhook": "https://your-webhook.com/callback",
  "webhook_events_filter": [
    "completed"
  ]
}
```

## Response

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

## 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 Image Request.

Code

Meaning

202

Accepted — Request queued

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

429

Too Many Requests

500

Internal Server Error

## Error Responses

Queue system errors and model validation errors.

### Queue System Errors

```
// 402 — Insufficient balance
{
  "error": "Insufficient Balance",
  "message": "Your wallet does not have enough balance. Required: $0.01"
}
```

```
// 400 — Model not found
{
  "error": "Model not found",
  "message": "Model 'p-image' not found or is disabled"
}
```

### Error via Status/Webhook

```
{
  "request_id": "p-image_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "status": "ERROR",
  "model_id": "p-image",
  "error": "Description of the error",
  "output": null
}
```

## Retrieving Results

Poll the universal status endpoint to check progress and retrieve results.

### Endpoint

```
GET https://gateway.pixazo.ai/v2/requests/status/{request_id}
Ocp-Apim-Subscription-Key: YOUR_API_KEY
```

## cURL Example

```
curl -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \
  "https://gateway.pixazo.ai/v2/requests/status/p-image_019d42ce-8064-789e-5840-890db47729647"
```

## Response (Completed)

```
{
  "request_id": "p-image_019d42ce-8064-789e-5840-890db47729647",
  "status": "COMPLETED",
  "model_id": "p-image",
  "error": null,
  "output": {
    "media_url": [
      "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/v1/p-image_019d42ce-8064-789e-5840-890db47729647/output.jpg"
    ],
    "media_type": "image/jpeg"
  },
  "created_at": "2026-03-31T07:32:03.749Z",
  "updated_at": "2026-03-31T07:32:20.000Z",
  "completed_at": "2026-03-31T07:32:20.000Z"
}
```

## Response Fields

Field

Type

Description

request\_id

string

Unique request identifier

status

string

QUEUED, PROCESSING, COMPLETED, FAILED, or ERROR

model\_id

string

Model that processed the request

error

string|null

Error message if failed

output.media\_url

array

URLs to generated media (R2 CDN)

output.media\_type

string

MIME type (image/jpeg)

created\_at

string

When request was created

completed\_at

string|null

When request completed

polling\_url

string

Status URL (initial response only)

## 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

ERROR

System error — not charged

## Status Flow

```
QUEUED → PROCESSING → COMPLETED
                    → FAILED
                    → ERROR
```

## Typical Workflow

1.  **Send a generate request** to the API endpoint
2.  **Save the `request_id`** from the response
3.  **Poll** every 5-10 seconds: `GET /v2/requests/status/{request_id}`
4.  **When `status` is `"COMPLETED"`**, download from `output.media_url`

**Tip:** Use `X-Webhook-URL` header to get a callback instead of polling.

## P Image Upscale

### Image to Image (Image Upscaler)

## Base URL

```
https://gateway.pixazo.ai/p-image-upscale/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

## P Image Upscale Request - P Image Upscale API

## Request Code

HTTP Python JavaScript cURL

```
POST https://gateway.pixazo.ai/p-image-upscale/v1/p-image-upscale/generate
Content-Type: application/json
Cache-Control: no-cache
Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY

{
  "image": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/f1.png"
}
```

```
import requests

url = "https://gateway.pixazo.ai/p-image-upscale/v1/p-image-upscale/generate"
headers = {
    "Content-Type": "application/json",
    "Cache-Control": "no-cache",
    "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}
data = {
    "image": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/f1.png"
}

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

```
const url = 'https://gateway.pixazo.ai/p-image-upscale/v1/p-image-upscale/generate';
const headers = {
  'Content-Type': 'application/json',
  'Cache-Control': 'no-cache',
  'Ocp-Apim-Subscription-Key': 'YOUR_SUBSCRIPTION_KEY'
};
const data = {
  image: 'https://pub-582b7213209642b9b995c96c95a30381.r2.dev/f1.png'
};

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/p-image-upscale/v1/p-image-upscale/generate" \
  -H "Content-Type: application/json" \
  -H "Cache-Control: no-cache" \
  -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
  --data-raw '{
    "image": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/f1.png"
  }'
```

## Output

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

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

## Webhook (Optional)

Add the `X-Webhook-URL` header to your generate request to receive a POST callback instead of polling.

```
X-Webhook-URL: https://your-server.com/webhook/callback
```

## Request Parameters - P Image Upscale Request

Parameter

Required

Type

Description

image

Yes

string (URI)

Input image URL to upscale. Must be publicly accessible.

upscale\_mode

No

string

Upscale mode: "target" (scales to fixed megapixel resolution) or "factor" (multiplies each side by factor). Default: "target".

target

No

integer

Target resolution in megapixels (1-8). Used when upscale\_mode is "target". Default: 4.

factor

No

number

Scaling factor applied to each side (1-8). Used when upscale\_mode is "factor". Output capped at 8 MP. Default: 2.

enhance\_details

No

boolean

Enhance fine textures and small details. May increase contrast. Default: false.

enhance\_realism

No

boolean

Improve realism. Recommended for AI-generated images. Default: true.

output\_format

No

string

Output format: "webp", "jpg", or "png". Default: "jpg".

output\_quality

No

integer

Output quality (0-100). 100 is best. Not relevant for PNG. Default: 80.

disable\_safety\_checker

No

boolean

Disable safety checker. Default: false.

## Example Request

```
{
  "image": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/f1.png",
  "upscale_mode": "target",
  "target": 4,
  "enhance_details": true,
  "enhance_realism": true,
  "output_format": "jpg",
  "output_quality": 90
}
```

## Response

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

## Request Headers

Header

Value

Content-Type

application/json

Cache-Control

no-cache

Ocp-Apim-Subscription-Key

YOUR\_SUBSCRIPTION\_KEY

## Response Handling

Common status codes.

Code

Meaning

202

Accepted — Request queued

400

Bad Request

401

Unauthorized

402

Insufficient Balance

403

Forbidden

429

Too Many Requests

500

Internal Server Error

## Error Responses

Queue system errors and model validation errors.

### Queue System Errors

```
// 402 — Insufficient balance
{
  "error": "Insufficient Balance",
  "message": "Your wallet does not have enough balance. Required: $0.01"
}
```

```
// 400 — Model not found
{
  "error": "Model not found",
  "message": "Model 'p-image-upscale' not found or is disabled"
}
```

### Error via Status/Webhook

```
{
  "request_id": "p-image-upscale_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "status": "ERROR",
  "model_id": "p-image-upscale",
  "error": "Description of the error",
  "output": null
}
```

## Retrieving Results

Poll the universal status endpoint to check progress and retrieve results.

### Endpoint

```
GET https://gateway.pixazo.ai/v2/requests/status/{request_id}
Ocp-Apim-Subscription-Key: YOUR_API_KEY
```

## cURL Example

```
curl -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \
  "https://gateway.pixazo.ai/v2/requests/status/p-image-upscale_019d5176-9030-7fba-9adc-4952048aa80bf"
```

## Response (Completed)

```
{
  "request_id": "p-image-upscale_019d5176-9030-7fba-9adc-4952048aa80bf",
  "status": "COMPLETED",
  "model_id": "p-image-upscale",
  "error": null,
  "output": {
    "media_url": [
      "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/v1/p-image-upscale_019d5176-9030-7fba-9adc-4952048aa80bf/output.jpg"
    ],
    "media_type": "image/jpeg"
  },
  "created_at": "2026-03-31T07:32:03.749Z",
  "updated_at": "2026-03-31T07:32:20.000Z",
  "completed_at": "2026-03-31T07:32:20.000Z"
}
```

## Response Fields

Field

Type

Description

request\_id

string

Unique request identifier

status

string

QUEUED, PROCESSING, COMPLETED, FAILED, or ERROR

model\_id

string

Model that processed the request

error

string|null

Error message if failed

output.media\_url

array

URLs to generated media (R2 CDN)

output.media\_type

string

MIME type (image/jpeg)

created\_at

string

When request was created

completed\_at

string|null

When request completed

polling\_url

string

Status URL (initial response only)

## 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

ERROR

System error — not charged

## Status Flow

```
QUEUED → PROCESSING → COMPLETED
                    → FAILED
                    → ERROR
```

## Typical Workflow

1.  **Send a generate request** to the API endpoint
2.  **Save the `request_id`** from the response
3.  **Poll** every 5-10 seconds: `GET /v2/requests/status/{request_id}`
4.  **When `status` is `"COMPLETED"`**, download from `output.media_url`

**Tip:** Use `X-Webhook-URL` header to get a callback instead of polling.
