Skip to content

generate_image

Generates an image from a text prompt, stores it, and returns a hosted URL ready to pass straight to create_post as mediaUrl. Pass a brandingId from list_brandings to match the workspace’s visual style. Spends AI tokens rather than publishing credits.

On this page
  1. Parameters
  2. Example request
  3. Response
Category
Media
REST
POST/api/tools/generate_image

Parameters

prompt
stringrequired
What the image should show — subject, composition, mood.
brandingId
stringoptional
Brand kit id whose reference image steers the style.
styleImageUrl
stringoptional
Public URL of a reference image, instead of a brand kit.
workspaceId
stringoptional
Workspace to act on, from list_workspaces. Omit to use the default workspace on the key.

Example request

curl -X POST "https://api.postmcpai.com/api/tools/generate_image" \
  -H "Content-Type: application/json" \
  -H "x-api-key: $POSTMCPAI_API_KEY" \
  -d '{
    "prompt": "Minimal product shot on a dark background, soft rim light",
    "brandingId": "66f2b8a1c0de4471aa02"
  }'

Response

The hosted media URL.

200 · application/json
{
  "mediaUrl": "https://cdn.postmcpai.com/generated/6c19f2a4.png",
  "hint": "Pass this as mediaUrl to create_post or update_post to attach it."
}