Skip to main content
POST
https://app.ocoya.com/api/_public/v1
/
post
Create a scheduled or a draft post
curl --request POST \
  --url https://app.ocoya.com/api/_public/v1/post \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "caption": "Happy new year everyone!",
  "mediaUrls": [
    "https://yourmediaurl.com"
  ]
}
'
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({caption: 'Happy new year everyone!', mediaUrls: ['https://yourmediaurl.com']})
};

fetch('https://app.ocoya.com/api/_public/v1/post', 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"

payload = {
    "caption": "Happy new year everyone!",
    "mediaUrls": ["https://yourmediaurl.com"]
}
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",
  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([
    'caption' => 'Happy new year everyone!',
    'mediaUrls' => [
        'https://yourmediaurl.com'
    ]
  ]),
  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")

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  \"caption\": \"Happy new year everyone!\",\n  \"mediaUrls\": [\n    \"https://yourmediaurl.com\"\n  ]\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
caption
string
required

Text caption for the post.

Example:

"Happy new year everyone!"

mediaUrls
array
required

Publicly accessible media URLs to attach to the post.

Example:
["https://yourmediaurl.com"]
socialProfileIds
array

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

Example:
["clh49poxf008x8kov4ncbjty9"]
scheduledAt
string

ISO 8601 datetime when the post should be scheduled. Omit to save as draft.

Example:

"2024-01-01T00:00:00Z"

Response

Created