API Documentation

Access and implement our open API endpoints for demos, animations, and interactive components. All endpoints are CORS-enabled and JSON-compatible.

Getting Started

1. Fetch Resources
fetch('/demos/endpoint/data.json')
    .then(response => response.json())
    .then(console.log)
2. Send POST Requests
fetch('/demos/api/submit', {
    method: 'POST',
    headers: {'Content-Type': 'application/json'},
    body: JSON.stringify({id: 123}) })
3. Stream Responses
const reader = fetch('/demos/api/stream')
    .body.getReader();
// Process chunks...

Base API Endpoint

GET
/demos/api/v1/
Returns: Available resources metadata
Public JSON

Example Request

fetch('https://demos.api.base/v1/')
    .then(response => response.json())
    .then(console.log)

Example Response

{
    "status": 200,
    "resources": {
        "data": "https://demos.api.base/v1/data",
        "submit": "https://demos.api.base/v1/submit"
    }
}

/data Endpoint

GET
/demos/api/v1/data
Returns: Current demo metadata and available components
Public JSON

/submit Endpoint

POST
/demos/api/v1/submit
Sends: User demo configurations to server
Protected JSON

Request Body

{
    "demoType": "string",
    "theme": "string",
    "features": ["array"]
}
Requires valid Authorization header with token - see Authentication below

/stream Endpoint

GET
/demos/api/v1/stream
Returns: Continuous stream of demo configuration data
Public Stream Binary
Use ReadableStream API to process byte streams. Recommended for large configuration sets or real-time data.

Authentication

Protected Endpoints:
  • POST /submit
  • DELETE /data

Token Format

Bearer eyJhbGciOiJSUzI1N...

Token should be passed in Authorization header for protected endpoints

Code Implementation

GET Request

fetch('https://demos.api.base/v1/data')
    .then(r => r.json())
    .then(data => console.log('Available Components:', data))
    .catch(e => console.error('Api Error:', e));

POST Request

fetch('https://demos.api.base/v1/submit', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_TOKEN'
    },
    body: JSON.stringify({
        demoType: 'glassmorphism',
        theme: 'dark',
        features: ['animations', '3d']
    })
})
.then(response => response.json())
.then(console.log);