Back to Documentation

Nexus Content API Documentation

Last updated:October 27, 2025

Overview

The Nexus Content API provides programmatic access to your published content. Use it to fetch documents for your external websites, mobile apps, or any other platform.

Base URL: https://content.nexusid.tech/api/v1


Authentication

All API requests require authentication via API key.

Getting Your API Key

  1. Log in to your Nexus Content admin panel

  2. Navigate to Sites page

  3. Create a new site or view an existing site

  4. Copy your API key (shown once on creation)

Using Your API Key

Include your API key in the X-API-Key header:

curl -H "X-API-Key: your-api-key-here" \
  https://content.nexusid.tech/api/v1/documents

Rate Limiting

  • Limit: 100 requests per minute per API key

  • Headers: Check X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset

  • Exceeded: Returns 429 Too Many Requests with Retry-After header


Endpoints

List Documents

Fetch all published documents assigned to your site.

Endpoint: GET /api/v1/documents

Query Parameters:

Parameter

Type

Required

Description

page

string

No

Filter by page type: blog, support, faq, privacy, terms, about

status

string

No

Filter by status: published, draft (API only returns published by default)

limit

number

No

Number of results (default: 50, max: 100)

offset

number

No

Pagination offset (default: 0)

Example Request:

curl -H "X-API-Key: your-api-key-here" \
  "https://content.nexusid.tech/api/v1/documents?page=blog&limit=10"

Example Response:

{
  "documents": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "title": "Getting Started with Nexus Content",
      "slug": "getting-started",
      "description": "Learn how to use Nexus Content CMS",
      "excerpt": "Quick guide to get you started...",
      "content_html": "<p>Full HTML content here...</p>",
      "featured_image": "https://example.com/image.jpg",
      "featured_image_alt": "Hero image",
      "page": "blog",
      "category": "Tutorials",
      "tags": ["guide", "beginner"],
      "author": "John Doe",
      "date": "2025-10-27T00:00:00.000Z",
      "read_time": 5,
      "status": "published",
      "published_at": "2025-10-27T10:00:00.000Z",
      "created_at": "2025-10-26T12:00:00.000Z",
      "updated_at": "2025-10-27T09:00:00.000Z"
    }
  ],
  "total": 42,
  "limit": 10,
  "offset": 0
}

Get Single Document

Fetch a specific document by slug.

Endpoint: GET /api/v1/documents/:slug

Path Parameters:

Parameter

Type

Required

Description

slug

string

Yes

Unique document slug (e.g., getting-started)

Example Request:

curl -H "X-API-Key: your-api-key-here" \
  https://content.nexusid.tech/api/v1/documents/getting-started

Example Response:

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "title": "Getting Started with Nexus Content",
  "slug": "getting-started",
  "description": "Learn how to use Nexus Content CMS",
  "excerpt": "Quick guide to get you started...",
  "content_html": "<p>Full HTML content here...</p>",
  "featured_image": "https://example.com/image.jpg",
  "featured_image_alt": "Hero image",
  "page": "blog",
  "category": "Tutorials",
  "tags": ["guide", "beginner"],
  "author": "John Doe",
  "date": "2025-10-27T00:00:00.000Z",
  "read_time": 5,
  "status": "published",
  "published_at": "2025-10-27T10:00:00.000Z",
  "created_at": "2025-10-26T12:00:00.000Z",
  "updated_at": "2025-10-27T09:00:00.000Z"
}

Error Response (404 Not Found):

{
  "error": "Document not found"
}

Caching & Performance

CDN Caching

The API includes CDN-friendly caching headers:

  • Cache-Control: public, s-maxage=300, stale-while-revalidate=600

  • Cache duration: 5 minutes

  • Stale-while-revalidate: 10 minutes

Recommendation: Deploy your website behind a CDN (Vercel, Cloudflare, etc.) to maximize cache hits.

Webhooks (Optional)

