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
- Category
- Media
- REST
- POST/api/tools/generate_image
Parameters
promptstringrequired
What the image should show — subject, composition, mood.
brandingIdstringoptional
Brand kit id whose reference image steers the style.
styleImageUrlstringoptional
Public URL of a reference image, instead of a brand kit.
workspaceIdstringoptional
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.
{
"mediaUrl": "https://cdn.postmcpai.com/generated/6c19f2a4.png",
"hint": "Pass this as mediaUrl to create_post or update_post to attach it."
}