PowerPost APIv1
PowerPost APIv1
DashboardAPI keysPowerPost API
QuickstartAuthenticationWorkspacesErrors & Rate Limits
Input TypesPost TypesCreditsResearch Modes
Generate CaptionsGenerate ImagesPublish and ScheduleWebhooksMCP Server

Content

Generate ContentGenerations

Media

Upload MediaGenerate ImagesGenerate VideosVideo Captions

Publishing & planning

PostsPublish & SchedulePost ItemsAnalyticsCalendar

Account

Get Credits
Changelog
API reference

Generate Images

Create AI-generated images from text, reference images, or existing captions.

Generate Images

POST /api/v1/images/generate

Generate AI images from a text prompt, from reference images you upload, or from an existing caption generation. Optionally enable prompt enhancement to let AI optimize your prompt for better results.

Image generation requires at least one credit purchase on the account. Signup credits are not enough. See Purchase required.


Input Modes

The input mode is determined by the fields you provide. Each mode can be combined with additional parameters for more control.

Input ModeHow to UseDescription
TextSend promptGenerate from a text description
ReferenceSend prompt + style_imagesGenerate inspired by reference images
PostSend generation_id (+ optional prompt)Generate visuals for existing captions

Request Body

FieldTypeRequiredDescription
promptstringYes*Text description of the image to generate (max 2000 chars)
sizestringNoImage aspect ratio (default: square, see sizes below)
quantitynumberNoNumber of images to generate (1-4, default: 1)
modelstringNoImage model to use (default: nano-banana-2, see models below)
enhance_promptbooleanNoLet AI optimize your prompt for better results (default: false)
style_imagesstring[]NoMedia IDs of reference images for style guidance (max 4)
generation_idstringNoCaption generation ID for contextual image creation
source_post_typestringNoWhich platform's caption to use as source (post mode only)

* prompt is required for text and reference modes. For post mode, it's optional — if omitted, the prompt is derived from the generation's captions.

Models

Choose a model based on your use case. Each model has different strengths and supported sizes.

Model IDNameSupported SizesBest For
flux2-flexFLUX.2 Flexsquare, feed, portrait, landscapeMulti-reference, fine control
ideogram-3Ideogram 3.0square, feed, portrait, landscapeBest text rendering and logos
gpt-image-2GPT Image 2square, portrait, landscapeReasoning, photorealistic, sharp
nano-banana-2Nano Banana 2square, feed, portrait, landscapeFast generation, great text

Not all sizes are available for every model. For example, gpt-image-2 does not support feed. Requesting an unsupported size returns a 400 error.

Image Sizes

Size names (square, feed, portrait, landscape) are the same across models, but pixel dimensions are per model (matched to each provider’s supported presets).

flux2-flex (default pixel map for the labels below):

SizeAspect RatioDimensionsBest For
square1:11536×1536Instagram feed, profile images
feed4:51280×1600Instagram/Facebook feed posts
portrait9:161088×1936Stories, Reels, TikTok
landscape16:91536×864YouTube thumbnails, X posts

Other models (same size names, different pixels):

Sizeideogram-3nano-banana-2gpt-image-2
square1024×10241024×10241024×1024
feed896×1152928×1152— (not supported)
portrait768×1344768×13761024×1536 (2:3)
landscape1344×7681376×7681536×1024 (3:2)

Requesting a size a model does not support (for example feed with gpt-image-2) returns a 400 error. Pixel values above match what PowerPost sends to the image provider.


Examples

Text-to-Image

Describe what you want and get an image:

curl -X POST https://powerpost.ai/api/v1/images/generate \
  -H "x-api-key: pp_live_sk_YOUR_KEY" \
  -H "X-Workspace-Id: YOUR_WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Minimalist workspace with laptop and coffee, warm morning light",
    "size": "square",
    "quantity": 2
  }'

Reference-Based (Image + Text)

Upload reference images first via Upload Media, then use them as style guidance. The prompt describes what new image to create, while the references guide the visual style:

curl -X POST https://powerpost.ai/api/v1/images/generate \
  -H "x-api-key: pp_live_sk_YOUR_KEY" \
  -H "X-Workspace-Id: YOUR_WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Product photo of headphones on marble surface",
    "size": "feed",
    "style_images": ["a1b2c3d4-e5f6-7890-abcd-ef1234567890"]
  }'

Reference images guide the style, composition, and visual feel — the model generates a new image inspired by the references, not a direct edit. You can pass up to 4 reference images.

From Caption Generation

Generate images that match an existing caption generation. The AI reads your captions and creates a matching visual:

curl -X POST https://powerpost.ai/api/v1/images/generate \
  -H "x-api-key: pp_live_sk_YOUR_KEY" \
  -H "X-Workspace-Id: YOUR_WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "generation_id": "550e8400-e29b-41d4-a716-446655440000",
    "size": "portrait",
    "quantity": 3
  }'

You can optionally add prompt for extra steering and source_post_type to tell the AI which platform's caption to prioritize:

curl -X POST https://powerpost.ai/api/v1/images/generate \
  -H "x-api-key: pp_live_sk_YOUR_KEY" \
  -H "X-Workspace-Id: YOUR_WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "generation_id": "550e8400-e29b-41d4-a716-446655440000",
    "prompt": "Use dark background with neon accents",
    "source_post_type": "instagram-feed",
    "size": "feed"
  }'
  • prompt — Additional instructions layered on top of the caption context (e.g., art direction, color preferences). If omitted, the prompt is derived from the captions automatically.
  • source_post_type — Which platform's caption to use as source (e.g., instagram-feed). If omitted, all captions are considered.