For instant content updates, configure webhooks in your site settings:

  1. Go to Sites → Select site → Configure Webhook

  2. Enter your webhook URL (e.g., https://your-site.com/api/revalidate)

  3. Copy the webhook secret

  4. Implement webhook handler on your site (see integration examples below)

Webhook Events:

  • document.created - New document published

  • document.updated - Existing document updated

  • document.deleted - Document deleted

  • document.restored - Deleted document restored

Webhook Payload:

{
  "event": "document.updated",
  "document_id": "123e4567-e89b-12d3-a456-426614174000",
  "slug": "getting-started",
  "site_id": "987fcdeb-51a2-43e1-b789-123456789abc",
  "title": "Getting Started with Nexus Content",
  "status": "published",
  "timestamp": "2025-10-27T10:00:00.000Z"
}

Webhook Signature: Verify authenticity using HMAC-SHA256 signature in X-Webhook-Signature header.


Integration Examples

Next.js (App Router)

// src/lib/nexus-client.ts
const NEXUS_API = "https://content.nexusid.tech/api/v1";
const API_KEY = process.env.NEXUS_API_KEY!;

export async function getBlogPosts() {
  const res = await fetch(`${NEXUS_API}/documents?page=blog&limit=50`, {
    headers: { "X-API-Key": API_KEY },
    next: { revalidate: 300 }, // ISR: 5 minutes
  });
  const data = await res.json();
  return data.documents;
}

export async function getBlogPost(slug: string) {
  const res = await fetch(`${NEXUS_API}/documents/${slug}`, {
    headers: { "X-API-Key": API_KEY },
    next: { revalidate: 300 },
  });
  if (!res.ok) return null;
  return res.json();
}

// src/app/blog/[slug]/page.tsx
export async function generateStaticParams() {
  const posts = await getBlogPosts();
  return posts.map((post) => ({ slug: post.slug }));
}

export default async function BlogPost({ params }) {
  const post = await getBlogPost(params.slug);

  return (
    <article>
      <h1>{post.title}</h1>
      <div dangerouslySetInnerHTML={{ __html: post.content_html }} />
    </article>
  );
}

Next.js Webhook Handler (Instant Updates)

// src/app/api/revalidate/route.ts
import { revalidatePath } from "next/cache";
import { NextRequest } from "next/server";
import crypto from "crypto";

export async function POST(req: NextRequest) {
  const signature = req.headers.get("X-Webhook-Signature");
  const body = await req.text();

  // Verify webhook signature
  const secret = process.env.NEXUS_WEBHOOK_SECRET!;
  const expectedSignature = `sha256=${crypto
    .createHmac("sha256", secret)
    .update(body)
    .digest("hex")}`;

  if (signature !== expectedSignature) {
    return new Response("Invalid signature", { status: 401 });
  }

  const payload = JSON.parse(body);

  // Revalidate affected paths
  revalidatePath("/blog");
  revalidatePath(`/blog/${payload.slug}`);

  return Response.json({ revalidated: true });
}

React (Client-Side)

// src/lib/api.js
const NEXUS_API = "https://content.nexusid.tech/api/v1";
const API_KEY = process.env.REACT_APP_NEXUS_API_KEY;

export async function fetchBlogPosts() {
  const res = await fetch(`${NEXUS_API}/documents?page=blog`, {
    headers: { "X-API-Key": API_KEY },
  });
  const data = await res.json();
  return data.documents;
}

// src/components/BlogList.jsx
import { useState, useEffect } from "react";
import { fetchBlogPosts } from "../lib/api";

export function BlogList() {
  const [posts, setPosts] = useState([]);

  useEffect(() => {
    fetchBlogPosts().then(setPosts);
  }, []);

  return (
    <div>
      {posts.map((post) => (
        <article key={post.id}>
          <h2>{post.title}</h2>
          <p>{post.excerpt}</p>
        </article>
      ))}
    </div>
  );
}

Python

import requests
import os

NEXUS_API = "https://content.nexusid.tech/api/v1"
API_KEY = os.getenv("NEXUS_API_KEY")

def get_blog_posts():
    """Fetch all blog posts"""
    response = requests.get(
        f"{NEXUS_API}/documents",
        headers={"X-API-Key": API_KEY},
        params={"page": "blog", "limit": 50}
    )
    response.raise_for_status()
    return response.json()["documents"]

def get_blog_post(slug):
    """Fetch single blog post by slug"""
    response = requests.get(
        f"{NEXUS_API}/documents/{slug}",
        headers={"X-API-Key": API_KEY}
    )
    if response.status_code == 404:
        return None
    response.raise_for_status()
    return response.json()

# Usage
posts = get_blog_posts()
for post in posts:
    print(f"{post['title']} - {post['slug']}")

post = get_blog_post("getting-started")
print(post["content_html"])

cURL Examples

# Fetch all blog posts
curl -H "X-API-Key: your-api-key" \
  "https://content.nexusid.tech/api/v1/documents?page=blog"

# Fetch single blog post
curl -H "X-API-Key: your-api-key" \
  https://content.nexusid.tech/api/v1/documents/getting-started

# Fetch with pagination
curl -H "X-API-Key: your-api-key" \
  "https://content.nexusid.tech/api/v1/documents?page=blog&limit=10&offset=20"

# Fetch FAQs
curl -H "X-API-Key: your-api-key" \
  "https://content.nexusid.tech/api/v1/documents?page=faq"

Error Codes

Code

Description

Solution

200

Success

Request completed successfully

401

Unauthorized

Check your API key is valid and included in X-API-Key header

404

Not Found

Document with specified slug doesn't exist

429

Too Many Requests

Rate limit exceeded. Wait for Retry-After seconds

500

Internal Server Error

Contact support if persists

503

Service Unavailable

Temporary issue, retry with exponential backoff


Best Practices

1. Environment Variables

Never hardcode API keys in your code:

# .env.local
NEXUS_API_KEY=your-api-key-here
NEXUS_WEBHOOK_SECRET=your-webhook-secret-here

2. Error Handling

Always handle errors gracefully:

try {
  const post = await getBlogPost(slug);
  if (!post) {
    return <NotFound />;
  }
  return <BlogPost post={post} />;
} catch (error) {
  console.error("Failed to fetch post:", error);
  return <ErrorPage />;
}

3. Caching Strategy

Without Webhooks (Simple):

  • Use ISR with 5-minute revalidation

  • Content updates visible within 5 minutes

With Webhooks (Advanced):

  • Use ISR as fallback (5 minutes)

  • Webhook triggers instant revalidation

  • Content updates visible within ~3 seconds

4. Security

  • Never expose API keys in client-side code - Use server-side rendering or API routes

  • Store API keys in environment variables

  • Regenerate API keys if compromised

  • Verify webhook signatures to prevent spoofing


Support


Last Updated: October 27, 2025
API Version: v1