CMS, Widgets & Content API Endpoints

Overview

Endpoints for content management, widgets, pages, sitemaps, and file serving.


Endpoint Summary

Endpoint Method Auth Description
/v1/pages/{page} GET None Get CMS page content
/v1/pages/{page}/summary GET None Get page summary
/v1/pages/index GET None Get CMS page index
/v1/pages/sitemap GET None Get sitemap
/v1/pages/sitemap.xml GET None Get XML sitemap
/v1/pages/robots.txt GET None Get robots.txt
/v1/cms/file/{*filepath} GET None Get CMS file
/v1/cms/images/{*filepath} GET None Get CMS image
/v1/cms/cache/clear POST Admin Clear CMS cache
/v1/cms/markdown/{filepath} GET None Get markdown content
/v1/widgets/system/{systemId} GET None Get system widget
/v1/widgets/system/{systemId}/performance GET None Get system performance
/v1/widgets/system/{systemId}/picks GET None Get system picks
/v1/widgets/user/{userId} GET None Get user widget
/v1/widgets/user/{userId}/picks GET None Get user picks

CMS Pages

GET /v1/pages/{page}

Description: Retrieves CMS page content by slug.

Path Parameters:

Response: PageContentResponse

{
  "slug": "about-us",
  "title": "About Us",
  "content": "<h1>About Us</h1><p>Welcome to our platform...</p>",
  "metadata": {
    "description": "Learn about our company",
    "keywords": ["sports", "betting", "analytics"],
    "author": "Admin",
    "publishedAt": "2025-01-01T00:00:00Z"
  },
  "lastModified": "2025-11-01T12:00:00Z"
}

GET /v1/pages/{page}/summary

Description: Retrieves page summary/preview.

Path Parameters:

Response:

{
  "slug": "about-us",
  "title": "About Us",
  "excerpt": "Learn about our company and mission...",
  "thumbnail": "https://cdn.example.com/images/about-thumb.jpg"
}

GET /v1/pages/index

Description: Retrieves index of all CMS pages.

Response: PageIndexResponse

{
  "pages": [
    {
      "slug": "about-us",
      "title": "About Us",
      "category": "company",
      "order": 1
    },
    {
      "slug": "terms-of-service",
      "title": "Terms of Service",
      "category": "legal",
      "order": 2
    },
    {
      "slug": "faq",
      "title": "FAQ",
      "category": "support",
      "order": 3
    }
  ],
  "categories": ["company", "legal", "support", "blog"]
}

Sitemaps & SEO

GET /v1/pages/sitemap

Description: Retrieves sitemap data as JSON.

Response:

{
  "urls": [
    {
      "loc": "https://example.com/",
      "lastmod": "2025-11-29",
      "changefreq": "daily",
      "priority": 1.0
    },
    {
      "loc": "https://example.com/about",
      "lastmod": "2025-11-01",
      "changefreq": "monthly",
      "priority": 0.8
    }
  ]
}

GET /v1/pages/sitemap.xml

Description: Retrieves XML sitemap for search engines.

Response: XML content

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/</loc>
    <lastmod>2025-11-29</lastmod>
    <changefreq>daily</changefreq>
    <priority>1.0</priority>
  </url>
</urlset>

GET /v1/pages/robots.txt

Description: Retrieves robots.txt content.

Response: Plain text

User-agent: *
Allow: /
Sitemap: https://example.com/v1/pages/sitemap.xml

CMS Files

GET /v1/cms/file/{*filepath}

Description: Serves CMS files.

Path Parameters:

Response: File content with appropriate MIME type


GET /v1/cms/images/{*filepath}

Description: Serves CMS images with optional transformations.

Path Parameters:

Query Parameters:

Parameter Type Description
width int Resize width
height int Resize height
quality int JPEG quality (1-100)
format string Output format (jpg, png, webp)

Response: Image binary with MIME type header


GET /v1/cms/markdown/{filepath}

