How to Use Blotato with Claude Code to Automate Social Media Posting
Connect Blotato's API to Claude Code to automatically generate, review, and schedule social media posts across LinkedIn, Instagram, and X from one workflow.
Stop Posting Manually to Five Different Platforms
Social media management eats time in a predictable way. Someone writes a post, reformats it for LinkedIn, shortens it for X, adds hashtags for Instagram, reviews each version, logs into each platform, and hits publish. Then does it again the next day.
That’s not strategy — it’s busywork. And it’s exactly the kind of task that Claude Code, paired with Blotato’s API, can handle on its own.
This guide walks through connecting Blotato to Claude Code to build a repeatable workflow that generates platform-specific posts, applies your review step, and schedules everything automatically. By the end, you’ll have a system that turns a topic or content brief into a full week of scheduled posts across LinkedIn, Instagram, and X — with minimal manual effort.
What Blotato Does and Why Its API Matters
Blotato is a social media scheduling platform built for creators and marketers who manage multiple channels. You connect your accounts — LinkedIn, Instagram, X, Facebook, TikTok, and others — and publish or schedule content from a single dashboard.
What makes Blotato useful for automation is its REST API. Instead of logging in and clicking buttons, you can programmatically create posts, attach media, set schedules, and manage drafts through HTTP requests. This means any tool or script that can make API calls can control Blotato.
The API uses standard Bearer token authentication. Your requests include a JSON payload specifying the post content, target platforms, optional media URLs, and a scheduled publish time. Blotato handles the platform-specific delivery from there.
You can find Blotato’s full API reference in their developer documentation, including endpoint details, rate limits, and available fields for each platform.
What Claude Code Adds to This Setup
Claude Code is Anthropic’s terminal-based coding agent. You open it in your project directory, describe a task in plain language, and it writes code, executes it, reads output, handles errors, and iterates — all without leaving the terminal.
What makes it particularly well-suited for this use case is that Claude (the model powering it) is both the content generator and the executor. When you ask it to “write a LinkedIn post about our Q3 product launch,” it understands tone, audience, and format. When you ask it to “call the Blotato API and schedule this for Tuesday at 9am,” it writes the request and runs it.
You’re not stitching together separate tools for generation and posting. One agent does both.
Claude Code also handles the messy parts of API work: it reads error responses, adjusts payloads, retries failed requests, and updates scripts when things break. That matters when you’re scheduling content across multiple platforms with different character limits and media requirements.
Before You Start: Prerequisites
You’ll need a few things in place before building this workflow.
Accounts and API access:
- A Blotato account with at least one social media profile connected
- Your Blotato API key (found in Settings → API or Developer Settings)
- Claude Code installed and authenticated on your machine
Local environment:
- Python 3.8+ installed
requestslibrary (pip install requests)- A
.envfile for storing credentials securely
Optional but recommended:
- A content brief or spreadsheet with topics, themes, or raw copy you want to turn into posts
- A shared folder or Notion doc to track scheduled content
Once you have your Blotato API key, store it immediately in a .env file rather than pasting it directly into scripts.
BLOTATO_API_KEY=your_key_here
Step 1: Authenticate and Test the Blotato Connection
Open Claude Code in your project directory and start by confirming your API key works. This prevents debugging authentication issues later when you’re trying to test content generation.
Ask Claude Code to write a simple test script:
“Write a Python script that authenticates with the Blotato API and returns a list of my connected social accounts. Use the BLOTATO_API_KEY from my .env file.”
Claude Code will generate something like this:
import os
import requests
from dotenv import load_dotenv
load_dotenv()
API_KEY = os.getenv("BLOTATO_API_KEY")
BASE_URL = "https://api.blotato.com/v1"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.get(f"{BASE_URL}/accounts", headers=headers)
if response.status_code == 200:
accounts = response.json()
print("Connected accounts:")
for account in accounts.get("data", []):
print(f" - {account['platform']}: {account['username']}")
else:
print(f"Error {response.status_code}: {response.text}")
Run it. If you see your connected accounts, you’re authenticated and ready to move forward.
If you get a 401 error, double-check that the API key is loaded correctly and matches what’s in your Blotato dashboard.
Step 2: Generate Platform-Specific Content
The core value of this workflow is having Claude generate posts that are already optimized for each platform — not one generic post copy-pasted everywhere.
LinkedIn posts perform best at 150–300 words, with a professional tone and paragraph breaks. X posts need to fit within 280 characters. Instagram posts are more visual-first, with caption text supporting an image rather than carrying the full message.
Tell Claude Code what you’re working with:
“I need posts for LinkedIn, X, and Instagram based on this topic: [your topic or brief]. Write separate versions for each platform, appropriate in length and tone. Return the results as a Python dictionary with platform names as keys.”
Claude Code will draft the content and structure it so the next step — posting via Blotato — can loop through each platform automatically.
Using a Content Brief as Input
For higher-volume workflows, you don’t want to type a new prompt every time. Instead, store your weekly content briefs in a CSV or JSON file:
[
{
"topic": "New feature release: AI-powered reporting",
"tone": "professional",
"include_cta": true,
"schedule": "2025-06-09T09:00:00Z"
},
{
"topic": "Customer success story - 40% time saved",
"tone": "conversational",
"include_cta": false,
"schedule": "2025-06-11T14:00:00Z"
}
]
Ask Claude Code to read the file and generate a full batch:
“Read content_briefs.json, generate LinkedIn, X, and Instagram versions for each entry, and store the results in a new file called generated_posts.json.”
This separates content generation from scheduling, which gives you a natural review checkpoint.
Step 3: Review Before Posting
Automation without a review step creates problems at scale. One off-brand post or poorly timed response to a news event can undermine months of content work.
The simplest review step is a human-in-the-loop pause. After generating posts to a file, set a rule for yourself: review the file before running the scheduler. This takes five minutes instead of thirty.
For teams, you can add a more formal step. Ask Claude Code to:
- Flag any post over a certain character count for the wrong platform
- Check for placeholder text (brackets, “INSERT X HERE”) that wasn’t filled in
- Verify each post has a clear call to action if the brief requires one
You can even have Claude Code open the generated file in your editor before asking for confirmation to proceed:
“After generating posts, open generated_posts.json for review. Ask me to type ‘approve’ before running the scheduler.”
This keeps you in control without turning every step into manual work.
Step 4: Schedule Posts Through Blotato’s API
Once posts are reviewed, Claude Code handles the scheduling. It reads your generated posts file and calls Blotato’s post creation endpoint for each entry.
Ask Claude Code to build the scheduler:
“Write a Python script called schedule_posts.py that reads generated_posts.json and uses the Blotato API to schedule each post to the correct platforms at the specified times.”
The script will look roughly like this:
import os
import json
import requests
from dotenv import load_dotenv
load_dotenv()
API_KEY = os.getenv("BLOTATO_API_KEY")
BASE_URL = "https://api.blotato.com/v1"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
PLATFORM_MAP = {
"linkedin": "linkedin",
"twitter": "twitter",
"instagram": "instagram"
}
with open("generated_posts.json", "r") as f:
posts = json.load(f)
for entry in posts:
for platform, content in entry["posts"].items():
payload = {
"text": content,
"platforms": [PLATFORM_MAP[platform]],
"scheduledAt": entry["schedule"]
}
response = requests.post(
f"{BASE_URL}/posts",
headers=headers,
json=payload
)
if response.status_code in (200, 201):
print(f"Scheduled {platform} post for {entry['schedule']}")
else:
print(f"Failed for {platform}: {response.status_code} - {response.text}")
Claude Code will run this script, show you the output, and flag any failures. If a post fails — say, Instagram requires a media attachment you didn’t include — Claude Code can identify the error and suggest a fix.
Handling Media Attachments
Some platforms, especially Instagram, require an image with every post. If your workflow needs to include images, you have a couple of options:
- Store image URLs in your content brief JSON and pass them in the
mediaUrlsfield of the Blotato payload - Use a separate image generation step (more on this below) before calling the scheduler
For text-only platforms like LinkedIn and X, this isn’t a requirement — but including images does improve engagement.
Step 5: Run the Full Pipeline
Once each piece works individually, combine them into a single end-to-end command. Ask Claude Code to:
“Create a script called run_social_pipeline.py that reads content_briefs.json, generates platform-specific posts using Claude’s API, saves them to generated_posts.json, asks for my approval, then schedules everything via Blotato if I approve.”
This single script handles the full workflow:
- Read briefs
- Generate posts
- Review checkpoint
- Schedule via API
You can run this manually once a week, or set it on a cron schedule if your content briefs are pre-populated automatically.
# Add to crontab to run every Monday at 8am
0 8 * * 1 cd /your/project && python run_social_pipeline.py
For fully automated runs without a manual review step, remove the approval prompt and let it run end-to-end. Just make sure your content briefs are good before trusting this.
Common Issues and How to Fix Them
Posts fail with a 422 error
This usually means a required field is missing or a value is in the wrong format. Check:
- That
scheduledAtis in ISO 8601 format with timezone (Zor+00:00) - That platform names match Blotato’s expected values exactly (check their API docs)
- That character limits aren’t exceeded for X posts
Ask Claude Code to validate your payload structure before sending: “Check each post payload against Blotato’s required fields before calling the API.”
Instagram posts are rejected
Instagram through third-party APIs typically requires an image. If you’re getting 400 errors on Instagram specifically, confirm whether your Blotato plan supports Instagram publishing and whether the endpoint requires a media attachment.
Generated content sounds generic
Claude’s output quality depends heavily on the prompt. If posts feel flat, improve the brief. Include:
- Brand voice notes (“We use casual, direct language — no corporate speak”)
- Audience context (“Our audience is mid-market SaaS ops teams”)
- Examples of past posts that performed well
Tell Claude Code to use these examples as reference material when generating new posts.
API rate limits
Blotato’s API has rate limits. If you’re scheduling a large batch, add a small delay between requests:
import time
time.sleep(0.5) # half second between requests
Where MindStudio Fits for Teams
The Claude Code approach above works well if you’re comfortable in a terminal and want to own the code. But if you’re building this for a team — or want to hand it off to someone who doesn’t use the command line — there’s a cleaner path.
MindStudio is a no-code platform for building AI-powered automation workflows. You can build the same pipeline described in this article — content brief input, AI generation, Blotato API scheduling — using a visual builder, without writing scripts.
What makes it relevant here specifically is MindStudio’s Agent Skills Plugin, an npm SDK that lets agents like Claude Code call MindStudio’s 120+ typed capabilities as simple method calls. This means you can build the content generation and media creation logic inside MindStudio (where non-technical teammates can edit it), and have Claude Code invoke it as a single method call.
For teams that also want AI image generation to pair with their social posts, MindStudio’s AI Media Workbench includes access to all major image models — Flux, Stable Diffusion, and others — in one place, no separate API keys needed. You can chain image generation directly into your social scheduling workflow.
MindStudio supports webhook and API endpoint agents, so a Claude Code script can trigger a MindStudio workflow the same way it calls any REST API. The non-technical parts (editing prompts, adjusting platform tone, approving content) live in MindStudio’s visual interface. The code parts stay in code.
You can try MindStudio free at mindstudio.ai.
Frequently Asked Questions
Does Blotato’s API support all major social platforms?
Blotato supports LinkedIn, X (Twitter), Instagram, Facebook, TikTok, Pinterest, and others depending on your plan. API access for some platforms — particularly Instagram — may require a business account connected through an approved integration. Check Blotato’s API documentation for the current list of supported platforms and any account-level requirements per channel.
Do I need a separate Claude API key to use Claude Code?
Claude Code uses your Anthropic account for authentication. If you’re using Claude Code for content generation within a script, you’ll call the Anthropic Messages API separately, which requires an API key from your Anthropic console. This is distinct from your Claude Code session — Claude Code handles terminal tasks while the API handles text generation within your scripts.
Can I schedule image posts, not just text?
Yes, if you include a mediaUrls field in your Blotato API payload. The image must be hosted at a publicly accessible URL. For AI-generated images, you can generate them first (using a model like FLUX or DALL-E), upload them to a storage service, and pass the resulting URL to Blotato. MindStudio’s AI Media Workbench can handle this generation step if you want it in one workflow.
Is this approach safe for production use?
It’s production-ready with a few safeguards: store all API keys in environment variables (never hardcoded), implement error handling for each API call, log all scheduled posts to a file for auditing, and keep a manual review step for anything time-sensitive or reactive to current events. The workflow is as reliable as the platforms it calls — Blotato and Anthropic both have solid uptime, but network failures happen and retries should be handled.
How do I handle different character limits per platform?
The cleanest approach is to generate platform-specific versions from the start, with explicit instructions in your prompt about length. For X, specify a 280-character maximum. For LinkedIn, aim for 150–300 words for engagement. For Instagram, the caption is secondary to the visual, so shorter is generally better. You can also add a validation step that checks character counts before calling the API and asks Claude Code to shorten anything that exceeds limits.
Can I use this workflow for repurposing existing content?
Absolutely — this is one of the most efficient use cases. Feed Claude Code a blog post, transcript, or long-form piece of content, and ask it to extract key points and generate platform-specific posts from each section. A 2,000-word article can yield 10–15 social posts with a single prompt, all scheduled through Blotato across a two-week window.
Key Takeaways
- Blotato’s REST API lets you create, schedule, and manage posts programmatically across LinkedIn, Instagram, X, and more.
- Claude Code handles both content generation and API execution — you don’t need separate tools for writing and posting.
- Storing content briefs as JSON files separates ideation from execution and creates a natural review checkpoint.
- A human-in-the-loop approval step before scheduling adds accountability without significantly slowing down the workflow.
- For teams who want the same automation without terminal-based scripting, MindStudio can replicate this pipeline in a visual no-code builder with webhook-based triggers.
The full workflow — brief input to scheduled post — takes about 20 minutes to set up and seconds to run after that. Most of the work is front-loading your content strategy into briefs. The execution takes care of itself.
If you want to extend this workflow with AI image generation, multi-step content review, or team-level access controls, MindStudio is worth exploring as a complement or alternative to the scripted approach.