Posts API
Get posts from the content management system
url
https://contioreach.com/api/public/post
method
GET
Query Parameters
offset
Optional
The offset for pagination (default: 0)
limit
Optional
The limit for pagination (default: 10)
category
Optional
Category slug(s) to filter by. Multiple categories can be specified as comma-separated values
tags
Optional
Tag slug(s) to filter by. Multiple tags can be specified as comma-separated values
author
Optional
Author slug to filter by
slug
Optional
Post slug to fetch a specific post
minimal
Optional
Set to 'true' to exclude content from response (for listing pages)
Authentication
API requests require authentication using an API key in one of two ways:
x-api-key header
Include your API key in the x-api-key header
authorization header
Include your API key in the authorization header with format: Bearer YOUR_API_KEY
Response
200
Success
typescript
// For multiple posts (listing)
{
data: [
{
title: string,
html_content?: string, // Excluded if minimal=true
slug: string,
description: string,
coverImage: string,
categories?: [
{
name: string,
slug: string
}
],
tags?: [
{
name: string,
slug: string
}
],
excerpt: string,
published_at: string,
authors?: [
{
slug: string,
name: string,
image: string,
bio: string,
website: string,
twitter: string
}
]
}
],
total: number,
offset: number,
limit: number,
hasMore: boolean
}
// For single post (with slug parameter)
{
data: {
// Same structure as array item above
}
}401
Unauthorized
{
error: string // Authentication error message
}404
Not Found
{
error: "Post not found"
}500
Server Error
{
error: "Failed to fetch posts"
}Usage Examples
// Fetch all posts with pagination
async function fetchPosts() {
const response = await fetch('https://contioreach.com/api/public/post?offset=0&limit=10', {
headers: {
'x-api-key': 'YOUR_API_KEY'
}
});
return await response.json();
}// Fetch posts for a specific category
async function fetchPostsByCategory(category) {
const response = await fetch('https://contioreach.com/api/public/post?category=' + category, {
headers: {
'x-api-key': 'YOUR_API_KEY'
}
});
return await response.json();
}// Fetch a single post by slug
async function fetchPostBySlug(slug) {
const response = await fetch('https://contioreach.com/api/public/post?slug=' + slug, {
headers: {
'x-api-key': 'YOUR_API_KEY'
}
});
return await response.json();
}// Fetch posts with multiple filters and minimal data
async function fetchFilteredPosts() {
const response = await fetch('https://contioreach.com/api/public/post?category=news&tags=technology,ai&minimal=true', {
headers: {
'x-api-key': 'YOUR_API_KEY'
}
});
return await response.json();
}