Skip to main content
POST
/
blog
/
generate
Generate Blog Meta Elements
curl --request POST \
  --url https://api.example.com/blog/generate \
  --header 'Content-Type: application/json' \
  --data '
{
  "title": "<string>",
  "api_key": "<string>",
  "content": "<string>",
  "image_style": "<string>",
  "language": "<string>",
  "source": "<string>"
}
'
{
  "images": [
    {}
  ],
  "images[].url": "<string>",
  "images[].style": "<string>",
  "images[].description": "<string>",
  "excerpt": "<string>",
  "category": "<string>",
  "tags": [
    "<string>"
  ],
  "generated_at": "<string>",
  "error": "<string>",
  "message": "<string>"
}

Overview

Generate complete blog post metadata including images, excerpt, category, and tags using AI. This endpoint uses advanced AI models to create professional blog metadata.

Request Body

title
string
required
The title of your blog post. This is used to generate all elements.
api_key
string
required
Your GistMag API key
content
string
Optional blog post content. Providing content helps generate more accurate and relevant results.
image_style
string
default:"realistic"
The style of images to generate. Options:
  • realistic: Photorealistic images
  • illustration: Artistic illustrations
  • abstract: Abstract designs
  • minimalist: Simple, clean designs
  • photographic: High-quality photographs
language
string
default:"en"
Language code for the generated content (default: en)
source
string
Source identifier for tracking (web, api, extension, wordpress, shopify, batch)

Example Request

cURL

curl -X POST https://api.gistmag.co.uk/blog/generate \
  -H "Content-Type: application/json" \
  -d '{
    "title": "10 Tips for Better Productivity",
    "content": "In this article, we explore proven strategies to improve your productivity and get more done in less time...",
    "api_key": "your_api_key_here",
    "image_style": "realistic",
    "language": "en"
  }'

Python

import requests

url = "https://api.gistmag.co.uk/blog/generate"

payload = {
    "title": "10 Tips for Better Productivity",
    "content": "In this article, we explore proven strategies to improve your productivity and get more done in less time...",
    "api_key": "your_api_key_here",
    "image_style": "realistic",
    "language": "en"
}

headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

if response.status_code == 200:
    data = response.json()
    print(f"Generated {len(data['images'])} images")
    print(f"Excerpt: {data['excerpt']}")
    print(f"Category: {data['category']}")
    print(f"Tags: {', '.join(data['tags'])}")
else:
    print(f"Error: {response.json()}")

JavaScript

const response = await fetch('https://api.gistmag.co.uk/blog/generate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    title: '10 Tips for Better Productivity',
    content: 'In this article, we explore proven strategies to improve your productivity...',
    api_key: 'your_api_key_here',
    image_style: 'realistic',
    language: 'en'
  })
});

const data = await response.json();

if (response.ok) {
  console.log(`Generated ${data.images.length} images`);
  console.log(`Excerpt: ${data.excerpt}`);
  console.log(`Category: ${data.category}`);
  console.log(`Tags: ${data.tags.join(', ')}`);
} else {
  console.error('Error:', data);
}

Response

images
array
Array of generated images (up to 3 images)
images[].url
string
URL of the generated image
images[].style
string
The style of the image (realistic, illustration, abstract, minimalist, photographic)
images[].description
string
Description of what the image represents
excerpt
string
A concise 2-3 sentence summary of the blog post (max 200 characters)
category
string
An appropriate category name for the blog post (e.g., “Technology”, “Health”, “Business”)
tags
array<string>
Array of 5-8 relevant tags for the blog post
generated_at
string
ISO 8601 timestamp of when the content was generated

Example Response

{
  "images": [
    {
      "url": "https://oaidalleapiprodscus.blob.core.windows.net/private/...",
      "style": "realistic",
      "description": "Create a realistic style image representing: 10 Tips for Better Productivity..."
    },
    {
      "url": "https://oaidalleapiprodscus.blob.core.windows.net/private/...",
      "style": "realistic",
      "description": "Create a realistic style image representing: 10 Tips for Better Productivity..."
    },
    {
      "url": "https://oaidalleapiprodscus.blob.core.windows.net/private/...",
      "style": "realistic",
      "description": "Create a realistic style image representing: 10 Tips for Better Productivity..."
    }
  ],
  "excerpt": "Discover 10 proven strategies to boost your productivity and accomplish more in less time. Learn practical tips for time management, focus, and efficiency.",
  "category": "Productivity",
  "tags": [
    "productivity",
    "time management",
    "efficiency",
    "work-life balance",
    "focus",
    "organization",
    "tips",
    "self-improvement"
  ],
  "generated_at": "2024-12-20T12:00:00.000Z"
}

Error Responses

error
string
Error type
message
string
Detailed error message

Common Errors

  • 400 Bad Request: Invalid request parameters (e.g., missing title, invalid image_style)
  • 401 Unauthorized: Invalid or missing API key
  • 402 Payment Required: Insufficient credits (requires 3 credits per generation)
  • 500 Internal Server Error: Server error processing the request

Example Error Response

{
  "error": "Insufficient Credits",
  "message": "You don't have enough credits. Current balance: 1. Please purchase more credits or upgrade your plan."
}

Best Practices

  1. Provide Content When Possible: Including the blog post content helps generate more accurate excerpts, categories, and tags
  2. Choose Appropriate Image Style: Select an image style that matches your blog’s aesthetic
  3. Review Generated Content: Always review and edit the generated content to ensure it matches your brand voice
  4. Handle Image URLs: Generated image URLs are temporary - download and host them on your own server for permanent use
  5. Credit Management: Each generation costs 3 credits, so ensure you have sufficient credits before making requests

Rate Limits

The Blog Meta Generator follows the same rate limits as other GistMag API endpoints. Check your subscription tier for specific limits.