There are two ways to post Instagram Reels, TikToks and YouTube videos from your own code. Build it yourself: one integration per network, each with its own app review, token handling and upload flow. Or make one call to a ready API that already went through those approvals, and send the same video to every network at once.
This guide covers both. First the do-it-yourself path, network by network, so you know what you're signing up for. Then the one-call path with the Pedra Social API, with code you can copy.
Path 1: build it yourself, network by network
Each network has an official API for posting video. They work. But each one is its own project: a developer app, a review, an auth flow, token refresh and an upload process that looks nothing like the other two.
Instagram: the Instagram Graph API
What you need before the first post:
- A professional account. The API only publishes to Instagram business or creator accounts, not personal ones.
- A Meta app with the publishing permission. To post to your own account you can test in development mode. To post for anyone else (your clients, your users), you need Meta App Review for advanced access to the content publishing permission, and usually business verification of your company.
- A public video URL. Instagram downloads the video from a URL you give it. It doesn't take a file upload.
Then posting a Reel is two steps:
- Create a container.
POST /<IG_ID>/mediawithmedia_type=REELS, thevideo_urland the caption. You get a container id back. - Publish it. Instagram processes the video first. You check the container's
status_codeuntil it'sFINISHED, then callPOST /<IG_ID>/media_publishwith the container id.
And one thing that keeps running after launch: tokens. Long-lived Instagram tokens last about 60 days. If you don't refresh them in time, posting stops and the user has to log in again. Instagram also caps how many posts an account can publish through the API in 24 hours, so a scheduler has to track that per account.
TikTok: the Content Posting API
The TikTok Content Posting API has a catch that surprises most developers: unaudited apps can only post to private accounts. Until TikTok audits your app, everything you post through it is only visible to the creator. Your test works, your first real customer posts, and nobody sees the video. The error you'll see is unaudited_client_can_only_post_to_private_accounts.
The flow, once your app has the video.publish scope:
- Query creator info. Ask TikTok which privacy levels this creator can use. You have to show those options to the user, not pick one for them.
- Init the post.
POST /v2/post/publish/video/init/with the caption, privacy level and eitherFILE_UPLOAD(you upload the file) orPULL_FROM_URL(TikTok fetches it from a domain you verified). - Upload. For
FILE_UPLOAD, PUT the video to theupload_urlyou got back. - Check the status with the
publish_iduntil it's done.
TikTok access tokens last 24 hours, so you refresh them constantly.
YouTube: the YouTube Data API
The YouTube upload API is videos.insert in the YouTube Data API v3:
- OAuth with the
youtube.uploadscope. For an app other people use, Google requires OAuth app verification for this scope before you're out of testing limits. - Quota. Every Google Cloud project gets a daily quota, and uploads count against it. If you need more, you file a quota extension request with Google.
- Resumable upload. For real videos you use the resumable protocol: start an upload session, PUT the bytes to the session URI, and if the connection drops, ask how many bytes arrived and send the rest.
YouTube shows short vertical videos as Shorts, so the same 9:16 video you post as a Reel works there too.
What the DIY path really costs
Three apps, three reviews, three token systems, three upload flows, and three sets of error messages to map. None of it is hard on its own. Together it's weeks of work before you post anything for a real user, plus the upkeep when a network changes something. If posting video is the core of your product, it can be worth it. If posting is one feature of something else (a CRM, an agency tool, a listing platform), it usually isn't.
Path 2: one call with Pedra's Social API
Pedra already went through the approvals: our Meta app is live with business verification and advanced access to the Instagram and Facebook Page publishing permissions, our TikTok app passed the Direct Post audit, and we have a YouTube Data API quota increase. Your users connect their accounts through Pedra's login, so you don't need your own Meta app, TikTok audit or Google project.
What it does: post or schedule one video to Instagram (as a Reel, on a professional account), a Facebook Page, TikTok and YouTube, with one call. Video only for now, no image or carousel posts.
Before the first call:
- Sign up at app.pedra.ai and copy your key from Settings → API. The Social API needs Pedra Pro.
- Connect the accounts under Settings › Socials. The API can't connect accounts, because the login with each network happens in the app.
Post a video to Instagram and TikTok via API
This call posts the same video to the main Instagram account, a second Instagram account (accountId) and TikTok. Leave out scheduledAt and it goes out within about a minute. Set it and it's scheduled, up to 180 days ahead.
curl -X POST https://app.pedra.ai/api/social/posts \
-H "Content-Type: application/json" \
-d '{
"apiKey": "YOUR_API_KEY",
"videoUrl": "https://example.com/videos/calle-mayor-12.mp4",
"scheduledAt": "2026-12-03T10:00:00+01:00",
"timezone": "Europe/Madrid",
"posts": [
{ "network": "instagram", "caption": "3-bed flat with a sunny terrace. Book a visit, link in bio." },
{ "network": "instagram", "accountId": "Xk3vQ9pLmN2aB7cDe", "caption": "New listing on Calle Mayor 12." },
{ "network": "tiktok", "caption": "3-bed flat with a sunny terrace.", "privacyLevel": "PUBLIC_TO_EVERYONE" }
]
}'
The rules that matter:
videoUrlis a public https MP4, up to 1 GB. Pedra copies it, so your URL only has to work during the call.- TikTok needs
privacyLevel, and it has to be one the creator's account allows. YouTube needs atitle, andcaptionbecomes the description. - Leave out
accountIdand the post goes to the network's main account.
You get one post back per entry, each with status: "pending":
{
"videoId": "cf568771-4d2a-4e8b-9c3f-1a7e5b2d8f60",
"videoUrl": "https://img.pedra.ai/social-videos/cf568771-4d2a-4e8b-9c3f-1a7e5b2d8f60.mp4",
"posts": [
{ "postId": "KBkxMfAPARdEG4gix", "network": "instagram", "accountId": "main", "status": "pending" },
{ "postId": "Rf6dW1nHq8ZsYc3Tm", "network": "instagram", "accountId": "Xk3vQ9pLmN2aB7cDe", "status": "pending" },
{ "postId": "q3TzR8wYbN5cLm2Hd", "network": "tiktok", "accountId": "main", "status": "pending" }
]
}
Check the status
/posts/list tells you what went out. Each post moves through pending, processing and posted (or failed, or cancelled if you cancel it first). Once it's posted, platformPostId holds the network's own post id. If it failed, error says why.
curl -X POST https://app.pedra.ai/api/social/posts/list \
-H "Content-Type: application/json" \
-d '{ "apiKey": "YOUR_API_KEY", "status": "failed", "limit": 20 }'
You can filter by status, network, accountId and date. To stop a scheduled post, call /posts/cancel with its postId while it's still pending.
The same thing in Python
The SDKs don't have social methods yet, so this is plain HTTP. It posts to Instagram, TikTok and YouTube, then checks the result:
import requests
API = "https://app.pedra.ai/api/social"
API_KEY = "YOUR_API_KEY"
def call(path, body):
res = requests.post(f"{API}/{path}", json={"apiKey": API_KEY, **body})
data = res.json()
if not res.ok:
raise RuntimeError(f"{data['code']}: {data['error']}")
return data
caption = "3-bed flat with a sunny terrace. Book a visit, link in bio."
result = call("posts", {
"videoUrl": "https://example.com/videos/calle-mayor-12.mp4",
"posts": [
{"network": "instagram", "caption": caption},
{"network": "tiktok", "caption": caption, "privacyLevel": "PUBLIC_TO_EVERYONE"},
{"network": "youtube", "title": "Calle Mayor 12: 3-bed flat with terrace", "caption": caption},
],
})
for post in result["posts"]:
print(post["network"], post["postId"], post["status"])
# A minute later
for post in call("posts/list", {"limit": 10})["posts"]:
print(post["network"], post["status"], post["platformPostId"] or post["error"])
Errors come back as { "error": "...", "code": "..." }. Branch on code: for example not_connected (connect the account in the app), pro_required or daily_limit. The full list is in the Social API docs.
Many accounts: agencies, CRMs and platforms
If you build for many clients, you don't want one Pedra account per client. One Pedra account can connect several Instagram accounts, several Facebook Pages, several TikToks and several YouTube channels. Each extra account gets its own accountId, and you pick the account per post.
/accounts lists them all:
curl -X POST https://app.pedra.ai/api/social/accounts \
-H "Content-Type: application/json" \
-d '{ "apiKey": "YOUR_API_KEY" }'
{
"accounts": [
{ "network": "instagram", "accountId": "main", "main": true, "connected": true, "account": "pedra_ai" },
{ "network": "instagram", "accountId": "Xk3vQ9pLmN2aB7cDe", "main": false, "connected": true, "account": "casasol_inmobiliaria" },
{ "network": "tiktok", "accountId": "main", "main": true, "connected": true, "account": "pedra_ai" }
]
}
The first account on each network has accountId: "main". Store the others' ids next to the client they belong to in your database, and pass the right one in each post. In Node, posting one video to every connected Instagram account looks like this:
const API = "https://app.pedra.ai/api/social";
const API_KEY = "YOUR_API_KEY";
async function call(path, body) {
const res = await fetch(`${API}/${path}`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ apiKey: API_KEY, ...body }),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
return data;
}
const { accounts } = await call("accounts", {});
const instagram = accounts.filter((a) => a.network === "instagram" && a.connected);
const result = await call("posts", {
videoUrl: "https://example.com/videos/calle-mayor-12.mp4",
posts: instagram.map((a) => ({
network: "instagram",
accountId: a.accountId,
caption: "New listing on Calle Mayor 12. Book a visit, link in bio.",
})),
});
console.log(result.posts.map((p) => `${p.accountId}: ${p.status}`));
What to know:
- Price. The first account per network is included in Pro. Each extra account costs 1 € per month, billed with the subscription. There's no fee per post.
- Limits. 25 posts per account in any rolling 24 hours. The same account can't appear twice in one request.
- Connecting. Extra accounts are added in the app, under Settings › Socials, with Add extra account below the list: pick the network, and on Facebook the Page.
For real estate: make the video first, then post it
Most posting APIs assume you already have the video. In real estate you usually have listing photos, not a video. Pedra does both: the Video API turns listing photos into a property video, and the Social API posts it.
# 1. Make a vertical video from the listing photos
curl -X POST https://app.pedra.ai/api/create_video \
-H "Content-Type: application/json" \
-d '{
"apiKey": "YOUR_API_KEY",
"images": [
{ "imageUrl": "https://example.com/facade.jpg", "effect": "zoom-in" },
{ "imageUrl": "https://example.com/living-room.jpg", "effect": "zoom-out" },
{ "imageUrl": "https://example.com/terrace.jpg", "effect": "zoom-in" }
],
"isVertical": true,
"endingTitle": "Book a visit",
"endingSubtitle": "casasol.es"
}'
# 2. Post the videoUrl it returns, as is
curl -X POST https://app.pedra.ai/api/social/posts \
-H "Content-Type: application/json" \
-d '{
"apiKey": "YOUR_API_KEY",
"videoUrl": "VIDEO_URL_FROM_STEP_1",
"posts": [
{ "network": "instagram", "caption": "Just listed: 3-bed flat with terrace." },
{ "network": "youtube", "title": "Just listed: 3-bed flat with terrace", "caption": "Book a visit at casasol.es" }
]
}'
By default create_video waits until the video is rendered and returns its videoUrl. Zoom-in and zoom-out clips are free and unlimited. AI animation costs 5 credits per photo. Posting costs nothing. So a CRM can turn every new listing into a Reel, a TikTok and a Short without anyone opening an editor.
The same endpoints are also tools on Pedra's remote MCP server, so ChatGPT or Claude can make the video and schedule the posts from a chat. For the rest of what the API does (virtual staging, 360 tours, floor plans), see the real estate API.
Which path should you take?
Build it yourself if posting is your product, you need networks or formats Pedra doesn't cover (images, carousels, text posts, LinkedIn), or you want full control of every network's options. Use one call if posting video is a feature inside something bigger and you'd rather ship this week than wait on three reviews.
Building for many agents? The social media API for real estate page has the pricing, the account limits and how to get started.
Frequently asked questions
Can you post Instagram Reels with the API?
Yes. The Instagram Graph API lets a professional account (business or creator) publish Reels. You create a media container with the video URL, wait until it's ready, then publish it. Your app needs the publishing permission, which for other people's accounts means Meta App Review.
Do I need Meta App Review to post to Instagram via API?
If your app posts to accounts you don't own, yes: you need advanced access to the publishing permissions, plus business verification. With Pedra you skip that, because accounts connect through Pedra's Meta app, which already has advanced access.
Why are my TikTok API posts private?
TikTok restricts content posted by unaudited apps to private viewing. To post publicly, your app has to pass TikTok's Content Posting API audit. Pedra's app passed the Direct Post audit, so posts through Pedra can be public.
How do I upload a video to YouTube with the API?
With the YouTube Data API: call videos.insert with an OAuth token that has the youtube.upload scope, ideally with a resumable upload. Uploads count against your project's daily quota. With Pedra, you add a YouTube entry with a title to the same call as Instagram and TikTok.
How much does it cost to post via Pedra's API?
The Social API needs Pedra Pro, from 29 € per month with no commitment. Posting itself is free: no credits per post. The first account per network is included, and each extra account costs 1 € per month.
