Your API key. Create one in Ocoya. Authorization: Bearer <key> works too.
Create an AI-generated draft post
Generates a post caption and creates a draft post. Optionally attaches channels and AI-generated images.
curl --request POST \
--url https://www.app.ocoya.com/api/_public/v1/post/ai \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"prompt": "Write a launch post for our new analytics dashboard.",
"tone": "professional",
"postLength": "medium",
"channelIds": [
"clh49poxf008x8kov4ncbjty9"
],
"generateImage": true,
"imageCount": 3,
"referenceUrls": [
"https://example.com/reference.png"
],
"referenceDesignIds": [
"design_123"
],
"studioDesignId": "design_123",
"studioDesignFields": {
"pixy-cmte3datf00f435708hleujti": "https://example.com/logo.png"
}
}
'{
"postGroupId": "cmajvvb9q0003ja5vh0538j6r",
"status": "GENERATING",
"scheduledAt": null
}Authorizations
Body
Number of generated images when generateImage is true. Use 1 for a single image or 2-10 for a carousel.
Optional image URLs to use as visual references when generateImage is true. Ocoya uses these images for style, composition, layout, and subject guidance; they are not attached directly to the post.
Optional Studio design IDs to use as visual references when generateImage is true. Get IDs from GET /studio-templates.
Optional ID of the brand's own Studio design, from GET /studio-designs. The post's image is then that design, with its text layers written by the AI from the caption, instead of an AI-generated image. Every other layer stays as designed unless set in studioDesignFields. generateImage, imageCount and references are ignored.
Optional values for the Studio design's layers, keyed by field ID from GET /studio-designs/{designId}: an image URL for an image field (a logo, a product photo), a CSS colour for a colour field, or text for a text field, which is then used as given instead of being written by the AI. Only used with studioDesignId.
Response
Queued. Returns immediately with status GENERATING; fetch the post later to see the completed draft.
Was this page helpful?