Back to blog
owlCMSAPIContent APIHeadless CMSREST APITutorialDeveloper

Creating a Content API with owlCMS: A Developer's Tutorial

OwlCMSMarch 26, 2026
Photo by Matthew Fournier on Unsplash
Photo by Matthew Fournier on Unsplash

In today's digital landscape, delivering content efficiently is crucial. A robust Content API allows you to distribute your content across various platforms and applications seamlessly. owlCMS provides a powerful, API-first headless CMS that simplifies content management and delivery. This tutorial will guide you through creating a content API using owlCMS, empowering you to build flexible and scalable content solutions.

What is owlCMS?

owlCMS is an AI-powered headless CMS designed for blogs, AI-generated content, and programmatic SEO. It's built to deliver content anywhere via a clean, powerful REST API. Unlike traditional CMS platforms, owlCMS separates the content repository from the presentation layer, giving developers the freedom to use their preferred frontend technologies.

Why Use owlCMS for Your Content API?

  • API-First Design: Content is accessed and managed primarily through its REST API.
  • Headless Architecture: Decouples content from presentation, providing flexibility.
  • Programmatic SEO: Enables generating hundreds of unique, optimized pages automatically.
  • AI-Powered Content Generation: Utilize AI writer to generate entire posts in seconds.
  • Easy Integration: Works with any platform that can make HTTP requests, including Next.js, Nuxt, WordPress, and more.

Prerequisites

Before we begin, ensure you have the following:

  • An owlCMS account (Start with the free 14-day trial!).
  • Basic understanding of REST APIs.
  • A development environment (e.g., Node.js, Python).
  • An HTTP client (e.g., fetch, axios, curl).

Step-by-Step Tutorial

  1. Step 1: Sign Up for owlCMS
  2. Step 2: Create Your First Site
  3. Step 3: Obtain Your API Key
  4. Step 4: Fetch Content from the API
  5. Step 5: Filter and Paginate Content
  6. Step 6: Implement Content Webhooks
  7. Step 7: Integrate with Your Frontend

Step 1: Sign Up for owlCMS

Visit the owlCMS website and sign up for a free 14-day trial. No credit card is required to get started. This trial gives you access to all the features you need to create and manage your content API.

Step 2: Create Your First Site

Once you're logged in, create your first site within owlCMS. This site will serve as the container for all your content. Give your site a descriptive name that reflects its purpose.


Powered by owlCMS

Build your own AI-powered blog in minutes.

owlCMS writes, optimises, and publishes content — so you don't have to.

Try for free →

Step 3: Obtain Your API Key

To access content from owlCMS programmatically, you'll need an API key. You can find your API key in the settings of your owlCMS site. Store this key securely as you'll use it in all your API requests. owlCMS offers API key scoping, allowing you to serve only your published content.

Step 4: Fetch Content from the API

Now, let's fetch some content using the owlCMS API. The base URL for the API is https://api.owlcms.io/v1.

// Example using fetch in JavaScript
const apiKey = 'YOUR_API_KEY'; // Replace with your actual API key
const apiUrl = 'https://api.owlcms.io/v1/posts';

fetch(apiUrl, {
  headers: {
    'X-API-Key': apiKey
  }
})
.then(response => response.json())
.then(data => {
  console.log(data);
})
.catch(error => {
  console.error('Error fetching data:', error);
});

Replace YOUR_API_KEY with your actual API key. This code snippet fetches all posts from your owlCMS site and logs the response to the console. The response will include an array of posts and the total number of posts.

Step 5: Filter and Paginate Content

owlCMS's API allows for filtering and pagination, enabling you to retrieve specific content efficiently. You can filter posts by various criteria, such as category or tag, and paginate results to manage large datasets.

// Example of filtering and pagination
const apiKey = 'YOUR_API_KEY';
const apiUrl = 'https://api.owlcms.io/v1/posts?limit=10&offset=0&category=news';

fetch(apiUrl, {
  headers: {
    'X-API-Key': apiKey
  }
})
.then(response => response.json())
.then(data => {
  console.log(data);
})
.catch(error => {
  console.error('Error fetching data:', error);
});

In this example, we're fetching the first 10 posts (limit=10&offset=0) from the news category. Adjust the limit, offset, and other query parameters to suit your needs.

Step 6: Implement Content Webhooks

owlCMS supports real-time webhooks, allowing you to receive notifications whenever content is created, updated, or deleted. This is particularly useful for keeping your frontend applications synchronized with your CMS content.

To set up a webhook:

  1. Define an endpoint in your application that can receive POST requests.
  2. In owlCMS, navigate to your site settings and configure the webhook URL.
  3. Select the events you want to subscribe to (e.g., post.created, post.updated, post.deleted).
// Example webhook handler in Node.js using Express
const express = require('express');
const app = express();
const port = 3000;

app.use(express.json());

app.post('/webhook', (req, res) => {
  const event = req.body;
  console.log('Received webhook event:', event);
  // Process the event (e.g., update your cache, trigger a rebuild)
  res.status(200).send('OK');
});

app.listen(port, () => {
  console.log(`Webhook listener app listening at http://localhost:${port}`);
});

This Node.js example creates a simple endpoint that listens for POST requests at /webhook. When an event is received, it logs the event to the console. Remember to validate the authenticity of the webhook by verifying the signature if sensitive content is impacted.

Step 7: Integrate with Your Frontend

With the API set up and webhooks configured, you can now integrate owlCMS with your frontend application. Here’s an example of fetching and displaying posts using React:

// Example React component
import React, { useState, useEffect } from 'react';

const Posts = () => {
  const [posts, setPosts] = useState([]);

  useEffect(() => {
    const apiKey = 'YOUR_API_KEY';
    const apiUrl = 'https://api.owlcms.io/v1/posts';

    fetch(apiUrl, {
      headers: {
        'X-API-Key': apiKey
      }
    })
    .then(response => response.json())
    .then(data => {
      setPosts(data.posts);
    })
    .catch(error => {
      console.error('Error fetching data:', error);
    });
  }, []);

  return (
    <div>
      <h1>Posts</h1>
      <ul>
        {posts.map(post => (
          <li key={post.id}>{post.title}</li>
        ))}
      </ul>
    </div>
  );
};

export default Posts;

This React component fetches posts from the owlCMS API and renders them in a list. You can adapt this example to fit any frontend framework, such as Next.js, Nuxt, or Vue.js.

Summary

In this tutorial, you learned how to create a content API using owlCMS. By following these steps, you can effectively manage and deliver content across various platforms. Leveraging owlCMS’s API-first design, AI-powered content generation, and flexible integration options, you can build robust and scalable content solutions. Consider exploring How to Automate Your SEO Content Creation with owlCMS to push the boundaries further.

owlCMS

Ready to automate your content?

Join teams using owlCMS to generate, publish, and rank blog content on autopilot.