PowerPost APIv1
PowerPost APIv1
PowerPost APIQuickstartAuthenticationWorkspacesInput Types

API Reference

Upload MediaGenerate ContentGenerationsGenerate ImagesPosts & PublishingGet Credits

Guides

WebhooksError CodesChangelog

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.


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: flux2-flex, 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-1.5GPT Image 1.5square, portrait, landscapePhotorealistic, best detail
nano-banana-2Nano Banana 2square, feed, portrait, landscapeFast generation, great text

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

Image Sizes

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

gpt-image-1.5 uses different dimensions: portrait is 1024×1536 (2:3) and landscape is 1536×1024 (3:2). The dimensions above apply to flux2-flex and ideogram-3.

nano-banana-2 uses slightly different dimensions: feed is 896×1152, portrait is 768×1344, and landscape is 1344×768.


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
  }'
const res = await fetch('https://powerpost.ai/api/v1/images/generate', {
  method: 'POST',
  headers: {
    'x-api-key': 'pp_live_sk_YOUR_KEY',
    'X-Workspace-Id': 'YOUR_WORKSPACE_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    prompt: 'Minimalist workspace with laptop and coffee, warm morning light',
    size: 'square',
    quantity: 2,
  }),
})
const data = await res.json()
import requests

res = requests.post(
"https://powerpost.ai/api/v1/images/generate",
headers={
"x-api-key": "pp_live_sk_YOUR_KEY",
"X-Workspace-Id": "YOUR_WORKSPACE_ID",
"Content-Type": "application/json",
},
json={
"prompt": "Minimalist workspace with laptop and coffee, warm morning light",
"size": "square",
"quantity": 2,
},
)
data = res.json()

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"]
  }'
const res = await fetch('https://powerpost.ai/api/v1/images/generate', {
  method: 'POST',
  headers: {
    'x-api-key': 'pp_live_sk_YOUR_KEY',
    'X-Workspace-Id': 'YOUR_WORKSPACE_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    prompt: 'Product photo of headphones on marble surface',
    size: 'feed',
    style_images: ['a1b2c3d4-e5f6-7890-abcd-ef1234567890'],
  }),
})
const data = await res.json()
import requests

res = requests.post(
"https://powerpost.ai/api/v1/images/generate",
headers={
"x-api-key": "pp_live_sk_YOUR_KEY",
"X-Workspace-Id": "YOUR_WORKSPACE_ID",
"Content-Type": "application/json",
},
json={
"prompt": "Product photo of headphones on marble surface",
"size": "feed",
"style_images": ["a1b2c3d4-e5f6-7890-abcd-ef1234567890"],
},
)
data = res.json()

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
  }'
const res = await fetch('https://powerpost.ai/api/v1/images/generate', {
  method: 'POST',
  headers: {
    'x-api-key': 'pp_live_sk_YOUR_KEY',
    'X-Workspace-Id': 'YOUR_WORKSPACE_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    generation_id: '550e8400-e29b-41d4-a716-446655440000',
    size: 'portrait',
    quantity: 3,
  }),
})
const data = await res.json()
import requests

res = requests.post(
"https://powerpost.ai/api/v1/images/generate",
headers={
"x-api-key": "pp_live_sk_YOUR_KEY",
"X-Workspace-Id": "YOUR_WORKSPACE_ID",
"Content-Type": "application/json",
},
json={
"generation_id": "550e8400-e29b-41d4-a716-446655440000",
"size": "portrait",
"quantity": 3,
},
)
data = res.json()

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"
  }'
const res = await fetch('https://powerpost.ai/api/v1/images/generate', {
  method: 'POST',
  headers: {
    'x-api-key': 'pp_live_sk_YOUR_KEY',
    'X-Workspace-Id': 'YOUR_WORKSPACE_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    generation_id: '550e8400-e29b-41d4-a716-446655440000',
    prompt: 'Use dark background with neon accents',
    source_post_type: 'instagram-feed',
    size: 'feed',
  }),
})
const data = await res.json()
import requests

res = requests.post(
"https://powerpost.ai/api/v1/images/generate",
headers={
"x-api-key": "pp_live_sk_YOUR_KEY",
"X-Workspace-Id": "YOUR_WORKSPACE_ID",
"Content-Type": "application/json",
},
json={
"generation_id": "550e8400-e29b-41d4-a716-446655440000",
"prompt": "Use dark background with neon accents",
"source_post_type": "instagram-feed",
"size": "feed",
},
)
data = res.json()
  • 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 or unsupported size
401Invalid API key
402Insufficient credits
404Referenced generation_id or style_images not found
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"
const res = await fetch(
  'https://powerpost.ai/api/v1/images/generations/7a8b9c0d-e1f2-3456-abcd-ef7890123456',
  { headers: { 'x-api-key': 'pp_live_sk_YOUR_KEY', 'X-Workspace-Id': 'YOUR_WORKSPACE_ID' } }
)
const data = await res.json()
import requests

res = requests.get(
"https://powerpost.ai/api/v1/images/generations/7a8b9c0d-e1f2-3456-abcd-ef7890123456",
headers={"x-api-key": "pp_live_sk_YOUR_KEY", "X-Workspace-Id": "YOUR_WORKSPACE_ID"},
)
data = res.json()

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,
  "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,
  "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,
  "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
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.

Generations

List generations and check generation status.

Posts & Publishing

Create posts and publish them to connected social platforms.

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 Values