Description: Retrieves and renders markdown file content.

Path Parameters:

Response: Rendered HTML or raw markdown

{
  "raw": "# Title\n\nContent here...",
  "html": "<h1>Title</h1><p>Content here...</p>",
  "frontmatter": {
    "title": "Title",
    "author": "Admin",
    "date": "2025-11-29"
  }
}

POST /v1/cms/cache/clear

Description: Clears CMS cache.

Authentication: Admin JWT required

Response: 200 OK

{
  "cleared": true,
  "message": "Cache cleared successfully",
  "timestamp": "2025-11-29T12:00:00Z"
}

Widgets

GET /v1/widgets/system/{systemId}

Description: Retrieves embeddable system widget data.

Path Parameters:

Response: SystemWidgetResponse

{
  "system": {
    "id": 12345,
    "name": "NFL ATS Expert",
    "description": "Expert picks against the spread",
    "author": {
      "username": "system_user",
      "avatar": "https://..."
    }
  },
  "performance": {
    "record": "145-98-3",
    "winRate": 59.67,
    "roi": 12.4,
    "units": 47.2
  },
  "embedCode": "<iframe src='...' width='300' height='400'></iframe>",
  "lastUpdated": "2025-11-29T12:00:00Z"
}

GET /v1/widgets/system/{systemId}/performance

Description: Retrieves system performance metrics for widget.

Path Parameters:

Response: SystemPerformanceWidgetResponse

{
  "systemId": 12345,
  "period": "season",
  "metrics": {
    "totalPicks": 246,
    "wins": 145,
    "losses": 98,
    "pushes": 3,
    "winRate": 59.67,
    "roi": 12.4,
    "avgOdds": -108,
    "streak": {
      "type": "win",
      "count": 5
    }
  },
  "chartData": [
    {"date": "2025-09-01", "cumulativeProfit": 0},
    {"date": "2025-10-01", "cumulativeProfit": 15.2},
    {"date": "2025-11-01", "cumulativeProfit": 32.8}
  ]
}

GET /v1/widgets/system/{systemId}/picks

Description: Retrieves recent system picks for widget.

Path Parameters:

Query Parameters:

Parameter Type Default Description
limit int 10 Number of picks

Response: SystemPicksWidgetResponse

{
  "systemId": 12345,
  "picks": [
    {
      "id": 67890,
      "game": "Chiefs vs Raiders",
      "pick": "Chiefs -7",
      "odds": -110,
      "result": "win",
      "date": "2025-11-28"
    }
  ]
}

GET /v1/widgets/user/{userId}

Description: Retrieves embeddable user widget data.

Path Parameters:

Response: UserWidgetResponse

{
  "user": {
    "id": "user-123",
    "username": "john_doe",
    "avatar": "https://...",
    "bio": "Sports enthusiast and expert picker"
  },
  "stats": {
    "memberSince": "2024-01-15",
    "totalPicks": 523,
    "record": "312-211",
    "winRate": 59.66,
    "reputation": 4.8
  },
  "embedCode": "<iframe src='...' width='300' height='400'></iframe>"
}

GET /v1/widgets/user/{userId}/picks

Description: Retrieves recent user picks for widget.

Path Parameters:

Query Parameters:

Parameter Type Default Description
limit int 10 Number of picks

Response: UserPicksWidgetResponse


Examples

Get CMS Page

curl -X GET "https://api.example.com/v1/pages/about-us"

Get XML Sitemap

curl -X GET "https://api.example.com/v1/pages/sitemap.xml"

Get CMS Image with Resize

curl -X GET "https://api.example.com/v1/cms/images/hero.jpg?width=800&format=webp"

Get System Widget

curl -X GET "https://api.example.com/v1/widgets/system/12345"

Clear CMS Cache (Admin)

curl -X POST "https://api.example.com/v1/cms/cache/clear" \
  -H "Authorization: Bearer eyJ..."

Related Endpoints