Your API key. Create one in Ocoya. Authorization: Bearer <key> works too.
Create an AI-generated campaign
Queues generation for a multi-post AI campaign and returns immediately with GENERATING status. Campaign posts are generated asynchronously in the background.
curl --request POST \
--url https://www.app.ocoya.com/api/_public/v1/campaigns \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"prompt": "Summer launch campaign for our ecommerce analytics dashboard.",
"goal": "launch",
"duration": 10,
"startDate": "2026-11-02",
"postsPerDay": 1,
"count": 6,
"postLength": "medium",
"hashtagLibraryId": "cmayw7l5200067apsmz2tv7e8",
"socialProfileIds": [
"clh49poxf008x8kov4ncbjty9"
],
"generateMedia": true,
"imageCount": 3,
"referenceUrls": [
"https://example.com/reference.png"
],
"referenceDesignIds": [
"design_123"
]
}
'{
"campaignId": "cmayxcmpn00087aps2m7hjs9z",
"status": "GENERATING",
"queued": true,
"generation": {}
}Authorizations
Body
Day of the first post, YYYY-MM-DD. Must be tomorrow or later; anything else starts the campaign tomorrow.
How often to post: 0.5 is every other day, 1-4 is posts per day. Omit to spread count posts evenly over duration.
Hashtag library ID used for hashtag context. Get IDs from GET /hashtag-libraries.
Connected social profile IDs to attach when generated campaign posts are saved. Get IDs from GET /social-profiles.
Number of images to generate for each campaign post, from 1 to 10. Values above 1 create carousel-style post creatives. Defaults to 1.
Optional image URLs to use as visual references when generateMedia is true. Maximum 3.
Was this page helpful?