Files
aitbc/website/docs/api.html
oib a9f9003ad1 docs: update documentation links to use relative paths and add system flow references
- Replace absolute aitbc.bubuit.net URLs with relative paths in documentation pages
- Update markdown documentation links from /main/ to /master/ branch
- Add system flow diagram references to component documentation pages
- Remove redundant "Also available in Markdown" notices from HTML docs
- Update Font Awesome CDN link in index.html
- Simplify quick links section and remove unused tutorial/video guide plac
2026-02-11 20:59:05 +01:00

376 lines
13 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>API Documentation - AITBC</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
:root {
--primary-color: #2563eb;
--secondary-color: #1e40af;
--success-color: #10b981;
--text-dark: #1f2937;
--text-light: #6b7280;
--bg-light: #f9fafb;
--bg-white: #ffffff;
--border-color: #e5e7eb;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
line-height: 1.6;
color: var(--text-dark);
background: var(--bg-white);
margin: 0;
padding: 0;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
header {
background: var(--text-dark);
color: white;
padding: 1rem 0;
position: sticky;
top: 0;
z-index: 100;
}
nav {
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
font-size: 1.5rem;
font-weight: bold;
color: white;
text-decoration: none;
}
.nav-links {
display: flex;
gap: 2rem;
list-style: none;
margin: 0;
padding: 0;
}
.nav-links a {
color: white;
text-decoration: none;
transition: color 0.3s;
}
.nav-links a:hover {
color: var(--primary-color);
}
.doc-header {
padding: 3rem 0;
background: var(--bg-light);
margin-bottom: 2rem;
}
.doc-header h1 {
font-size: 2.5rem;
margin-bottom: 1rem;
color: var(--text-dark);
}
.doc-header p {
font-size: 1.2rem;
color: var(--text-light);
max-width: 800px;
}
.api-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
margin: 2rem 0;
}
.api-card {
background: var(--bg-white);
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 2rem;
transition: all 0.3s;
}
.api-card:hover {
box-shadow: 0 8px 25px rgba(0,0,0,0.1);
transform: translateY(-5px);
}
.api-card h3 {
margin-top: 0;
color: var(--primary-color);
font-size: 1.5rem;
}
.api-card .endpoint {
font-family: monospace;
background: var(--bg-light);
padding: 0.5rem 1rem;
border-radius: 4px;
margin: 1rem 0;
color: var(--text-dark);
}
.method {
display: inline-block;
padding: 0.25rem 0.5rem;
border-radius: 4px;
font-size: 0.875rem;
font-weight: 600;
margin-right: 0.5rem;
}
.method.get { background: #10b981; color: white; }
.method.post { background: #3b82f6; color: white; }
.method.put { background: #f59e0b; color: white; }
.method.delete { background: #ef4444; color: white; }
.back-button {
display: inline-flex;
align-items: center;
gap: 0.5rem;
color: var(--primary-color);
text-decoration: none;
margin-bottom: 2rem;
font-weight: 600;
}
.back-button:hover {
color: var(--secondary-color);
}
footer {
background: var(--text-dark);
color: white;
padding: 2rem 0;
text-align: center;
margin-top: 4rem;
}
@media (max-width: 768px) {
.nav-links {
display: none;
}
.doc-header h1 {
font-size: 2rem;
}
}
</style>
</head>
<body>
<header>
<nav class="container">
<a href="../index.html" class="logo">AITBC</a>
<ul class="nav-links">
<li><a href="../index.html">Home</a></li>
<li><a href="../docs/index.html">Documentation</a></li>
<li><a href="mailto:aitbc@bubuit.net">Contact</a></li>
</ul>
</nav>
</header>
<main>
<div class="container">
<!-- Back Button -->
<a href="../docs/index.html" class="back-button">
<i class="fas fa-arrow-left"></i>
Back to Documentation
</a>
<!-- Header -->
<div class="doc-header">
<h1><i class="fas fa-code"></i> API Documentation</h1>
<p>Complete API reference for the AITBC platform. All APIs are RESTful and use JSON for request/response format.</p>
</div>
<!-- API Endpoints -->
<div class="api-grid">
<!-- Client API -->
<div class="api-card">
<h3><i class="fas fa-users"></i> Client API</h3>
<p>Endpoints for job submission, status checking, and receipt retrieval.</p>
<div class="endpoint">
<span class="method post">POST</span>/v1/jobs
</div>
<p>Submit a new AI compute job</p>
<div class="endpoint">
<span class="method get">GET</span>/v1/jobs/{job_id}
</div>
<p>Get job status and results</p>
<div class="endpoint">
<span class="method get">GET</span>/v1/jobs/{job_id}/receipt
</div>
<p>Get computation receipt</p>
</div>
<!-- Miner API -->
<div class="api-card">
<h3><i class="fas fa-hammer"></i> Miner API</h3>
<p>Endpoints for miner registration, job assignment, and result submission.</p>
<div class="endpoint">
<span class="method post">POST</span>/v1/miners/register
</div>
<p>Register as a miner</p>
<div class="endpoint">
<span class="method post">POST</span>/v1/miners/{address}/heartbeat
</div>
<p>Send miner heartbeat</p>
<div class="endpoint">
<span class="method post">POST</span>/v1/jobs/{job_id}/complete
</div>
<p>Submit job results</p>
</div>
<!-- Admin API -->
<div class="api-card">
<h3><i class="fas fa-shield-alt"></i> Admin API</h3>
<p>Administrative endpoints for system management and monitoring.</p>
<div class="endpoint">
<span class="method get">GET</span>/v1/admin/miners
</div>
<p>List all registered miners</p>
<div class="endpoint">
<span class="method get">GET</span>/v1/admin/jobs
</div>
<p>List all jobs in system</p>
<div class="endpoint">
<span class="method get">GET</span>/v1/admin/stats
</div>
<p>Get system statistics</p>
</div>
<!-- Marketplace API -->
<div class="api-card">
<h3><i class="fas fa-store"></i> Marketplace API</h3>
<p>Endpoints for the compute marketplace and trading functionality.</p>
<div class="endpoint">
<span class="method get">GET</span>/v1/marketplace/offers
</div>
<p>List available compute offers</p>
<div class="endpoint">
<span class="method post">POST</span>/v1/marketplace/offers
</div>
<p>Create a new compute offer</p>
<div class="endpoint">
<span class="method post">POST</span>/v1/marketplace/trades
</div>
<p>Execute a trade</p>
</div>
<!-- Exchange API -->
<div class="api-card">
<h3><i class="fas fa-exchange-alt"></i> Exchange API</h3>
<p>Endpoints for token exchange and trading operations.</p>
<div class="endpoint">
<span class="method get">GET</span>/v1/exchange/ticker
</div>
<p>Get current ticker prices</p>
<div class="endpoint">
<span class="method get">GET</span>/v1/exchange/orderbook
</div>
<p>Get order book</p>
<div class="endpoint">
<span class="method post">POST</span>/v1/exchange/orders
</div>
<p>Place a new order</p>
</div>
<!-- Explorer API -->
<div class="api-card">
<h3><i class="fas fa-search"></i> Explorer API</h3>
<p>Endpoints for blockchain exploration and data retrieval.</p>
<div class="endpoint">
<span class="method get">GET</span>/v1/explorer/blocks
</div>
<p>List recent blocks</p>
<div class="endpoint">
<span class="method get">GET</span>/v1/explorer/transactions
</div>
<p>List recent transactions</p>
<div class="endpoint">
<span class="method get">GET</span>/v1/explorer/address/{address}
</div>
<p>Get address details</p>
</div>
</div>
<!-- Authentication -->
<section style="margin-top: 3rem;">
<h2>Authentication</h2>
<p>All API requests must include an API key in the header:</p>
<pre style="background: #1f2937; color: #f9fafb; padding: 1rem; border-radius: 8px; overflow-x: auto;"><code>X-Api-Key: your_api_key_here</code></pre>
<h3 style="margin-top: 2rem;">Getting API Keys</h3>
<ul>
<li>Clients: Register through the web interface or contact support</li>
<li>Miners: Generated upon registration</li>
<li>Admin: Pre-configured secure keys</li>
</ul>
</section>
<!-- Base URL -->
<section style="margin-top: 3rem;">
<h2>Base URL</h2>
<p>All API endpoints are relative to the base URL:</p>
<pre style="background: #1f2937; color: #f9fafb; padding: 1rem; border-radius: 8px; overflow-x: auto;"><code>https://aitbc.bubuit.net/api</code></pre>
<p>For development:</p>
<pre style="background: #1f2937; color: #f9fafb; padding: 1rem; border-radius: 8px; overflow-x: auto;"><code>http://localhost:18000</code></pre>
</section>
<!-- WebSocket -->
<section style="margin-top: 3rem;">
<h2>WebSocket API</h2>
<p>Real-time updates are available through WebSocket connections:</p>
<pre style="background: #1f2937; color: #f9fafb; padding: 1rem; border-radius: 8px; overflow-x: auto;"><code>ws://aitbc.bubuit.net:18001/ws</code></pre>
<p>Subscribe to events:</p>
<pre style="background: #1f2937; color: #f9fafb; padding: 1rem; border-radius: 8px; overflow-x: auto;"><code>{
"method": "subscribe",
"params": ["job_updates", "miner_heartbeats"]
}</code></pre>
</section>
</div>
</main>
<footer>
<div class="container">
<p>&copy; 2025 AITBC. All rights reserved.</p>
</div>
</footer>
</body>
</html>