thelastapi
Get started free

Post to Instagram, TikTok and LinkedIn from one API

Publish to Instagram, TikTok, and LinkedIn in one API call with thelastapi, including per-network options, media uploads, and approval guardrails.

On this page 7 sections

You can publish to Instagram, TikTok, and LinkedIn simultaneously with a single API request through thelastapi. By sending your text, media URLs, and account IDs to POST /v1/projects/:id/social/posts, your post reaches each network while respecting its individual media limits, character rules, and options. One API key handles the authentication, scheduling, file uploads, and post statuses across all three platforms.

Managing separate developer accounts, rotating OAuth tokens, and handling three different media upload pipelines takes time away from shipping your product. This guide shows you how to connect your accounts, format a single request for multiple platforms, and safely test your publishing pipeline in a local sandbox.

Why multi-platform posting usually breaks down

Building direct integrations with Instagram, TikTok, and LinkedIn usually means maintaining three completely different architectures:

  • Authentication expires unpredictably. Token refresh flows differ across platforms. An expired token on one platform can stall your entire publishing queue while the others succeed silently.
  • Payload formats do not match. Instagram requires image or video media on every post, TikTok requires media along with specific privacy levels, and LinkedIn supports standalone text or image carousels with longer copy.
  • Media processing requires multiple steps. Most social networks do not accept a simple file payload in the post creation call. You usually must request an upload URL, chunk your video binary, poll for processing status, and only then attach the resulting asset ID to a post object.
  • AI agents lack guardrails. If you let an automated script or an AI agent call raw social media APIs directly, an errant prompt or network retry can broadcast unreviewed drafts to live audiences.

A unified social API abstracts the platform-specific quirks while preserving platform-specific controls like first comments and privacy settings.

Connect your accounts safely

Before posting, you must connect your accounts to a thelastapi project. You can do this using the CLI or the REST API.

Connecting a production account returns a secure URL valid for one hour. Only the owner of the thelastapi account can open this URL, inspect the permissions requested, and complete the OAuth flow with the social platform. An API key with Limited access or an automated agent cannot connect arbitrary accounts without owner consent.

To generate a connection link from your terminal:

Terminal
vibiz social connect instagram --open
vibiz social connect tiktok --open
vibiz social connect linkedin --open

Using curl, send a request to the /social/connect endpoint:

Terminal
curl -X POST "https://thelastapi.dev/v1/projects/prj_123/social/connect" \
  -H "Authorization: Bearer $VIBIZ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"platform":"instagram"}'

The response contains the one-hour authorization link. Once the owner completes the authorization in their browser, the account is attached to the project.

Testing in the development sandbox

You do not need to publish to real followers to verify your code. Passing --dev or ?env=development creates a test account immediately without an external authorization redirect:

Terminal
vibiz social connect instagram --dev
vibiz social connect tiktok --dev
vibiz social connect linkedin --dev

In the development sandbox, posts execute their full lifecycle inside thelastapi without publishing anything externally.

To view your connected accounts and retrieve their IDs (sacc_...), run:

Terminal
vibiz social accounts

Format media and text across platforms

Each network enforces different text limits and media requirements. When you send a single post payload to multiple targets, the payload must meet the constraints of every platform targeted, or specify target options where they diverge.

PlatformText limitMedia requirementsSpecial target options
Instagram2,200 charsRequired (up to 10 images or videos)content_type (feed, reel, story), first_comment
TikTok2,200 charsRequired (video or up to 35 photos)privacy (public, friends, followers, private)
LinkedIn3,000 charsOptional (up to 9 images)None

Across all platforms on a single post, you can target up to 20 accounts and attach up to 35 total media files. You can also schedule social media posts with an API by setting schedule_at to an ISO timestamp at least one minute in the future.

Uploading media files

Because Instagram and TikTok require media assets, you must provide public https URLs for your images or videos. If your assets are stored locally, upload them directly with POST /v1/projects/:id/social/media:

Terminal
curl -X POST "https://thelastapi.dev/v1/projects/prj_123/social/media?filename=announcement.jpg" \
  -H "Authorization: Bearer $VIBIZ_API_KEY" \
  -H "Content-Type: image/jpeg" \
  --data-binary @announcement.jpg

