REST API for automated blog post management. Accepts JSON, commits markdown files to the GitHub repo, and Vercel auto-deploys.
All endpoints require a Bearer token in the Authorization header:
Authorization: Bearer YOUR_API_SECRET_KEY
| Variable | Description |
|---|---|
GITHUB_TOKEN | Fine-grained GitHub PAT with Contents: read/write scoped to this repo |
GITHUB_REPO_OWNER | GitHub org or username (e.g. youai1) |
GITHUB_REPO_NAME | Repository name |
API_SECRET_KEY | Random 32+ char string for Bearer token auth |
/api/blog — Create a blog postCreates a new markdown file at src/content/blog/{slug}.md and commits it to main.
Request:
{
"slug": "ai-agent-automation-guide",
"title": "The Complete Guide to AI Agent Automation",
"description": "Learn how to build AI agents that automate complex workflows covering tools, platforms, and best practices.",
"publishDate": "2026-02-27",
"content": "## Introduction\n\nAI agents are transforming...",
"author": "MindStudio Team",
"image": "https://i.mscdn.ai/blog-images/ai-agent-automation-guide.png?fm=auto&w=1200&fit=cover",
"tags": ["AI Agents", "Automation"],
"draft": false
}
Response (201):
{
"success": true,
"slug": "ai-agent-automation-guide",
"url": "https://www.mindstudio.ai/blog/ai-agent-automation-guide",
"commitSha": "abc123..."
}
/api/blog/{slug} — Update a blog postUpdates an existing post. Only include the fields you want to change — everything else is preserved.
Request:
{
"title": "Updated Title",
"content": "## Updated content..."
}
Response (200):
{
"success": true,
"slug": "ai-agent-automation-guide",
"url": "https://www.mindstudio.ai/blog/ai-agent-automation-guide",
"commitSha": "def456..."
}
/api/blog/{slug} — Delete a blog postRemoves the markdown file from the repo.
Response (200):
{
"success": true,
"slug": "ai-agent-automation-guide",
"deleted": true,
"commitSha": "ghi789..."
}
| Field | Required (POST) | Type | Notes |
|---|---|---|---|
slug | Yes | string | Lowercase, letters/numbers/hyphens only. Becomes the URL path. |
title | Yes | string | Blog post title |
description | Yes | string | 120-160 characters (SEO meta description) |
publishDate | Yes | string | YYYY-MM-DD format |
content | Yes | string | Markdown body content |
author | No | string | Defaults to "MindStudio Team" |
image | No | string | Must be a https://i.mscdn.ai/ CDN URL |
tags | No | string[] | Defaults to [] |
draft | No | boolean | Defaults to false. Draft posts are excluded from the blog listing. |
| Status | Meaning |
|---|---|
400 | Validation failed — check details array for specific field errors |
401 | Missing Authorization header |
403 | Invalid API key |
404 | Blog post not found (PUT/DELETE) |
409 | Slug already exists (POST) |
500 | GitHub API failure |
Error body format:
{
"error": "Validation failed",
"details": [
{ "field": "description", "message": "Must be 120-160 characters for SEO (got 45)." }
]
}
src/content/blog/{slug}.md on main via the GitHub APIhttps://www.mindstudio.ai/blog/{slug}curl -X POST https://www.mindstudio.ai/api/blog \
-H "Authorization: Bearer YOUR_API_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"slug": "test-post",
"title": "Test Post",
"description": "This is a test blog post created via the publishing API to verify the endpoint works correctly and all is well.",
"publishDate": "2026-02-27",
"content": "## Hello\n\nThis is a test post.",
"tags": ["Test"]
}'