Foxli
Log inStart free
Product Updates

Social Media Scheduling API: Schedule Posts From Code

Automate publishing across 7 platforms with the Foxli social media scheduling API. Discover REST endpoints, queue automation, and signed webhooks.

Pushpendra Singh Rathor
Pushpendra Singh Rathor
Founder & Product Lead, Foxli · Updated 12 Nov 2026 · 11 min read
Share
Social Media Scheduling API: Schedule Posts From Code

If you want to schedule and publish social content directly from your code, you need a social media scheduling api that handles authentication, media uploads, and delivery across every network. I built Foxli because wiring up seven different social network APIs yourself is painful, expensive, and breaks whenever a platform changes its rules. Instead of managing seven sets of OAuth credentials, dealing with random rate limits, and debugging failed image uploads, you can send one clean JSON request to a single endpoint. Foxli takes care of the token refreshes, media transcoding, and delivery checks for Instagram, YouTube, LinkedIn, Threads, X, Facebook, and Pinterest.

When you run an app, a newsletter, or an agency, you want to automate social posts without babysitting each platform. You might want to publish an update whenever you ship a new blog post, announce product milestones from your database, or let your marketing team queue up content from an internal dashboard. A clean API turns these complex tasks into a simple HTTP call.

Why I Built a Social Media Scheduling API for Developers

Direct integrations with social networks sound straightforward until you actually build them. Every platform has its own developer portal, app review process, token renewal rules, and media requirements.

When I started testing multi-platform publishing for my own projects here in India, I ran into three big roadblocks:

First, app verification takes weeks. Meta requires business verification, privacy policy audits, and screencasts just to publish a photo to Instagram. LinkedIn needs separate OAuth scopes and short-lived tokens. X charges heavy monthly fees for basic write access. Keeping seven different OAuth tokens alive in a database with proper locking and retry logic takes hundreds of lines of boilerplate code.

Second, media formatting is messy. An image that looks great on an Instagram square feed gets cropped awkwardly on X. Pinterest rejects images that do not match its preferred vertical aspect ratio. Video is even harder: YouTube requires resumable chunked uploads, while Instagram Reels require polling a container status until transcoding finishes. If your script times out before the video is ready, the upload fails silently.

Third, API maintenance never stops. Platforms change endpoints, deprecate versions, and throttle requests without much warning. When you use Foxli through our Foxli Developers Portal, you talk to one stable REST endpoint. Foxli handles the platform quirks behind the scenes so your application logic stays clean.

Foxli API Architecture and Core Endpoints

The Foxli API uses standard REST conventions over HTTPS at https://api.foxli.app/v1. You authenticate with Bearer tokens (fx_live_... or fx_test_...), send JSON payloads, and receive standard HTTP status codes.

The API is organized around five main resources:

Workspaces (/v1/workspaces): Check which workspaces your API key can access. If you manage multiple brands or clients, you can switch context by passing the Foxli-Workspace: ws_... header.

Channels (/v1/channels): List all connected social accounts, inspect profile names, verify publishing permissions, and check token health.

Posts (/v1/posts): Create drafts, queue updates, schedule future posts, or publish immediately across multiple networks.

Media (/v1/media): Upload images or videos directly, or provide a public URL so Foxli can fetch and process the asset on our servers.

Webhooks (/v1/webhooks): Register HTTPS endpoints to receive real-time notifications when posts go live or fail.

Here is how you list your connected accounts using curl:

curl -s -X GET https://api.foxli.app/v1/channels \
  -H "Authorization: Bearer fx_live_your_api_key_here" \
  -H "Foxli-Workspace: ws_prod_marketing"

How to Schedule Posts Across Multiple Channels

The /v1/posts endpoint gives you complete control over how and when your content goes live. When you make a POST request, you set a mode field to choose the delivery method:

  • draft: Saves the post in your Foxli dashboard so a team member can review the copy, swap images, or approve it manually.
  • queue: Puts the post into your workspace queue. Foxli assigns it to the next available posting slot, matching the schedule you configured in our visual Instagram scheduler and LinkedIn scheduler.
  • schedule: Requires an ISO-8601 UTC timestamp in scheduled_at (such as 2026-11-20T14:30:00Z). For example, if you want to reach an Indian audience at 8:00 PM IST, you set the UTC time to 14:30:00Z.
  • now: Sends the post immediately. Publishing across all selected networks usually finishes within two minutes.

Customizing Content for Each Platform

Every social network has its own style and character limit. A tweet on X cannot exceed 280 characters, but LinkedIn lets you write up to 3,000 characters with line breaks. Instagram posts need clean captions and relevant hashtags. Foxli lets you define a base message and override it for specific channels in a single request.

