Skip to main content
POST
https://app.ocoya.com/api/_public/v1
/
post
/
ai
Create an AI-generated draft post
curl --request POST \
  --url https://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."
}
'
const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({prompt: 'Write a launch post for our new analytics dashboard.'})
};

fetch('https://app.ocoya.com/api/_public/v1/post/ai', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
import requests

url = "https://app.ocoya.com/api/_public/v1/post/ai"

payload = { "prompt": "Write a launch post for our new analytics dashboard." }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://app.ocoya.com/api/_public/v1/post/ai",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => 'Write a launch post for our new analytics dashboard.'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
require 'uri'
require 'net/http'

url = URI("https://app.ocoya.com/api/_public/v1/post/ai")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"Write a launch post for our new analytics dashboard.\"\n}"

response = http.request(request)
puts response.read_body

Authorizations

X-API-Key
string
header
required

Query Parameters

workspaceId
string
required

Ocoya workspace ID. Get one from GET /workspaces.

Example:

"cmayvq3hk00017apshay5qezu"

Body

application/json
prompt
string
required

Prompt describing the post Ocoya should generate. Minimum 10 characters.

Minimum string length: 10
Example:

"Write a launch post for our new analytics dashboard."

tone
enum<string>

Caption tone for the AI draft.

Available options:
professional,
friendly,
educational,
bold,
founder_led
Example:

"professional"

postLength
enum<string>

Target caption length for the AI draft.

Available options:
short,
medium,
long,
extra_long
Example:

"medium"

socialProfileIds
string[]

Connected social profile IDs that should receive the post. Get IDs from GET /social-profiles.

Example:
["clh49poxf008x8kov4ncbjty9"]
brandId
string

Brand kit ID used for brand context. Get IDs from GET /brand-kits.

Example:

"cmayw38dz00047apsue9nw4tf"

hashtagLibraryId
string

Hashtag library ID used for hashtag context. Get IDs from GET /hashtag-libraries.

Example:

"cmayw7l5200067apsmz2tv7e8"

generateImage
boolean

Whether to generate square image media for the AI draft.

Example:

true

imageCount
integer

Number of generated images when generateImage is true. Use 1 for a single image or 2-5 for a carousel.

Required range: 1 <= x <= 5
Example:

3

referenceUrls
string[]

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.

Example:
["https://example.com/reference.png"]
referenceDesignIds
string[]

Optional Studio design IDs to use as visual references when generateImage is true. Get IDs from GET /studio-templates.

Example:
["design_123"]

Response

Queued. Returns immediately with status GENERATING; fetch the post later to see the completed draft.