generate_paint_lab
Start a paid Paint Lab AI action: finish a sketch, edit with words, fill a masked area, color line art without changing the lines, upscale, or remove a background. Uses this month’s generation allowance. Pass quoteId from quote_paint_lab, or the op settings to quote and generate in one call. Poll get_paint_lab_generation until status is completed or failed. A failed job returns its allowance.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| op | No | AI action: finish (finish a sketch, optional style), edit (edit with words; prompt required), fill (fill the white area of maskAssetId; prompt required), colorize (color line art without changing the lines; optional paletteHex), upscale (2× or 4×), or remove_background (cutout). Required unless quoteId is set. | |
| style | No | finish only. Style id from list_paint_lab_styles (default concept). Does not change the quote. | |
| factor | No | upscale only: 2 or 4 (default 2). The result must stay within 4096 × 4096. | |
| prompt | No | What to make or change, up to 2000 characters. Required for edit and fill; optional for finish and colorize; ignored by upscale and remove_background. | |
| quality | No | fast or best. finish only (default best). Ignored for other actions. | |
| quoteId | No | Quote id from quote_paint_lab. Optional; when omitted, op is required and this call quotes first. | |
| paletteHex | No | colorize only: up to 12 swatches to color with ("Use my swatches"). Does not change the quote. | |
| variations | No | How many results to make: 1, 2, or 4. finish, edit, and fill only (default 1). One quote covers every variation. | |
| maskAssetId | No | Mask generation-asset id, same pixel size as sourceAssetId. White = fill (change), black = keep. Required for fill; optional for edit (limits the change to the white area). Not used by other actions. | |
| sourceAssetId | Yes | Ready image generation-asset id from complete_generation_asset. Use the same image you quoted. For colorize this is the line art (dark lines on a white background). | |
| idempotencyKey | No | Optional request key (8–128 letters, numbers, dots, dashes, colons, or underscores). A quoteId is already single-use: retrying generate with the same quoteId returns the same job and never charges twice. | |
| trainedStyleId | No | finish and edit only. Id of one of your ready trained styles from list_paint_lab_trained_styles. The result is made in that style, and the quote includes it. On generate_paint_lab with quoteId this is ignored: the quote already decides the style. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Same as generationId. | |
| op | No | AI action: finish, edit, fill, colorize, upscale, or remove_background. | |
| error | No | User-safe failure message when status is failed. | |
| facts | No | Job facts line, for example "Finish sketch · Best · 1024 × 1024 · ×2". | |
| style | No | Finish style id, when set. | |
| width | No | Source width in px. | |
| clipId | No | Library clip id when the result is saved to the library (upscale). | |
| factor | No | Upscale factor, when the action is upscale. | |
| height | No | Source height in px. | |
| prompt | No | Your own prompt for this job, when one was sent. | |
| status | Yes | submitting, queued, running, completed, or failed. | |
| outputs | No | One entry per finished variation: index, public PNG outputUrl, width, and height. | |
| quality | No | fast or best, when the action has quality tiers. | |
| refunded | No | True when a failed job returned its allowance. | |
| createdAt | No | ISO timestamp when this job was created. | |
| errorCode | No | Stable failure code when status is failed. | |
| outputUrl | No | Public PNG URL of the first finished variation. | |
| variations | No | Number of variations requested. | |
| completedAt | No | ISO timestamp when this job finished. | |
| outputWidth | No | Result width in px. | |
| generationId | Yes | Paint Lab generation id. Poll get_paint_lab_generation until status is completed or failed. | |
| outputHeight | No | Result height in px. | |
| trainedStyleId | No | Your trained style used for this result, when one was applied. |