Skip to content

Publish to Ghost

Use the following endpoint to publish a blog post via the API.

POST /api/v1/public/integrations/ghost/publish

Include your API key in the Authorization header:

Terminal window
Authorization: Bearer YOUR_API_KEY
// Example: Publish a new blog post to Ghost
const postData = {
credentials: {
websiteUrl: "https://your-ghost-blog.com", // Your Ghost site's Admin URL
apiKey: "YOUR_GHOST_ADMIN_API_KEY" // Ghost Admin API Key
},
content: {
title: "My Awesome Ghost Post via API",
htmlContent: "<h1>Hello Ghost World</h1><p>This post was published using the API.</p>",
status: "published", // Options: 'published', 'draft', 'scheduled'
// Optional: Add tags
// tags: ["api", "javascript"]
}
};
// Endpoint: {API_ENDPOINTS.INTEGRATIONS.GHOST.PUBLISH}
fetch('https://api.blogz.ai/api/v1/public/integrations/ghost/publish', {
method: 'POST', // Use POST to create a new post
headers: {
'Authorization': 'Bearer YOUR_API_KEY', // Your Blogz API Key
'Content-Type': 'application/json'
},
body: JSON.stringify(postData) // Send Ghost credentials and content
})
.then(response => {
// Expecting JSON like { success: true, postUrl: "...", postId: "..." }
return response.json();
})
.then(data => console.log('Post published successfully to Ghost:', data))
.catch(error => console.error('Error publishing to Ghost:', error));