Create post
curl --request POST \
--url https://api.sapt.ai/socials/posts/{projectId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"socialAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"caption": "<string>",
"platform": "instagram",
"linkUrl": "<string>",
"publishNow": true,
"scheduledFor": "<string>",
"timezone": "UTC",
"mediaItems": [
{
"base64": "<string>",
"filename": "<string>",
"mimeType": "<string>"
}
]
}
'import requests
url = "https://api.sapt.ai/socials/posts/{projectId}"
payload = {
"socialAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"caption": "<string>",
"platform": "instagram",
"linkUrl": "<string>",
"publishNow": True,
"scheduledFor": "<string>",
"timezone": "UTC",
"mediaItems": [
{
"base64": "<string>",
"filename": "<string>",
"mimeType": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
socialAccountId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
caption: '<string>',
platform: 'instagram',
linkUrl: '<string>',
publishNow: true,
scheduledFor: '<string>',
timezone: 'UTC',
mediaItems: [{base64: '<string>', filename: '<string>', mimeType: '<string>'}]
})
};
fetch('https://api.sapt.ai/socials/posts/{projectId}', 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://api.sapt.ai/socials/posts/{projectId}",
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([
'socialAccountId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'caption' => '<string>',
'platform' => 'instagram',
'linkUrl' => '<string>',
'publishNow' => true,
'scheduledFor' => '<string>',
'timezone' => 'UTC',
'mediaItems' => [
[
'base64' => '<string>',
'filename' => '<string>',
'mimeType' => '<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://api.sapt.ai/socials/posts/{projectId}"
payload := strings.NewReader("{\n \"socialAccountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"caption\": \"<string>\",\n \"platform\": \"instagram\",\n \"linkUrl\": \"<string>\",\n \"publishNow\": true,\n \"scheduledFor\": \"<string>\",\n \"timezone\": \"UTC\",\n \"mediaItems\": [\n {\n \"base64\": \"<string>\",\n \"filename\": \"<string>\",\n \"mimeType\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.sapt.ai/socials/posts/{projectId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"socialAccountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"caption\": \"<string>\",\n \"platform\": \"instagram\",\n \"linkUrl\": \"<string>\",\n \"publishNow\": true,\n \"scheduledFor\": \"<string>\",\n \"timezone\": \"UTC\",\n \"mediaItems\": [\n {\n \"base64\": \"<string>\",\n \"filename\": \"<string>\",\n \"mimeType\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sapt.ai/socials/posts/{projectId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"socialAccountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"caption\": \"<string>\",\n \"platform\": \"instagram\",\n \"linkUrl\": \"<string>\",\n \"publishNow\": true,\n \"scheduledFor\": \"<string>\",\n \"timezone\": \"UTC\",\n \"mediaItems\": [\n {\n \"base64\": \"<string>\",\n \"filename\": \"<string>\",\n \"mimeType\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"post": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"projectId": "<string>",
"socialAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"platform": "<string>",
"caption": "<string>",
"mediaType": "<string>",
"containerId": "<string>",
"scheduledFor": "<string>",
"timezone": "<string>",
"status": "<string>",
"publishedAt": "<string>",
"permalink": "<string>",
"errorMessage": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>",
"linkUrl": "<string>",
"coverR2Url": "<string>",
"media": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"r2Key": "<string>",
"r2Url": "<string>",
"mediaType": "<string>",
"filename": "<string>",
"mimeType": "<string>",
"sizeBytes": 123,
"orderIndex": 123
}
],
"account": {
"username": "<string>",
"profilePictureUrl": "<string>"
}
}
}
}{
"message": "<string>",
"code": "<string>"
}{
"message": "<string>",
"code": "<string>"
}{
"message": "<string>",
"code": "<string>"
}{
"message": "<string>",
"code": "<string>"
}Socials
Create post
Create a post for any connected platform — Instagram, Facebook, TikTok, YouTube or Google Business Profile. Get socialAccountId from List connected social accounts. Set publishNow: true to publish immediately, or scheduledFor (with timezone) to schedule. Attach media either inline as base64 mediaItems or, for anything large, by streaming it to Stream media upload first and passing the returned handles as uploadedHandles. Instagram Stories must be published immediately.
POST
/
socials
/
posts
/
{projectId}
Create post
curl --request POST \
--url https://api.sapt.ai/socials/posts/{projectId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"socialAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"caption": "<string>",
"platform": "instagram",
"linkUrl": "<string>",
"publishNow": true,
"scheduledFor": "<string>",
"timezone": "UTC",
"mediaItems": [
{
"base64": "<string>",
"filename": "<string>",
"mimeType": "<string>"
}
]
}
'import requests
url = "https://api.sapt.ai/socials/posts/{projectId}"
payload = {
"socialAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"caption": "<string>",
"platform": "instagram",
"linkUrl": "<string>",
"publishNow": True,
"scheduledFor": "<string>",
"timezone": "UTC",
"mediaItems": [
{
"base64": "<string>",
"filename": "<string>",
"mimeType": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
socialAccountId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
caption: '<string>',
platform: 'instagram',
linkUrl: '<string>',
publishNow: true,
scheduledFor: '<string>',
timezone: 'UTC',
mediaItems: [{base64: '<string>', filename: '<string>', mimeType: '<string>'}]
})
};
fetch('https://api.sapt.ai/socials/posts/{projectId}', 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://api.sapt.ai/socials/posts/{projectId}",
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([
'socialAccountId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'caption' => '<string>',
'platform' => 'instagram',
'linkUrl' => '<string>',
'publishNow' => true,
'scheduledFor' => '<string>',
'timezone' => 'UTC',
'mediaItems' => [
[
'base64' => '<string>',
'filename' => '<string>',
'mimeType' => '<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://api.sapt.ai/socials/posts/{projectId}"
payload := strings.NewReader("{\n \"socialAccountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"caption\": \"<string>\",\n \"platform\": \"instagram\",\n \"linkUrl\": \"<string>\",\n \"publishNow\": true,\n \"scheduledFor\": \"<string>\",\n \"timezone\": \"UTC\",\n \"mediaItems\": [\n {\n \"base64\": \"<string>\",\n \"filename\": \"<string>\",\n \"mimeType\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.sapt.ai/socials/posts/{projectId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"socialAccountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"caption\": \"<string>\",\n \"platform\": \"instagram\",\n \"linkUrl\": \"<string>\",\n \"publishNow\": true,\n \"scheduledFor\": \"<string>\",\n \"timezone\": \"UTC\",\n \"mediaItems\": [\n {\n \"base64\": \"<string>\",\n \"filename\": \"<string>\",\n \"mimeType\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sapt.ai/socials/posts/{projectId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"socialAccountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"caption\": \"<string>\",\n \"platform\": \"instagram\",\n \"linkUrl\": \"<string>\",\n \"publishNow\": true,\n \"scheduledFor\": \"<string>\",\n \"timezone\": \"UTC\",\n \"mediaItems\": [\n {\n \"base64\": \"<string>\",\n \"filename\": \"<string>\",\n \"mimeType\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"post": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"projectId": "<string>",
"socialAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"platform": "<string>",
"caption": "<string>",
"mediaType": "<string>",
"containerId": "<string>",
"scheduledFor": "<string>",
"timezone": "<string>",
"status": "<string>",
"publishedAt": "<string>",
"permalink": "<string>",
"errorMessage": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>",
"linkUrl": "<string>",
"coverR2Url": "<string>",
"media": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"r2Key": "<string>",
"r2Url": "<string>",
"mediaType": "<string>",
"filename": "<string>",
"mimeType": "<string>",
"sizeBytes": 123,
"orderIndex": 123
}
],
"account": {
"username": "<string>",
"profilePictureUrl": "<string>"
}
}
}
}{
"message": "<string>",
"code": "<string>"
}{
"message": "<string>",
"code": "<string>"
}{
"message": "<string>",
"code": "<string>"
}{
"message": "<string>",
"code": "<string>"
}Authorizations
JWT token obtained from /api/auth/token endpoint. Token is verified using JWKS and must include a valid user identifier.
Path Parameters
Body
application/json
Maximum string length:
63206Available options:
IMAGE, REELS, CAROUSEL, STORIES, PHOTO, VIDEO, LINK Available options:
instagram, facebook, tiktok, google_business, youtube Show child attributes
Show child attributes
Show child attributes
Show child attributes