Documentation

Everything you need to know about ContentShelter

Getting Started

Follow these steps to create your first content and display it on your website.

1

Create Account

Sign up for a free account at /signup and log in to your dashboard.

2

Add a Website

Register your website in Dashboard โ†’ Websites โ€” each site gets its own content space.

3

Create Content

Use the rich editor in Dashboard โ†’ Content to write blogs, articles, and more. Publish or schedule it.

4

Get API Keys

Generate an API key in Dashboard โ†’ API Keys. Copy both the key and secret.

5

Integrate

Display your content using the REST API or the embed script.

Authentication

All API requests require both an API key and an API secret, sent as request headers. Each key pair is bound to a specific website.

API Key & Secret

Include both in request headers:

x-api-key: cs_live_abc123def456...
x-api-secret: cs_secret_xyz789uvw012...

Getting API Keys

  1. Log in to your ContentShelter dashboard
  2. Navigate to "API Keys" in dashboard
  3. Click "Create API Key"
  4. Configure permissions and rate limits
  5. Copy both API key and secret
  6. Each API key is website-specific for security

Keep your secret safe. Never expose the API secret in client-side code or public repositories. For client-side display, use the embed script which only needs the public API key.

API Reference

The ContentShelter API lets you securely fetch published content from your account and display it on your websites.

Your First API Request โ€” Step by Step

1

Get your API Key and Secret

  1. Log in to your ContentShelter dashboard
  2. Go to Dashboard โ†’ API Keys
  3. Click "Create API Key" and select your website
  4. Copy both values โ€” the API Key (starts with cs_) and the API Secret
2

Pick your endpoint URL

For example, to list your blog posts:

https://contentshelter.com/api/public/content/blog_post/list?limit=10&page=1
3

Add the auth headers (this is the part people miss)

Every request needs two headers. Without them you'll get "Both x-api-key and x-api-secret headers are required".

In Postman:
  1. Set method to GET and paste the URL
  2. Open the Headers tab
  3. Add row: Key x-api-key, Value: your API key
  4. Add row: Key x-api-secret, Value: your API secret
  5. Click Send
In JavaScript:
fetch(url, {
headers: {
"x-api-key": "cs_live_...",
"x-api-secret": "cs_secret_..."
}
})
4

Read the response

A successful response looks like this:

{ "success": true, "posts": [...], "pagination": { "page": 1, "total": 25 } }
!

If something goes wrong

ErrorFix
"Both x-api-key and x-api-secret headers are required"You didn't add the headers โ€” see step 3
401 "Invalid or inactive API key"Key or secret is wrong, or the key is deactivated โ€” recheck in Dashboard โ†’ API Keys
403 ForbiddenKey doesn't have permission for this website โ€” check key settings
429 Too Many RequestsRate limit hit โ€” wait or raise limits in key settings
MethodEndpointAuthDescription
GET/api/public/content/{contentType}/listKey + SecretList content of a specific type
GET/api/public/content/{contentType}/{slug}Key + SecretGet single content item
GET/api/public/postsKey + SecretList all published content (any type)
GET/api/public/posts/{slug}?apikey= paramGet single post (client-safe)
GET/api/public/blogKey + SecretList blog posts with search
GET/api/public/categoriesKey + SecretList categories for your website

Ready-to-Use URLs

Copy any URL below and replace YOUR_API_KEY / YOUR_API_SECRET and SLUG with your own values. In local development, use http://localhost:3000 as the base URL.

GET https://contentshelter.com/api/public/content/blog_post/list?limit=10&page=1
# headers: x-api-key: YOUR_API_KEY ยท x-api-secret: YOUR_API_SECRET
GET https://contentshelter.com/api/public/content/faq/list?limit=10&page=1
# headers: x-api-key: YOUR_API_KEY ยท x-api-secret: YOUR_API_SECRET
GET https://contentshelter.com/api/public/content/blog_post/SLUG
# headers: x-api-key: YOUR_API_KEY ยท x-api-secret: YOUR_API_SECRET
GET https://contentshelter.com/api/public/posts?limit=10&page=1
# headers: x-api-key: YOUR_API_KEY ยท x-api-secret: YOUR_API_SECRET
GET https://contentshelter.com/api/public/posts/SLUG?apikey=YOUR_API_KEY
# auth: ?apikey= param only โ€” safe for browser use (no secret needed)
GET https://contentshelter.com/api/public/blog?category=all&limit=10&page=1
# headers: x-api-key: YOUR_API_KEY ยท x-api-secret: YOUR_API_SECRET
GET https://contentshelter.com/api/public/categories
# headers: x-api-key: YOUR_API_KEY ยท x-api-secret: YOUR_API_SECRET

All endpoints except /api/public/posts/SLUG require the headers x-api-key: YOUR_API_KEY and x-api-secret: YOUR_API_SECRET.

Get Content List

GET /api/public/content/{contentType}/list

Parameters

  • contentType - Content type (blog_post, article, guide, news, faq)
  • limit - Number of items per page (default: 10)
  • page - Page number (default: 1)

Example Request

curl -X GET \
"https://contentshelter.com/api/public/content/blog_post/list?limit=5&page=1" \
-H "x-api-key: cs_live_abc123def456..." \
-H "x-api-secret: cs_secret_xyz789uvw012..."

Response

