'use client'; import { useState, useEffect } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { Code2, Terminal, Cpu, ArrowLeft, Copy, Check, Book, Zap, Shield, Globe, Layers, Server, Menu, X, Activity, AlertCircle, Box, MessageSquare, Sun, Moon } from 'lucide-react'; import Link from 'next/link'; type Language = 'bash' | 'python' | 'javascript' | 'go'; export default function Docs() { const [copied, setCopied] = useState(null); const [baseUrl, setBaseUrl] = useState(''); const [activeLang, setActiveLang] = useState('bash'); const [activeSection, setActiveSection] = useState('getting-started'); const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); const [theme, setTheme] = useState<'dark' | 'light'>('dark'); useEffect(() => { setBaseUrl(window.location.origin); const savedTheme = localStorage.getItem('voltedge_theme') as 'dark' | 'light' | null; const initialTheme = savedTheme || 'dark'; setTheme(initialTheme); document.documentElement.setAttribute('data-theme', initialTheme); }, []); const toggleTheme = () => { const newTheme = theme === 'dark' ? 'light' : 'dark'; setTheme(newTheme); document.documentElement.setAttribute('data-theme', newTheme); localStorage.setItem('voltedge_theme', newTheme); }; const copyCode = (text: string, id: string) => { navigator.clipboard.writeText(text); setCopied(id); setTimeout(() => setCopied(null), 2000); }; const snippets = { bash: `curl -X POST ${baseUrl || 'http://localhost:3000'}/api/v1/upload \\ -F "file=@/path/to/image.jpg" \\ -F "customId=my-slug"`, python: `import requests url = "${baseUrl || 'http://localhost:3000'}/api/v1/upload" files = {'file': open('image.jpg', 'rb')} data = {'customId': 'my-slug'} response = requests.post(url, files=files, data=data) print(response.json())`, javascript: `const formData = new FormData(); formData.append('file', imageFile); formData.append('customId', 'my-slug'); const res = await fetch('${baseUrl || 'http://localhost:3000'}/api/v1/upload', { method: 'POST', body: formData }); const data = await res.json(); console.log(data);`, go: `package main import ( "bytes" "io" "mime/multipart" "net/http" "os" ) func main() { url := "${baseUrl || 'http://localhost:3000'}/api/v1/upload" // ... setup multipart/form-data request ... // Full example omitted for brevity }` }; const responseExample = `{ "success": true, "data": { "id": "my-slug", "url": "${baseUrl || 'https://voltedge.link'}/i/my-slug", "direct_url": "${baseUrl || 'https://voltedge.link'}/i/my-slug.jpg", "timestamp": 1705500000000 } }`; const SidebarItem = ({ id, label, icon: Icon }: { id: string, label: string, icon: any }) => ( ); return (
{/* Mobile Header */}
Volt Edge
{/* Sidebar */} {/* Main Content */}
{/* Decorative Technical Elements */}
+
×
+
×
{ e.currentTarget.style.color = 'var(--accent-color)'; }} onMouseLeave={(e) => { e.currentTarget.style.color = 'var(--text-muted)'; }} > Home

Documentation

API v1.0.0

The complete reference for VoltEdge developers.

Navigate using the sidebar to explore endpoints
{activeSection === 'getting-started' && (

Getting Started

VoltEdge provides a high-performance REST API for uploading and managing images, GIFs, and videos via our Telegram-backed edge storage. Our storage is 100% free, decentralized, and infinitely scalable.

Pro Tip

All API responses are in JSON format. We recommend using versioned endpoints (e.g., /api/v1/...) for better stability.

)} {activeSection === 'authentication' && (

Authentication

API v1 (Public Access)

The VoltEdge Public API v1 is **open access**. No API keys are required to upload or retrieve image metadata. However, to prevent abuse, we implement global rate limiting based on IP addresses (20 requests/minute).

API v2 (Beta) - API Keys Available

BETA

API v2 introduces authentication with **API Keys** and **JWT tokens**. Create an account and generate API keys from the Dashboard for higher rate limits and advanced features.

Rate Limits:
  • Anonymous: 20 requests/minute
  • Authenticated (JWT): 50 requests/minute
  • API Key: Custom (default: 100 requests/minute)
Quick Start:
  1. Visit the Dashboard to create an account
  2. Generate an API key from the Dashboard
  3. Use the API key in the X-API-Key header
)} {activeSection === 'info' && (
GET

/api/v1/info/[id]

Retrieve real-time statistics and deep metadata for any image hosted on VoltEdge.

RESPONSE SCHEMA
                                    {`{
  "success": true,
  "data": {
    "id": "example-id",
    "url": "https://voltedge.link/i/example-id",
    "views": 42,
    "created_at": 1705500000000,
    "metadata": {
      "size": 102400,
      "type": "image/jpeg"
    }
  }
}`}
                                
)} {activeSection === 'upload' && (
POST

/api/v1/upload

This endpoint allows you to upload media files (Images, GIFs, Videos). It returns a clean URL that utilizes our edge redirection proxy.

Request Body

Field Type Description
file File Multipart file (Image/GIF/Video, max 2GB)
customId String Optional vanity slug for the link
{(['bash', 'python', 'javascript'] as Language[]).map(lang => ( ))}
                                    
                                        {snippets[activeLang as keyof typeof snippets]}
                                    
                                

Response Example

                                    {responseExample}
                                
)} {activeSection === 'rate-limiting' && (

Rate Limiting

To ensure peak performance for all VoltEdge users, we implement a fair-use rate limiting policy. Limits are applied per IP address.

Tier Limit Window
Public (Upload) 20 requests 1 minute
Public (Info) 60 requests 1 minute

Exceeding these limits will result in a 429 Too Many Requests response.

)} {activeSection === 'errors' && (

Error Codes

VoltEdge uses standard HTTP response codes to indicate the success or failure of an API request. All error responses follow this JSON structure:

                                    {`{
   "success": false,
   "error": {
     "code": "UPLOAD_FAILED",
     "message": "The file provided is too large or not a valid image."
   }
 }`}
                                
CODE MEANING
400 Bad Request (Missing parameters)
404 Not Found (Invalid image ID)
500 Internal Server Error
)} {activeSection === 'telegram-bot' && (

Telegram Bot Integration

VoltEdge comes with a built-in Telegram Bot that allows you to upload images directly from your chat. No API calls or dashboard visits required.

Available Commands

  • /start - Initialize the bot
  • /upload - View upload instructions
  • /tgm - Rapid upload mode

Webhook Setup

To enable the bot, you must point your Telegram Bot token to the following webhook endpoint:

/api/webhook/telegram
https://your-domain.com/api/webhook/telegram

Note: The bot handles both high-resolution Photos and Documents (when sent as images).

)} {activeSection === 'sdk' && (

Official SDKs

We are developing official libraries to help you integrate VoltEdge into your projects even faster. Coming soon to all major package managers.

{['Node.js', 'Python', 'Go', 'PHP'].map(sdk => (

{sdk}

Coming Soon

))}
)}
); }