CGHEVEN API Reference

Official developer guide for accessing CGHEVEN's content programmatically. Fetch Assets and Categories directly from your applications.

RESTful APIBearer Token AuthJSON Format
Base URL
https://api.cgheven.com/api

Authentication

All endpoints require Bearer Token authentication

Authorization Header
Include this header in all requests
Authorization: Bearer YOUR_API_TOKEN
Invalid Token Response
What you'll receive if token is missing/invalid
{
  "error": "Forbidden",
  "message": "Invalid authorization header"
}

Available Endpoints

Complete list of API resources

ResourceMethodEndpointDescription
AssetsGET/assetsGet all assets
CategoriesGET/categoriesGet all categories

Pagination

Handle large datasets efficiently

Pagination Parameters
By default, Strapi returns 25 items per request

Example: Fetch 100 items from page 1

GET /assets?pagination[page]=1&pagination[pageSize]=100

JavaScript Example: Fetch All Pages

async function fetchAllAssets() {
  let all = [];
  let page = 1;
  let pageSize = 100;
  
  while (true) {
    const res = await fetch(
      `https://api.cgheven.com/api/assets?populate=*&pagination[page]=${page}&pagination[pageSize]=${pageSize}`,
      { headers: { Authorization: `Bearer YOUR_TOKEN` } }
    );
    const json = await res.json();
    all = all.concat(json.data);
    
    const total = json.meta.pagination.total;
    if (page * pageSize >= total) break;
    page++;
  }
  
  console.log("✅ Total assets fetched:", all.length);
  return all;
}

Common Asset Fields

Understanding the data structure

FieldTypeDescription
TitleStringAsset name/title
thumbnailString (URL)Thumbnail image
previewsString (URL)Preview video
files[]ArrayDownload links
Info_JSONObjectMetadata like creation date, version, and flags
categorieObjectLinked category
is_patreon_lockedBooleanShows if the asset requires Patreon access
createdAtDateTimeWhen the asset was created
updatedAtDateTimeLast updated timestamp

Code Examples

Quick start in different environments

JavaScript (Browser)
fetch('https://api.cgheven.com/api/assets?populate=*', {
  headers: { 
    Authorization: 'Bearer YOUR_API_TOKEN' 
  }
})
.then(res => res.json())
.then(data => console.log(data));
Node.js (Axios)
import axios from "axios";

const API_URL = "https://api.cgheven.com/api/assets";
const TOKEN = "YOUR_API_TOKEN";

axios.get(API_URL, {
  headers: { 
    Authorization: `Bearer ${TOKEN}` 
  }
})
.then(res => console.log(res.data))
.catch(err => console.error(err));

Error Handling

Common HTTP status codes and their meanings

401
Unauthorized

Missing or invalid token

404
Not Found

Invalid endpoint or ID

429
Rate Limited

Too many requests

500
Server Error

Strapi internal error

Performance Tips & Best Practices
  • Use pagination[pageSize] wisely (100 recommended)
  • Avoid fetching all collections at once in production
  • Use fields[] to request only specific attributes
  • Cache API responses (e.g., in localStorage or your database)
Need Help?
Contact our support team for API assistance

License: Apache 2.0

Documentation Author: Samiul Islam

Website: https://cgheven.com