PixAI Platform
API v2 DocumentationImage

Create an inpaint, outpaint or redraw task

Edits an existing image:

  • Inpaint (fillType: inpaint): redraws the masked area.
  • Outpaint (fillType: outpaint): extends the image beyond its edges. Place the original on a larger white canvas and send that as baseImageMediaId; the mask marks the new area.
  • Redraw (fillType: inpaint, no mask): redraws the whole image, keeping it closer to the original as strength goes down.

A masked edit takes two extra images, always sent together:

  • maskMediaId: same size as the base image, white where to redraw and black where to keep.
  • maskedImageMediaId: the base image with the white area of the mask painted gray (#808080).

The output has the size of the masked image when a mask is sent, otherwise of the base image. Images are media IDs; see POST /v2/media/image/upload-url.

Use modelPreset: "v1". GET /v2/gen-task/inpaint/constraints lists the size limits and sdeditPreset names of a preset. Credits are charged when the task is created; the result is outputs.mediaIds[0] of GET /v2/task/{id}.

POST
/gen-task/inpaint

Authorization

bearerAuth
AuthorizationBearer <token>

In all requests that require authentication

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST https://api.pixai.art/v2/gen-task/inpaint \  -H "Authorization: Bearer $PIXAI_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "modelPreset": "v1",    "fillType": "inpaint",    "baseImageMediaId": "1943547603237249965",    "maskMediaId": "1943547603237249966",    "prompt": "red scarf"  }'
{
  "id": "string",
  "status": "waiting",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "startedAt": "2019-08-24T14:15:22Z",
  "endAt": "2019-08-24T14:15:22Z",
  "taskKind": "string",
  "paidQuota": 0,
  "taskStatusMsgI18n": {
    "key": "string",
    "defaultMessage": "string"
  },
  "outputs": {
    "videoMediaId": "string",
    "seed": "string",
    "mediaIds": [
      "string"
    ],
    "mediaUrls": [
      "string"
    ]
  }
}
{
  "code": "string",
  "status": 0,
  "message": "string",
  "data": {},
  "defined": true
}
{
  "code": "string",
  "status": 0,
  "message": "string",
  "data": {},
  "defined": true
}
{
  "code": "string",
  "status": 0,
  "message": "string",
  "data": {},
  "defined": true
}
{
  "code": "string",
  "status": 0,
  "message": "string",
  "data": {},
  "defined": true
}