{
"success": true,
"posts": [
{
"_id": "64f8a1b2c3d4e5f6a7b8c9d0",
"title": "My Blog Post",
"slug": "my-blog-post",
"contentType": "blog_post",
"excerpt": "This is an excerpt...",
"featuredImage": "https://...",
"tags": ["tag1", "tag2"],
"category": { "name": "Tech", "slug": "tech" },
"author": { "name": "John Doe" },
"publishedAt": "2023-09-05T10:00:00.000Z"
}
],
"pagination": { "page": 1, "limit": 5, "total": 25, "pages": 5 },
"requestId": "abc123def456"
}

Get Single Content

GET /api/public/content/{contentType}/{slug}

Parameters

  • contentType - Content type
  • slug - Content slug

Example Request

curl -X GET \
"https://contentshelter.com/api/public/content/blog_post/my-blog-post" \
-H "x-api-key: cs_live_abc123def456..." \
-H "x-api-secret: cs_secret_xyz789uvw012..."

Response

{
"success": true,
"data": {
"id": "64f8a1b2c3d4e5f6a7b8c9d0",
"title": "My Blog Post",
"slug": "my-blog-post",
"contentType": "blog_post",
"content": "<p>Full content here...</p>",
"excerpt": "This is an excerpt...",
"featuredImage": "https://...",
"tags": ["tag1", "tag2"],
"publishedAt": "2023-09-05T10:00:00.000Z"
}
}

Get All Posts

GET /api/public/posts

Parameters

  • category - Filter by category slug (optional)
  • contentType - Filter by content type (optional)
  • limit - Items per page (default: 10)
  • page - Page number (default: 1)

Example Request

curl -X GET \
"https://contentshelter.com/api/public/posts?category=tech&limit=10&page=1" \
-H "x-api-key: cs_live_abc123def456..." \
-H "x-api-secret: cs_secret_xyz789uvw012..."

Get Single Post (Client-Safe)

GET /api/public/posts/{slug}?apikey={your_api_key}

This endpoint only requires the public API key as a query parameter โ€” no secret needed โ€” so it's safe to call directly from browser JavaScript on your website.

Example Request

fetch("https://contentshelter.com/api/public/posts/my-blog-post?apikey=cs_live_abc123def456...")
.then(res => res.json())
.then(data =>);

Get Blog Posts

GET /api/public/blog

Parameters

  • category - Filter by category slug, or "all" (optional)
  • search - Search title, excerpt, and content (optional)
  • limit - Items per page
  • page - Page number

Example Request

curl -X GET \
"https://contentshelter.com/api/public/blog?search=tutorial&limit=5" \
-H "x-api-key: cs_live_abc123def456..." \
-H "x-api-secret: cs_secret_xyz789uvw012..."

Get Categories

GET /api/public/categories

Returns all categories configured for the website associated with your API key. Useful for building category navigation on your site.

Example Request

curl -X GET \
"https://contentshelter.com/api/public/categories" \
-H "x-api-key: cs_live_abc123def456..." \
-H "x-api-secret: cs_secret_xyz789uvw012..."

Rate Limiting

API requests are rate-limited to prevent abuse. Each API key has configurable limits:

  • Default limit: 1,000 requests per hour
  • Rate limit headers are included in responses
  • Exceeding limits returns HTTP 429 status
  • Configure limits in your API key settings
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1693920000

Error Handling

401 Unauthorized

Missing or invalid API key

403 Forbidden

Insufficient permissions or origin not allowed

404 Not Found

Content not found

429 Too Many Requests

Rate limit exceeded

500 Internal Server Error

Server error occurred

For the full API reference including WordPress integration examples, see the API Reference page.

Embed Scripts

The fastest way to display ContentShelter content on any website โ€” no backend code required. Add a single script tag and your posts render automatically.

Basic Usage

Add this to your HTML before the closing body tag:

<script src="https://contentshelter.com/embed.js?apikey=cs_live_abc123def456..."></script>

How It Works

  1. The script reads your API key from its own apikey query parameter
  2. It creates a #contentshelter-container div where the script tag is placed
  3. It fetches your published blog posts and renders them as styled article cards
  4. Each card shows title, author, publish date, and excerpt
  5. Clicking "Read more" opens the full post in a modal overlay

Features

  • Automatic content loading and display
  • Responsive design out of the box
  • Modal popup for full articles
  • Automatic API key extraction from script URL
  • Error handling and loading states

Note: The embed script only needs the public API key (no secret), making it safe for client-side use. It currently displays blog_post content โ€” use the API for other content types.

Content Types

Every piece of content has a type that determines how it's organized and fetched. Use the contentType parameter in API requests.

blog_post

Blog Post

Standard blog articles with title, content, excerpt, featured image, tags, and categories. The most common content type.

guide

Guide

Step-by-step instructional content and how-to documentation for your audience.

news

News

Time-sensitive announcements, press releases, and updates about your product or company.

faq

FAQ

Question-and-answer pairs for support pages and knowledge bases.

Common Fields

All content types share the same core fields:

  • title, slug, content (HTML), excerpt
  • featuredImage, tags, category
  • author, status, publishedAt

Analytics

Track how your content performs across every website that consumes it, from the dashboard's Analytics section.

Content Performance

See views and engagement for each piece of content, broken down by content type.

API Usage

Monitor API requests per key, including request counts and rate limit usage.

Website Breakdown

Compare performance across your connected websites to see which audiences engage most.

Dashboard Access

View analytics at Dashboard โ†’ Analytics after logging in to your account.