import { OctosparkClient } from '@octospark/sdk'
const client = new OctosparkClient({
token: process.env.OCTOSPARK_TOKEN
})
const response = await client.social.movePostToDraft({
teamId: process.env.OCTOSPARK_TEAM_ID ?? "teamId",
postId: process.env.OCTOSPARK_POST_ID ?? "postId",
})import os
from octospark_sdk import OctosparkClient
client = OctosparkClient(token=os.environ["OCTOSPARK_TOKEN"])
response = client.social.move_post_to_draft(
teamId=os.environ.get("OCTOSPARK_TEAM_ID", "teamId"),
postId=os.environ.get("OCTOSPARK_POST_ID", "postId")
)octospark social move-post-to-draft \
--request '{"path":{"teamId":"teamId","postId":"postId"}}'use reqwest::Client;
use std::env;
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let base_url = env::var("OCTOSPARK_API_URL").unwrap_or_else(|_| "https://api.octospark.ai".to_string());
let team_id = env::var("OCTOSPARK_TEAM_ID").unwrap_or_else(|_| "teamId".to_string());
let post_id = env::var("OCTOSPARK_POST_ID").unwrap_or_else(|_| "postId".to_string());
let url = format!("{}/v1/teams/{}/posts/{}/move-to-draft", base_url.trim_end_matches('/'), team_id, post_id);
let token = env::var("OCTOSPARK_TOKEN").expect("OCTOSPARK_TOKEN");
let mut request = client.post(url).bearer_auth(token);
let response = request.send().await?;
println!("{}", response.text().await?);
Ok(())
}import 'dart:convert';
import 'dart:io';
import 'package:http/http.dart' as http;
Future<void> main() async {
final baseUrl = Platform.environment['OCTOSPARK_API_URL'] ?? 'https://api.octospark.ai';
final token = Platform.environment['OCTOSPARK_TOKEN'];
final teamId = Platform.environment['OCTOSPARK_TEAM_ID'] ?? 'teamId';
final postId = Platform.environment['OCTOSPARK_POST_ID'] ?? 'postId';
final url = '${baseUrl.replaceFirst(RegExp(r'/$'), '')}/v1/teams/$teamId/posts/$postId/move-to-draft';
final uri = Uri.parse(url);
final headers = {
'Authorization': 'Bearer $token',
};
final response = await http.post(
uri,
headers: headers,
);
print(response.body);
}curl --request POST \
--url https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body$headers=@{}
$headers.Add("Authorization", "Bearer <token>")
$response = Invoke-WebRequest -Uri 'https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft' -Method POST -Headers $headersimport Foundation
let url = URL(string: "https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = ["Authorization": "Bearer <token>"]
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))using RestSharp;
var options = new RestClientOptions("https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);using RestSharp;
var options = new RestClientOptions("https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);val client = OkHttpClient()
val request = Request.Builder()
.url("https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft")
.post(null)
.addHeader("Authorization", "Bearer <token>")
.build()
val response = client.newCall(request).execute(){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"teamId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"text": "<string>",
"assetIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"assetTags": [
"<string>"
],
"userTags": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"colour": "<string>"
}
],
"contentPayloadId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"latestScheduledPost": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"teamId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contentItemId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"socialAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scheduledAt": "<string>",
"timezone": "Europe/London",
"platformPostId": "<string>",
"platformSettings": {},
"publishResults": {},
"providerPublishState": {
"requiresPolling": true,
"publishId": "<string>",
"platformPostId": "<string>",
"providerStatus": "<string>",
"pollingReason": "<string>",
"uploadProgress": {
"nextByteStart": 123,
"uploadSize": 123
},
"failureCode": "<string>"
},
"errorCode": "<string>",
"errorMessage": "<string>",
"workflowId": "<string>",
"workflowRunId": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>"
},
"scheduledDestinationAccountIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"createdAt": "<string>",
"updatedAt": "<string>",
"postInput": {
"kind": "atomic",
"text": "<string>",
"attachments": [
{
"kind": "media",
"asset": {
"assetId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"mimeType": "<string>",
"byteSize": 123,
"width": 123,
"height": 123,
"durationSeconds": 123,
"thumbnailUrl": "<string>",
"altText": "<string>"
},
"altText": "<string>"
}
]
},
"postPublishActions": {
"firstComment": {
"text": "<string>",
"mediaIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
},
"engagementCommentTrigger": {
"likeThreshold": 2,
"windowHours": 360,
"comment": {
"text": "<string>",
"mediaIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
},
"repostAfter": {
"offsetDays": 15,
"text": "<string>"
},
"recurrenceIntervalDays": 183,
"recurrenceEndsAt": "<string>"
}
}{
"issues": [
{
"path": [
"<string>"
],
"message": "<string>"
}
],
"message": "<string>",
"_tag": "HttpApiDecodeError"
}{
"message": "<string>",
"_tag": "Unauthorized"
}{
"message": "<string>",
"_tag": "PaymentRequired"
}{
"message": "<string>",
"_tag": "Forbidden"
}{
"message": "<string>",
"_tag": "NotFound"
}{
"message": "<string>",
"_tag": "Conflict"
}{
"message": "<string>",
"_tag": "TooManyRequests"
}{
"message": "<string>",
"_tag": "InternalError"
}Move post to draft
Cancel a post’s schedule and any pending publish actions, returning it to draft status. Use this to stop an upcoming publish without deleting the post; you can then edit with updatePost and reschedule with schedulePost.
import { OctosparkClient } from '@octospark/sdk'
const client = new OctosparkClient({
token: process.env.OCTOSPARK_TOKEN
})
const response = await client.social.movePostToDraft({
teamId: process.env.OCTOSPARK_TEAM_ID ?? "teamId",
postId: process.env.OCTOSPARK_POST_ID ?? "postId",
})import os
from octospark_sdk import OctosparkClient
client = OctosparkClient(token=os.environ["OCTOSPARK_TOKEN"])
response = client.social.move_post_to_draft(
teamId=os.environ.get("OCTOSPARK_TEAM_ID", "teamId"),
postId=os.environ.get("OCTOSPARK_POST_ID", "postId")
)octospark social move-post-to-draft \
--request '{"path":{"teamId":"teamId","postId":"postId"}}'use reqwest::Client;
use std::env;
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let base_url = env::var("OCTOSPARK_API_URL").unwrap_or_else(|_| "https://api.octospark.ai".to_string());
let team_id = env::var("OCTOSPARK_TEAM_ID").unwrap_or_else(|_| "teamId".to_string());
let post_id = env::var("OCTOSPARK_POST_ID").unwrap_or_else(|_| "postId".to_string());
let url = format!("{}/v1/teams/{}/posts/{}/move-to-draft", base_url.trim_end_matches('/'), team_id, post_id);
let token = env::var("OCTOSPARK_TOKEN").expect("OCTOSPARK_TOKEN");
let mut request = client.post(url).bearer_auth(token);
let response = request.send().await?;
println!("{}", response.text().await?);
Ok(())
}import 'dart:convert';
import 'dart:io';
import 'package:http/http.dart' as http;
Future<void> main() async {
final baseUrl = Platform.environment['OCTOSPARK_API_URL'] ?? 'https://api.octospark.ai';
final token = Platform.environment['OCTOSPARK_TOKEN'];
final teamId = Platform.environment['OCTOSPARK_TEAM_ID'] ?? 'teamId';
final postId = Platform.environment['OCTOSPARK_POST_ID'] ?? 'postId';
final url = '${baseUrl.replaceFirst(RegExp(r'/$'), '')}/v1/teams/$teamId/posts/$postId/move-to-draft';
final uri = Uri.parse(url);
final headers = {
'Authorization': 'Bearer $token',
};
final response = await http.post(
uri,
headers: headers,
);
print(response.body);
}curl --request POST \
--url https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body$headers=@{}
$headers.Add("Authorization", "Bearer <token>")
$response = Invoke-WebRequest -Uri 'https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft' -Method POST -Headers $headersimport Foundation
let url = URL(string: "https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = ["Authorization": "Bearer <token>"]
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))using RestSharp;
var options = new RestClientOptions("https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);using RestSharp;
var options = new RestClientOptions("https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);val client = OkHttpClient()
val request = Request.Builder()
.url("https://api.octospark.ai/v1/teams/{teamId}/posts/{postId}/move-to-draft")
.post(null)
.addHeader("Authorization", "Bearer <token>")
.build()
val response = client.newCall(request).execute(){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"teamId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"text": "<string>",
"assetIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"assetTags": [
"<string>"
],
"userTags": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"colour": "<string>"
}
],
"contentPayloadId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"latestScheduledPost": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"teamId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contentItemId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"socialAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scheduledAt": "<string>",
"timezone": "Europe/London",
"platformPostId": "<string>",
"platformSettings": {},
"publishResults": {},
"providerPublishState": {
"requiresPolling": true,
"publishId": "<string>",
"platformPostId": "<string>",
"providerStatus": "<string>",
"pollingReason": "<string>",
"uploadProgress": {
"nextByteStart": 123,
"uploadSize": 123
},
"failureCode": "<string>"
},
"errorCode": "<string>",
"errorMessage": "<string>",
"workflowId": "<string>",
"workflowRunId": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>"
},
"scheduledDestinationAccountIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"createdAt": "<string>",
"updatedAt": "<string>",
"postInput": {
"kind": "atomic",
"text": "<string>",
"attachments": [
{
"kind": "media",
"asset": {
"assetId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"mimeType": "<string>",
"byteSize": 123,
"width": 123,
"height": 123,
"durationSeconds": 123,
"thumbnailUrl": "<string>",
"altText": "<string>"
},
"altText": "<string>"
}
]
},
"postPublishActions": {
"firstComment": {
"text": "<string>",
"mediaIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
},
"engagementCommentTrigger": {
"likeThreshold": 2,
"windowHours": 360,
"comment": {
"text": "<string>",
"mediaIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
},
"repostAfter": {
"offsetDays": 15,
"text": "<string>"
},
"recurrenceIntervalDays": 183,
"recurrenceEndsAt": "<string>"
}
}{
"issues": [
{
"path": [
"<string>"
],
"message": "<string>"
}
],
"message": "<string>",
"_tag": "HttpApiDecodeError"
}{
"message": "<string>",
"_tag": "Unauthorized"
}{
"message": "<string>",
"_tag": "PaymentRequired"
}{
"message": "<string>",
"_tag": "Forbidden"
}{
"message": "<string>",
"_tag": "NotFound"
}{
"message": "<string>",
"_tag": "Conflict"
}{
"message": "<string>",
"_tag": "TooManyRequests"
}{
"message": "<string>",
"_tag": "InternalError"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Team (workspace) id (UUID). Discover ids via the list teams endpoint or the agent context.
Post id (UUID), as returned by the create post and list posts endpoints.
Response
Success
UUID of the post.
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"3c9d8e7f-6a5b-4c3d-9e2f-1a0b9c8d7e6f"
a Universally Unique Identifier
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$Content format of a post: text_post (text only), text_image, text_video, or carousel (2+ photos).
text_post, text_image, text_video, carousel "text_post"
"text_image"
Editorial status of a post: idea, proposed_render, draft, approved, rejected, archived, or deleted.
idea, proposed_render, draft, approved, rejected, archived, deleted "draft"
"approved"
a Universally Unique Identifier
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$Deduped, sorted union of the post's non-deleted assets' AI tags; empty for text-only posts.
["launch", "product"]User/agent-assigned registry tags (id, name, colour) on the post; distinct from AI-derived assetTags. Empty when no tags are assigned.
Show child attributes
Show child attributes
a Universally Unique Identifier
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$Show child attributes
Show child attributes
a Universally Unique Identifier
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$queue, drafts Saved to Queue, Saved to Drafts - Option 1
- Option 2
Show child attributes
Show child attributes
Show child attributes
Show child attributes