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>"
}
'import requests
url = "https://api.example.com/blog/generate"
payload = {
"title": "<string>",
"api_key": "<string>",
"content": "<string>",
"image_style": "<string>",
"language": "<string>",
"source": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
api_key: '<string>',
content: '<string>',
image_style: '<string>',
language: '<string>',
source: '<string>'
})
};
fetch('https://api.example.com/blog/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/blog/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'api_key' => '<string>',
'content' => '<string>',
'image_style' => '<string>',
'language' => '<string>',
'source' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/blog/generate"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"api_key\": \"<string>\",\n \"content\": \"<string>\",\n \"image_style\": \"<string>\",\n \"language\": \"<string>\",\n \"source\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/blog/generate")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"api_key\": \"<string>\",\n \"content\": \"<string>\",\n \"image_style\": \"<string>\",\n \"language\": \"<string>\",\n \"source\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/blog/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"api_key\": \"<string>\",\n \"content\": \"<string>\",\n \"image_style\": \"<string>\",\n \"language\": \"<string>\",\n \"source\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"images": [
{}
],
"images[].url": "<string>",
"images[].style": "<string>",
"images[].description": "<string>",
"excerpt": "<string>",
"category": "<string>",
"tags": [
"<string>"
],
"generated_at": "<string>",
"error": "<string>",
"message": "<string>"
}Blog Meta Generator
Generate Blog Meta Elements
Generate images, excerpt, category, and tags for blog posts
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>"
}
'import requests
url = "https://api.example.com/blog/generate"
payload = {
"title": "<string>",
"api_key": "<string>",
"content": "<string>",
"image_style": "<string>",
"language": "<string>",
"source": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
api_key: '<string>',
content: '<string>',
image_style: '<string>',
language: '<string>',
source: '<string>'
})
};
fetch('https://api.example.com/blog/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/blog/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'api_key' => '<string>',
'content' => '<string>',
'image_style' => '<string>',
'language' => '<string>',
'source' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/blog/generate"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"api_key\": \"<string>\",\n \"content\": \"<string>\",\n \"image_style\": \"<string>\",\n \"language\": \"<string>\",\n \"source\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/blog/generate")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"api_key\": \"<string>\",\n \"content\": \"<string>\",\n \"image_style\": \"<string>\",\n \"language\": \"<string>\",\n \"source\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/blog/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"api_key\": \"<string>\",\n \"content\": \"<string>\",\n \"image_style\": \"<string>\",\n \"language\": \"<string>\",\n \"source\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"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
string
required
The title of your blog post. This is used to generate all elements.
string
required
Your GistMag API key
string
Optional blog post content. Providing content helps generate more accurate and relevant results.
string
default:"realistic"
The style of images to generate. Options:
realistic: Photorealistic imagesillustration: Artistic illustrationsabstract: Abstract designsminimalist: Simple, clean designsphotographic: High-quality photographs
string
default:"en"
Language code for the generated content (default: en)
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);
}
Image Generation
Images are generated using Nano Banana (Google Gemini Image Generation API) and automatically uploaded to Supabase Storage. Each image is returned as a public URL that can be directly used in your application or downloaded.All images are hosted on Supabase Storage and are publicly accessible via the returned URLs. Images are generated in the style you specify and optimized for web use.
Response
array
Array of generated images (up to 3 images)
string
Public URL of the generated image (hosted on Supabase Storage). Images are generated using Nano Banana (Google Gemini) and automatically uploaded to storage.
string
The style of the image (realistic, illustration, abstract, minimalist, photographic)
string
Description of what the image represents
string
A concise 2-3 sentence summary of the blog post (max 200 characters)
string
An appropriate category name for the blog post (e.g., “Technology”, “Health”, “Business”)
array<string>
Array of 5-8 relevant tags for the blog post
string
ISO 8601 timestamp of when the content was generated
Example Response
{
"images": [
{
"url": "https://eutekssvzhtkwzperkzb.supabase.co/storage/v1/object/public/blog-images/1234567890-abc123.png",
"style": "realistic",
"description": "Create a realistic style image representing: 10 Tips for Better Productivity..."
},
{
"url": "https://eutekssvzhtkwzperkzb.supabase.co/storage/v1/object/public/blog-images/1234567891-def456.png",
"style": "realistic",
"description": "Create a realistic style image representing: 10 Tips for Better Productivity..."
},
{
"url": "https://eutekssvzhtkwzperkzb.supabase.co/storage/v1/object/public/blog-images/1234567892-ghi789.png",
"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
string
Error type
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 key402 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
- Provide Content When Possible: Including the blog post content helps generate more accurate excerpts, categories, and tags
- Choose Appropriate Image Style: Select an image style that matches your blog’s aesthetic
- Review Generated Content: Always review and edit the generated content to ensure it matches your brand voice
- Handle Image URLs: Generated image URLs are temporary - download and host them on your own server for permanent use
- Credit Management: Each generation costs 3 credits, so ensure you have sufficient credits before making requests