When the source generation included media (uploaded images or video), those are automatically used as style references — no need to pass style_images separately.


Response

{
  "image_generation_id": "7a8b9c0d-e1f2-3456-abcd-ef7890123456",
  "status": "processing",
  "credits_used": 9,
  "remaining_credits": 36,
  "status_url": "/api/v1/images/generations/7a8b9c0d-e1f2-3456-abcd-ef7890123456"
}
FieldTypeDescription
image_generation_idstringUnique ID to track this image generation
statusstringInitial status (always processing)
credits_usednumberCredits deducted
remaining_creditsnumberYour credit balance after deduction
status_urlstringRelative URL to poll for results

Errors

CodeDescription
400Invalid request body, unsupported size, or referenced generation_id/style_images not found
401Invalid API key
402Insufficient credits (INSUFFICIENT_CREDITS)
402Purchase required (MEDIA_REQUIRES_PURCHASE)
403API key is missing the images:generate scope
429Rate limit exceeded

Get Image Generation

GET /api/v1/images/generations/{id}

Retrieve the status and outputs of an image generation.


Path Parameters

ParameterTypeDescription
idstringThe image generation ID

Example Request

curl https://powerpost.ai/api/v1/images/generations/7a8b9c0d-e1f2-3456-abcd-ef7890123456 \
  -H "x-api-key: pp_live_sk_YOUR_KEY" \
  -H "X-Workspace-Id: YOUR_WORKSPACE_ID"

Response (Processing)

{
  "image_generation_id": "7a8b9c0d-e1f2-3456-abcd-ef7890123456",
  "status": "processing",
  "prompt": "Minimalist workspace with laptop and coffee, warm morning light",
  "size": "square",
  "quantity": 2,
  "model": "nano-banana-2",
  "created_at": "2026-01-10T18:30:00Z"
}

Response (Completed)

{
  "image_generation_id": "7a8b9c0d-e1f2-3456-abcd-ef7890123456",
  "status": "completed",
  "prompt": "Minimalist workspace with laptop and coffee, warm morning light",
  "size": "square",
  "quantity": 2,
  "model": "nano-banana-2",
  "created_at": "2026-01-10T18:30:00Z",
  "images": [
    {
      "media_id": "img-001-abcd-efgh",
      "url": "https://powerpost.ai/storage/images/img-001-abcd-efgh.webp",
      "thumbnail_url": "https://powerpost.ai/storage/images/img-001-abcd-efgh-thumb.jpg",
      "width": 1024,
      "height": 1024
    },
    {
      "media_id": "img-002-ijkl-mnop",
      "url": "https://powerpost.ai/storage/images/img-002-ijkl-mnop.webp",
      "thumbnail_url": "https://powerpost.ai/storage/images/img-002-ijkl-mnop-thumb.jpg",
      "width": 1024,
      "height": 1024
    }
  ]
}

Response (Failed)

{
  "image_generation_id": "7a8b9c0d-e1f2-3456-abcd-ef7890123456",
  "status": "failed",
  "prompt": "Minimalist workspace with laptop and coffee, warm morning light",
  "size": "square",
  "quantity": 2,
  "model": "nano-banana-2",
  "created_at": "2026-01-10T18:30:00Z",
  "images": [
    {
      "media_id": "img-001-abcd-efgh",
      "url": "https://powerpost.ai/storage/images/img-001-abcd-efgh.webp",
      "thumbnail_url": "https://powerpost.ai/storage/images/img-001-abcd-efgh-thumb.jpg",
      "width": 1024,
      "height": 1024
    }
  ],
  "error": {
    "code": "PARTIAL_FAILURE",
    "message": "1 of 2 images failed to generate. Credits refunded for failed images."
  }
}

If some images fail while others succeed, you get a partial result with a partial refund. Only fully failed generations return no images at all.


Response Fields

FieldTypeDescription
image_generation_idstringUnique image generation ID
statusstringprocessing, completed, or failed
promptstringThe input prompt (or derived from generation)
sizestringRequested image size
quantitynumberRequested number of images
modelstringImage model used for this generation
created_atstringISO 8601 timestamp
imagesarrayGenerated images (only when completed/partial)
errorobjectError details (only when failed)

Image Object

FieldTypeDescription
media_idstringMedia ID for use in posts
urlstringFull-resolution image URL
thumbnail_urlstringThumbnail URL (384px)
widthnumberImage width in pixels
heightnumberImage height in pixels

Status Values

StatusDescription
processingImages are being generated
completedAll images ready
failedGeneration failed (may have partial)

Generated image URLs are signed and valid for 7 days. Use the media_id to attach images to posts — URLs are for preview only.

Errors

CodeDescription
401Invalid API key
403API key is missing the images:read scope
404Image generation not found
429Rate limit exceeded

Upload Media

Upload images or videos for use in content generation or publishing.

Generate Videos

Create AI-generated videos from text prompts or source images.

On this page

Generate ImagesInput ModesRequest BodyModelsImage SizesExamplesText-to-ImageReference-Based (Image + Text)From Caption GenerationResponseErrorsGet Image GenerationPath ParametersExample RequestResponse (Processing)Response (Completed)Response (Failed)Response FieldsImage ObjectStatus ValuesErrors