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. Costs 20 credits from the workspace balance and needs a paid plan; pass styleImageUrl to steer the visual style.
- Access
- write
- Category
- Media
- Endpoint
POST/api/tools/generate_image
On this page
Parameters
promptstringrequired
What the image should show — subject, composition, mood.
styleImageUrlstring
Public URL of a reference image to steer the style.
workspaceIdstring
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"
}'Response
The hosted media URL, with what it cost and what is left.
{
"mediaUrl": "https://cdn.postmcpai.com/generated/6c19f2a4.png",
"creditCost": 20,
"remainingCredits": 430,
"hint": "Pass this as mediaUrl to create_post or update_post to attach it."
}