BlogFlux API Overview
The BlogFlux API allows you to integrate AI content generation into your applications, automate workflows, and build custom integrations.
Prerequisites
- Active BlogFlux subscription (any plan)
- API key (generated in your dashboard)
- Basic understanding of REST APIs and HTTP requests
Step 1: Generate Your API Key
- Log into your BlogFlux account
- Navigate to Dashboard → API Keys
- Click "Generate New API Key"
- Give it a descriptive name (e.g., "Production App")
- Click "Create"
- Important: Copy the key immediately - it's only shown once!
🔒 Keep Your API Key Secure
- Never commit API keys to version control (Git)
- Store in environment variables, not in code
- Rotate keys regularly
- Revoke compromised keys immediately
Step 2: Authentication
All API requests require authentication using Bearer token in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Step 3: Your First API Request
Get Your User Information
Request:
curl -X GET https://blogflux.ai/api/v1/user \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
Response:
{
"status": "success",
"data": {
"id": 123,
"name": "John Doe",
"email": "john@example.com",
"plan": "pro",
"posts_remaining": 45,
"images_remaining": 280,
"billing_cycle_end": "2025-12-15T00:00:00Z"
}
}
Step 4: Generate Your First Post
Basic Post Generation
Request:
curl -X POST https://blogflux.ai/api/v1/posts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"topic": "Benefits of AI in Content Marketing",
"keywords": ["AI", "content marketing", "automation"],
"word_count": 1500,
"ai_model": "gpt_5_mini"
}'
Response:
{
"status": "success",
"data": {
"id": 456,
"title": "10 Benefits of AI in Content Marketing",
"content": "<p>Content here...</p>",
"meta_description": "Discover how AI transforms...",
"slug": "benefits-ai-content-marketing",
"seo_score": 87,
"word_count": 1547,
"created_at": "2025-11-06T10:30:00Z"
}
}
Available AI Models
Pass one of these values in the ai_model parameter:
gpt_5- GPT-5 (premium)gpt_5_mini- GPT-5 Mini (recommended)gpt_5_nano- GPT-5 Nano (fast)gpt_4_1_mini- GPT-4.1 Minigpt_4o_mini- GPT-4o Miniclaude_sonnet_4_5- Claude Sonnet 4.5claude_opus_4_1- Claude Opus 4.1claude_haiku_4_5- Claude Haiku 4.5claude_3_7_sonnet- Claude 3.7 Sonnetclaude_3_haiku- Claude 3 Haiku
Advanced: Auto-Publish to WordPress
Request:
curl -X POST https://blogflux.ai/api/v1/posts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"topic": "SEO Best Practices 2025",
"keywords": ["SEO", "optimization", "ranking"],
"word_count": 2000,
"ai_model": "gpt_5_mini",
"images_count": 3,
"blog_connection_id": 789,
"auto_publish": true,
"custom_instructions": "Write in a professional, data-driven tone. Include statistics and examples."
}'
Common API Endpoints
Posts Management
GET /api/v1/posts- List all postsPOST /api/v1/posts- Generate new postGET /api/v1/posts/:id- Get specific postPUT /api/v1/posts/:id- Update postDELETE /api/v1/posts/:id- Delete postPOST /api/v1/posts/:id/publish- Publish to WordPress/webhook
Blog Connections
GET /api/v1/blog_connections- List connectionsPOST /api/v1/blog_connections- Create connectionPOST /api/v1/blog_connections/:id/test- Test connection
Error Handling
HTTP Status Codes
- 200 OK: Success
- 201 Created: Resource created
- 400 Bad Request: Invalid parameters
- 401 Unauthorized: Invalid or missing API key
- 403 Forbidden: Monthly limit reached
- 404 Not Found: Resource doesn't exist
- 422 Unprocessable Content: Validation errors
- 429 Too Many Requests: Rate limit exceeded
- 500 Internal Server Error: Server error
Error Response Format
{
"status": "error",
"message": "Monthly post limit reached",
"errors": [
{
"field": "limit",
"message": "You have reached your monthly limit of 15 posts"
}
]
}
Rate Limits
- Requests per minute: 60
- Concurrent generations: 3
- Monthly posts: Based on your plan (15/65/250)
Best Practices
Security
- Store API keys in environment variables:
process.env.BLOGFLUX_API_KEY - Never expose keys in client-side code
- Use separate keys for development and production
- Rotate keys every 90 days
Optimization
- Cache user data - don't fetch on every request
- Use webhooks for async workflows instead of polling
- Implement exponential backoff for retries
- Monitor your usage to avoid hitting limits
Error Handling
try {
const response = await fetch('https://blogflux.ai/api/v1/posts', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.BLOGFLUX_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ topic, keywords, word_count: 1500 })
})
if (!response.ok) {
const error = await response.json()
throw new Error(error.message)
}
const data = await response.json()
return data
} catch (error) {
console.error('BlogFlux API Error:', error.message)
// Handle error appropriately
}
Code Examples
Python
import requests
api_key = "YOUR_API_KEY"
url = "https://blogflux.ai/api/v1/posts"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
data = {
"topic": "AI in Healthcare",
"keywords": ["AI", "healthcare", "medical"],
"word_count": 1500,
"ai_model": "gpt_5_mini"
}
response = requests.post(url, headers=headers, json=data)
post = response.json()
print(f"Generated post: {post['data']['title']}")
JavaScript/Node.js
const fetch = require('node-fetch')
const apiKey = process.env.BLOGFLUX_API_KEY
const url = 'https://blogflux.ai/api/v1/posts'
const data = {
topic: 'Future of Remote Work',
keywords: ['remote work', 'productivity', 'collaboration'],
word_count: 1500,
ai_model: 'gpt_5_mini'
}
const response = await fetch(url, {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
const post = await response.json()
console.log(`Generated: ${post.data.title}`)