Skip to main content
PUT
/
posts
/
{id}
Update post
curl --request PUT \
  --url https://mvp.tryunsora.com/api/v1/posts/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "mainCaption": "<string>",
  "scheduledFor": "2023-11-07T05:31:56Z",
  "timezone": "<string>",
  "accounts": [
    {
      "id": "<string>",
      "accountId": "<string>",
      "customCaption": "<string>",
      "title": "<string>"
    }
  ]
}
'
import requests

url = "https://mvp.tryunsora.com/api/v1/posts/{id}"

payload = {
"mainCaption": "<string>",
"scheduledFor": "2023-11-07T05:31:56Z",
"timezone": "<string>",
"accounts": [
{
"id": "<string>",
"accountId": "<string>",
"customCaption": "<string>",
"title": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
mainCaption: '<string>',
scheduledFor: '2023-11-07T05:31:56Z',
timezone: '<string>',
accounts: [
{
id: '<string>',
accountId: '<string>',
customCaption: '<string>',
title: '<string>'
}
]
})
};

fetch('https://mvp.tryunsora.com/api/v1/posts/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://mvp.tryunsora.com/api/v1/posts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'mainCaption' => '<string>',
'scheduledFor' => '2023-11-07T05:31:56Z',
'timezone' => '<string>',
'accounts' => [
[
'id' => '<string>',
'accountId' => '<string>',
'customCaption' => '<string>',
'title' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

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

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://mvp.tryunsora.com/api/v1/posts/{id}"

payload := strings.NewReader("{\n \"mainCaption\": \"<string>\",\n \"scheduledFor\": \"2023-11-07T05:31:56Z\",\n \"timezone\": \"<string>\",\n \"accounts\": [\n {\n \"id\": \"<string>\",\n \"accountId\": \"<string>\",\n \"customCaption\": \"<string>\",\n \"title\": \"<string>\"\n }\n ]\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://mvp.tryunsora.com/api/v1/posts/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"mainCaption\": \"<string>\",\n \"scheduledFor\": \"2023-11-07T05:31:56Z\",\n \"timezone\": \"<string>\",\n \"accounts\": [\n {\n \"id\": \"<string>\",\n \"accountId\": \"<string>\",\n \"customCaption\": \"<string>\",\n \"title\": \"<string>\"\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://mvp.tryunsora.com/api/v1/posts/{id}")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"mainCaption\": \"<string>\",\n \"scheduledFor\": \"2023-11-07T05:31:56Z\",\n \"timezone\": \"<string>\",\n \"accounts\": [\n {\n \"id\": \"<string>\",\n \"accountId\": \"<string>\",\n \"customCaption\": \"<string>\",\n \"title\": \"<string>\"\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "data": {
    "id": "<string>",
    "userId": "<string>",
    "mainCaption": "<string>",
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z",
    "scheduledFor": "2023-11-07T05:31:56Z",
    "scheduledTimezone": "<string>",
    "publishedAt": "2023-11-07T05:31:56Z",
    "error": "<string>",
    "media": [
      {
        "id": "<string>",
        "postId": "<string>",
        "order": 123,
        "assetId": "<string>"
      }
    ],
    "postAccounts": [
      {
        "id": "<string>",
        "postId": "<string>",
        "accountId": "<string>",
        "published": true,
        "customCaption": "<string>",
        "title": "<string>",
        "publishedAt": "2023-11-07T05:31:56Z",
        "account": {
          "id": "<string>",
          "provider": "<string>",
          "accountName": "<string>",
          "accountUsername": "<string>",
          "profilePicture": "<string>"
        }
      }
    ]
  },
  "message": "<string>"
}
{
"error": "<string>",
"success": true,
"code": "<string>",
"message": "<string>"
}
{
"error": "<string>",
"success": true,
"code": "<string>",
"message": "<string>"
}
{
"success": false,
"error": "<string>",
"code": "PLAN_REQUIRED"
}
{
"error": "<string>",
"success": true,
"code": "<string>",
"message": "<string>"
}
{
"error": "<string>",
"success": true,
"code": "<string>",
"message": "<string>"
}

Authorizations

Authorization
string
header
required

Clerk session JWT or Unsora API key (uns_live_*)

Path Parameters

id
string
required

Body

application/json
mainCaption
string
scheduledFor
string<date-time> | null

Set null to clear schedule and revert to draft

timezone
string
accounts
object[]
Minimum array length: 1

Response

Post updated

success
boolean
required
data
object
required
message
string