LinkedIn's algorithm rewards consistent, high-quality posts. But writing LinkedIn content is time-consuming. The format demands longer, more thoughtful posts than X or Instagram. This guide shows you how to generate LinkedIn posts programmatically using a REST API.
Why LinkedIn is different
LinkedIn posts have unique characteristics that AI needs to understand:
- Character limit: 3,000 - much longer than X's 280
- The fold matters. Only ~210 characters show before "See more." The hook must be in that window.
- Formatting drives engagement. Line breaks, bullet points, and short paragraphs perform best.
- Professional but personal. The best LinkedIn content tells stories with professional lessons.
- Hashtags at the bottom. 3-5 hashtags, not inline.
A generic AI prompt won't account for these rules. A purpose-built content API will.
Authentication
All requests require a Bearer token. Get your API key from the SupaPost dashboard after signup:
Authorization: Bearer sp_your_api_key_here
Generate a LinkedIn post
Use the unified content generation endpoint with platform: "linkedin":
curl -X POST https://api.supapost.ai/api/v1/content/generate \
-H "Authorization: Bearer sp_your_key" \
-H "Content-Type: application/json" \
-d '{
"type": "social",
"platform": "linkedin",
"topic": "Why most startups fail at content marketing"
}'
Response format
{
"type": "social",
"platform": "linkedin",
"content": "Most startups treat content as an afterthought.\n\nThey hire one writer, give them zero context, and expect viral posts.\n\nHere's what actually works:\n\n1. Define your voice BEFORE you write anything...\n\n#ContentMarketing #Startups #Growth",
"variations": [
"I've seen 50+ startups fail at content marketing...",
"Hot take: Your content strategy is failing because..."
],
"hashtags": ["ContentMarketing", "Startups", "Growth"]
}
The response includes the primary post (formatted for LinkedIn with line breaks and hashtags at the bottom), 2 alternative variations, and extracted hashtags.
Brand context matters
The quality of generated content depends on your workspace settings. Before making API calls, ensure your workspace has:
- Brand voice set (professional, bold, educational, etc.)
- Industry configured (SaaS, Finance, Healthcare, etc.)
- Target audience defined (startup founders, marketing managers, etc.)
- Content pillars listed (product updates, industry insights, etc.)
The fastest way: enter your website URL during onboarding. The AI auto-detects all of these settings.
Batch generation for the week
Use the strategy endpoint to plan a full week of LinkedIn content:
curl -X POST https://api.supapost.ai/api/v1/strategy/generate \
-H "Authorization: Bearer sp_your_key" \
-H "Content-Type: application/json" \
-d '{
"topic": "B2B SaaS growth strategies",
"platforms": ["linkedin"]
}'
This returns a strategy with multiple content pieces, each with suggested posting times optimized for LinkedIn engagement.
Best practices
- Generate variations. The API returns 2-3 per request. A/B test them.
- Edit the hook. AI generates good hooks, but your personal touch makes them great.
- Post at optimal times. Tuesday-Thursday, 8-10am in your audience's timezone.
- Use the repurpose endpoint. Turn your best LinkedIn posts into X threads, blog intros, or newsletter sections.
- Track what works. Use the usage API to monitor generation volume and adjust your content pillars based on performance.
LinkedIn rewards consistency more than virality. With API-powered generation, posting daily becomes sustainable instead of exhausting.