{
  "mode": "schedule",
  "scheduled_at": "2026-11-25T09:00:00Z",
  "channel_ids": ["ch_ig_4910", "ch_li_8821", "ch_tw_3310"],
  "content": "Our new product update is live. Read the full story on our blog!",
  "media_urls": ["https://cdn.example.com/assets/case-study-hero.png"],
  "overrides": {
    "ch_tw_3310": {
      "content": "Our new product update is live: https://example.com/story"
    },
    "ch_li_8821": {
      "content": "Scaling product operations requires constant iteration. Here is what we learned building our latest release.\n\nKey takeaways:\n1. Keep APIs simple\n2. Automate delivery checks\n3. Listen to user feedback\n\nFull post: https://example.com/story"
    }
  }
}

This approach saves you from sending three separate API calls while making sure your post fits each platform naturally.

Safe Idempotency and Deduplication

When you run background jobs or queue workers, network glitches happen. A server might drop a connection before receiving an HTTP response, leading your worker to retry the request. Without safeguards, retrying a publish request can post the exact same update twice to your followers.

Foxli prevents duplicate posts using the standard Idempotency-Key HTTP header. You can pass any unique string, such as a database UUID or job ID (Idempotency-Key: post_release_4812).

When Foxli receives a request with an idempotency key, it caches the response for 24 hours. If your script retries the request with that same key, Foxli returns the cached response without creating a duplicate post on your social accounts.

curl -X POST https://api.foxli.app/v1/posts \
  -H "Authorization: Bearer fx_live_your_api_key_here" \
  -H "Foxli-Workspace: ws_growth_lab" \
  -H "Idempotency-Key: drop-event-sku-88102" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "queue",
    "channel_ids": ["ch_ig_4910", "ch_threads_2011"],
    "content": "Our new product collection is live. Check out the latest designs on our store."
  }'

Real-Time Delivery With Signed Webhooks

Constantly polling an API to check if a scheduled post succeeded burns your request quota and slows down your servers. Instead, you can use Foxli Webhook Documentation to receive instant notifications the moment a post is published or if an error occurs.

Foxli supports four main webhook events:

The post.published event fires when every selected channel confirms successful publication. The payload includes direct URLs to the live posts on Instagram, LinkedIn, or X.

The post.partially_published event fires when some platforms succeed while others fail. For instance, your image might post to LinkedIn without issues while Pinterest rejects it due to invalid dimensions.

The post.failed event fires if the upstream platform rejects the post or your account token expires.

The channel.disconnected event alerts you immediately if a user changes their password or revokes permissions on a platform.

Verifying Webhook Signatures

To ensure incoming webhook requests genuinely come from Foxli and have not been altered, each request includes a Foxli-Signature header. This header contains a timestamp and an HMAC-SHA256 signature generated with your webhook signing secret (whsec_...).

Here is how you can verify signatures in Node.js:

import crypto from 'crypto';

export function verifyFoxliSignature(rawBody, signatureHeader, secret) {
  const parts = Object.fromEntries(
    signatureHeader.split(',').map((item) => item.split('='))
  );

  const timestamp = parts['t'];
  const expectedHash = parts['v1'];

  if (!timestamp || !expectedHash) {
    return false;
  }

  const currentTime = Math.floor(Date.now() / 1000);
  if (Math.abs(currentTime - parseInt(timestamp, 10)) > 300) {
    return false;
  }

  const signaturePayload = `${timestamp}.${rawBody}`;
  const computedHash = crypto
    .createHmac('sha256', secret)
    .update(signaturePayload)
    .digest('hex');

  return crypto.timingSafeEqual(
    Buffer.from(computedHash, 'utf8'),
    Buffer.from(expectedHash, 'utf8')
  );
}

Platforms like the Meta Graph API docs and the X Developer Platform have complicated signature schemas and verification requirements. Foxli gives you a single, unified webhook format across every network.

Complete Node.js Integration Example

Here is a practical TypeScript script using native fetch in Node.js 18+ to schedule an update across multiple networks:

interface PostScheduleResponse {
  id: string;
  status: 'draft' | 'queued' | 'scheduled' | 'publishing';
  scheduled_at?: string;
  channels: Array<{ channel_id: string; status: string }>;
}

