Skip to main content
PATCH
https://app.ocoya.com/api/_public/v1
/
post
/
{postId}
Update post
curl --request PATCH \
  --url https://app.ocoya.com/api/_public/v1/post/{postId} \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "caption": "Launching our summer campaign today.",
  "scheduledAt": "2024-01-01T00:00:00Z",
  "publishNow": true,
  "brandId": "cmayw7l5200067apsmz2tv7e8",
  "mediaUrls": [
    "https://example.com/image.jpg"
  ],
  "addMediaUrls": [
    "https://example.com/image.jpg"
  ],
  "clearMedia": false,
  "socialProfileIds": [
    "clh49poxf008x8kov4ncbjty9"
  ],
  "addSocialProfileIds": [
    "clh49poxf008x8kov4ncbjty9"
  ]
}
'
const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
caption: 'Launching our summer campaign today.',
scheduledAt: '2024-01-01T00:00:00Z',
publishNow: true,
brandId: 'cmayw7l5200067apsmz2tv7e8',
mediaUrls: ['https://example.com/image.jpg'],
addMediaUrls: ['https://example.com/image.jpg'],
clearMedia: false,
socialProfileIds: ['clh49poxf008x8kov4ncbjty9'],
addSocialProfileIds: ['clh49poxf008x8kov4ncbjty9']
})
};

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

payload = {
"caption": "Launching our summer campaign today.",
"scheduledAt": "2024-01-01T00:00:00Z",
"publishNow": True,
"brandId": "cmayw7l5200067apsmz2tv7e8",
"mediaUrls": ["https://example.com/image.jpg"],
"addMediaUrls": ["https://example.com/image.jpg"],
"clearMedia": False,
"socialProfileIds": ["clh49poxf008x8kov4ncbjty9"],
"addSocialProfileIds": ["clh49poxf008x8kov4ncbjty9"]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.patch(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/{postId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'caption' => 'Launching our summer campaign today.',
'scheduledAt' => '2024-01-01T00:00:00Z',
'publishNow' => true,
'brandId' => 'cmayw7l5200067apsmz2tv7e8',
'mediaUrls' => [
'https://example.com/image.jpg'
],
'addMediaUrls' => [
'https://example.com/image.jpg'
],
'clearMedia' => false,
'socialProfileIds' => [
'clh49poxf008x8kov4ncbjty9'
],
'addSocialProfileIds' => [
'clh49poxf008x8kov4ncbjty9'
]
]),
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/{postId}")

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

request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"caption\": \"Launching our summer campaign today.\",\n \"scheduledAt\": \"2024-01-01T00:00:00Z\",\n \"publishNow\": true,\n \"brandId\": \"cmayw7l5200067apsmz2tv7e8\",\n \"mediaUrls\": [\n \"https://example.com/image.jpg\"\n ],\n \"addMediaUrls\": [\n \"https://example.com/image.jpg\"\n ],\n \"clearMedia\": false,\n \"socialProfileIds\": [\n \"clh49poxf008x8kov4ncbjty9\"\n ],\n \"addSocialProfileIds\": [\n \"clh49poxf008x8kov4ncbjty9\"\n ]\n}"

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

Authorizations

X-API-Key
string
header
required

Path Parameters

postId
string
required

Ocoya post ID.

Example:

"cmajvvb9q0003ja5vh0538j6r"

Body

application/json
caption
string

New caption to apply to existing post variations.

Example:

"Launching our summer campaign today."

scheduledAt
string | null

ISO 8601 datetime when the post should be scheduled, or null to make it unscheduled.

Example:

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

publishNow
boolean

Publish the existing post immediately without creating a new post.

Example:

true

brandId
string | null

Brand kit ID to apply, or null to remove the brand kit.

Example:

"cmayw7l5200067apsmz2tv7e8"

mediaUrls
string[]

Full replacement set of publicly reachable image or video URLs. Maximum 5. Use an empty array to remove all media.

Example:
["https://example.com/image.jpg"]
addMediaUrls
string[]

Publicly reachable image or video URLs to add without removing existing media. Maximum 5 total.

Example:
["https://example.com/image.jpg"]
clearMedia
boolean

Remove all media from the post. Ignored when mediaUrls is provided.

Example:

false

socialProfileIds
string[]

Full replacement set of connected social profile IDs that should receive the post. Get IDs from GET /social-profiles.

Example:
["clh49poxf008x8kov4ncbjty9"]
addSocialProfileIds
string[]

Connected social profile IDs to add without removing profiles already attached to the post.

Example:
["clh49poxf008x8kov4ncbjty9"]

Response

Success