This endpoint accepts raw file bytes up to 512 MB. It returns an object containing a hosted url, which you can insert directly into your post targets. Alternatively, you can pass a local file path directly into the CLI with --media announcement.jpg.

Send the multi-platform post

Once you have your media URL and account IDs, dispatch the post across all three networks.

Using the CLI

Terminal
vibiz social post "Excited to launch our new desktop app! Link in bio to try it today." \
  --to sacc_insta_123,sacc_tiktok_456,sacc_linkedin_789 \
  --media https://example.com/announcement.jpg \
  --opt first_comment="#software #launch" \
  --opt privacy=public

Using the REST API

When calling the API as an owner, include "confirm": true to publish immediately to production:

Terminal
curl -X POST "https://thelastapi.dev/v1/projects/prj_123/social/posts?env=production" \
  -H "Authorization: Bearer $VIBIZ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Excited to launch our new desktop app! Link in bio to try it today.",
    "media": [
      { "url": "https://example.com/announcement.jpg" }
    ],
    "targets": [
      {
        "account_id": "sacc_insta_123",
        "options": {
          "content_type": "feed",
          "first_comment": "#software #launch"
        }
      },
      {
        "account_id": "sacc_tiktok_456",
        "options": {
          "privacy": "public"
        }
      },
      {
        "account_id": "sacc_linkedin_789"
      }
    ],
    "confirm": true
  }'

If any platform-specific validation fails (for example, if a headline exceeds length limits or required media is missing), the API returns an HTTP 400 error pinpointing the exact field path, such as targets.0.options.content_type, allowing your application to fix all issues at once.

Approvals and agent safety

If you run publishing scripts via automated agents or using an API key with Limited access, thelastapi prevents accidental live posts through an approval queue.

When a Limited access key or agent submits a production post, the post does not publish immediately. Instead, the API returns a record with status: "pending_approval". The payload includes a console_url where the account owner can review the draft copy and media.

The owner can inspect and approve the post directly from the CLI:

Terminal
# Check posts waiting for action
vibiz social posts --status pending_approval

# Approve the post for immediate publication
vibiz social approve pst_123

# Or reject it
vibiz social reject pst_123

Once approved, the system dispatches the content to Instagram, TikTok, and LinkedIn. Nothing depends on the originating agent returning to trigger the run.

Follow post statuses and errors

Because you are dispatching to three different networks simultaneously, individual platforms can encounter transient rate limits or processing delays. Each post progresses through distinct statuses:

  • draft: Saved without scheduling or publishing.
  • pending_approval: Waiting for an owner's confirmation.
  • scheduled: Queued for a future schedule_at timestamp.
  • publishing: Payload dispatched to social network APIs.
  • published: Successfully accepted by all targeted networks.
  • partial: Succeeded on some accounts but failed on others. Check targets[].error for the exact reason per network.
  • failed: All targets failed.
  • cancelled: Aborted before publishing.

To inspect recent posts and identify partial failures:

Terminal
vibiz social posts --json

Once your posts are live, you can read social post analytics with an API to monitor reach, impressions, likes, comments, and shares across all three accounts from a single endpoint. If your business also relies on direct customer calls or automated voice workflows alongside social campaigns, you can give an AI agent a phone number using the same unified account.

Review the Social guide and the complete Social documentation to see available platform options, advertising endpoints, and webhook events.

Frequently asked questions

How much does it cost to post to multiple social accounts?

Social posting is counted on your usage as `social.post` per account a post goes out on, and it is priced at $0 today. Any advertising spend you create is billed directly by the platform to your own ad account.

Can I post different text to Instagram, TikTok, and LinkedIn in one request?

No, the base `text` field is shared across all targeted platforms in a single request. If you need fundamentally different copy for each network, issue separate requests targeting each specific `account_id`.

What happens if a post fails on TikTok but succeeds on LinkedIn and Instagram?

The post object receives a status of `partial`. The response includes an array of `targets`, where the TikTok target contains an `error` field detailing the failure while the other targets show successful publishing.

Can an AI agent publish directly to live social accounts without human approval?

Only an owner key with `confirm: true` can publish directly to production accounts. Requests created by Limited access keys or automated agents are held in `pending_approval` until an owner approves them in the console or CLI.