async function scheduleSocialUpdate(): Promise<void> {
  const apiKey = process.env.FOXLI_API_KEY!;
  const workspaceId = process.env.FOXLI_WORKSPACE_ID!;

  const payload = {
    mode: 'schedule',
    scheduled_at: '2026-11-28T10:00:00Z',
    channel_ids: ['ch_linkedin_corp', 'ch_x_corp'],
    content: 'We just published our roadmap update. Take a look at what we are building next!',
    media_urls: ['https://assets.foxli.app/announcements/q4-roadmap.png'],
  };

  const response = await fetch('https://api.foxli.app/v1/posts', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${apiKey}`,
      'Foxli-Workspace': workspaceId,
      'Idempotency-Key': `community-q4-${Date.now()}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(payload),
  });

  if (!response.ok) {
    const errorBody = await response.json();
    throw new Error(`Failed to schedule post: ${response.status} ${JSON.stringify(errorBody)}`);
  }

  const data = (await response.json()) as PostScheduleResponse;
  console.log(`Successfully scheduled post ${data.id} for ${data.scheduled_at}`);
}

scheduleSocialUpdate().catch(console.error);

Simple Developer Pricing With No Per-Call Metering

Many social media APIs force you onto expensive enterprise plans or charge extra for every single API call. That kind of pricing makes it hard to predict your monthly software bill, especially when you are just getting started.

At Foxli, our pricing is based simply on the number of connected channels, as shown on our Foxli Pricing page:

The Free tier lets you connect up to 3 social accounts in one workspace. You get manual scheduling and basic comment automation at zero cost.

The Creator plan costs ₹99 per connected channel per month (or $0.99 USD internationally). It includes full API access, unlimited scheduled posts, and 120 requests per minute with no hidden developer fees.

The Team plan costs ₹119 per connected channel per month (or $1.19 USD internationally). It adds team collaboration, post approval workflows, and role-based access for each workspace.

Whether you publish twenty posts a month or two thousand, your cost stays the same.

Direct Native APIs Versus Foxli Scheduling API

Here is an honest look at building directly against social platforms versus using Foxli:

CapabilityDirect Native Social APIsFoxli Scheduling API
Initial Setup Time6 to 10 weeks across 7 developer portalsUnder 15 minutes with single REST schema
Developer App ReviewStrict business verification per platformZero app review needed (Foxli handles OAuth)
Token Refresh LogicCustom per-platform refresh tokens & lockingAutomatic background token rotation
Media TranscodingComplex manual resizing & video chunkingAutomated server-side media processing
Webhook AlertingFragmented webhook schemas and signaturesUnified HMAC-SHA256 signed event stream
Billing & EconomicsPaid platform API tiers, usually billed in USDSimple ₹99 per channel flat pricing

For marketing agencies and software teams, building on top of dedicated solutions for agencies removes repetitive maintenance work so you can focus on building your actual product.

Built for India Developers and Growing Agencies

Most international scheduling tools bill in US dollars and ignore local payment methods. When I built Foxli in India, I made sure local businesses and developers had first-class support:

First, we offer local pricing in Indian Rupees at ₹99 per channel per month. You can pay with UPI, NetBanking, and domestic debit or credit cards through Razorpay. You do not have to worry about international transaction fees or credit card declines.

Second, scheduling aligns naturally with Indian Standard Time (IST). When you want to publish during peak Indian browsing hours, like 8:00 PM to 10:00 PM IST, you simply convert the time to UTC in your API payload.

Third, agencies can create isolated workspaces for different clients. Each workspace keeps social accounts, team members, and posts completely separate, so you never have to worry about cross-posting errors.

Fourth, you can track your post results programmatically. Foxli collects reach, impressions, and engagement data, which you can review through our social media analytics dashboard.

Handling Errors and Rate Limits

When building an automated workflow, your code should handle standard HTTP status codes gracefully:

400 Bad Request indicates that the payload failed schema validation. This usually means a required field like channel_ids is missing, an image URL is unreachable, or text length exceeds platform limits. Check the errors array in the JSON response for details.

401 Unauthorized means your API key is invalid or your connected social account needs reconnection. Make sure your key has the posts:write scope and test your connection with GET /v1/channels.

429 Too Many Requests means your workspace exceeded 120 requests per minute or 10,000 daily calls. Check the Retry-After header and add exponential backoff to your retry queue.

502 Bad Gateway means an upstream social network had a temporary error. Because Foxli supports idempotency keys, you can safely retry the exact request without creating duplicate posts.

Start Scheduling From Your Code Today

Setting up automated publishing does not have to take weeks of engineering time. Connect your social channels in the dashboard, generate an API key from your settings, and make your first request with curl or Node.js. If you want to test the workflow for your own brand, you can get started for free with up to 3 channels on Foxli.

Pushpendra Singh Rathor
Pushpendra Singh Rathor, founder of Foxli. He built it after juggling social accounts for several projects of his own. More from the author

Pick the tool, then start posting.

Try Foxli free for a month. No card needed.

No card for month one · Cancel anytime