|
1 | 1 | <!DOCTYPE html> |
2 | 2 | <html> |
3 | 3 | <head> |
4 | | - <title>Faxbot API Documentation</title> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <title>Faxbot API Reference</title> |
5 | 6 | <style> |
6 | | - body { font-family: Arial, sans-serif; margin: 0; padding: 20px; } |
7 | | - .container { max-width: 1200px; margin: 0 auto; } |
8 | | - .button { |
9 | | - display: inline-block; |
10 | | - padding: 12px 24px; |
11 | | - background: #007bff; |
12 | | - color: white; |
13 | | - text-decoration: none; |
14 | | - border-radius: 6px; |
15 | | - margin: 10px 10px 10px 0; |
16 | | - font-weight: bold; |
17 | | - } |
18 | | - .button:hover { background: #0056b3; } |
19 | | - .success { background: #28a745; } |
20 | | - .warning { background: #ffc107; color: #212529; } |
21 | | - pre { background: #f8f9fa; padding: 15px; border-radius: 5px; overflow-x: auto; font-size: 12px; } |
22 | | - .section { margin: 30px 0; padding: 20px; border: 1px solid #dee2e6; border-radius: 8px; } |
23 | | - h1 { color: #333; } |
24 | | - h2 { color: #666; border-bottom: 2px solid #eee; padding-bottom: 10px; } |
| 7 | + body { font-family: -apple-system, system-ui, Segoe UI, Roboto, Helvetica, Arial, sans-serif; line-height: 1.6; margin: 40px auto; max-width: 900px; padding: 0 16px; } |
| 8 | + h1, h2 { margin-top: 1.25rem; } |
| 9 | + a.button { display: inline-block; padding: 10px 16px; background: #2563eb; color: white; text-decoration: none; border-radius: 6px; margin: 6px 8px 6px 0; } |
| 10 | + a.secondary { background: #374151; } |
| 11 | + .muted { color: #6b7280; } |
| 12 | + .card { border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px 16px; background: #f9fafb; } |
25 | 13 | </style> |
| 14 | + <meta http-equiv="Cache-Control" content="no-store" /> |
| 15 | + <meta http-equiv="Pragma" content="no-cache" /> |
| 16 | + <meta http-equiv="Expires" content="0" /> |
26 | 17 | </head> |
27 | 18 | <body> |
28 | | - <div class="container"> |
29 | | - <h1>🚀 Faxbot API Documentation</h1> |
30 | | - <p><strong>The first and only open-source, self-hostable fax API.</strong></p> |
31 | | - |
32 | | - <div class="section"> |
33 | | - <h2>📋 Copy & Paste URLs (100% Working)</h2> |
34 | | - <p>Use these URLs in any API documentation tool:</p> |
35 | | - |
36 | | - <h3>JSON Format (Recommended)</h3> |
37 | | - <pre>https://docs.faxbot.net/openapi.json</pre> |
38 | | - <a href="https://petstore.swagger.io/?url=https://docs.faxbot.net/openapi.json" class="button"> |
39 | | - 🔍 Open in Swagger UI |
40 | | - </a> |
41 | | - |
42 | | - <h3>YAML Format</h3> |
43 | | - <pre>https://docs.faxbot.net/openapi.yaml</pre> |
44 | | - <a href="https://petstore.swagger.io/?url=https://docs.faxbot.net/openapi.yaml" class="button"> |
45 | | - 🔍 Open YAML in Swagger UI |
46 | | - </a> |
47 | | - </div> |
48 | | - |
49 | | - <div class="section"> |
50 | | - <h2>🛠️ Tool-Specific Instructions</h2> |
51 | | - |
52 | | - <h3>Postman</h3> |
53 | | - <ol> |
54 | | - <li>Click "Import" → "Link"</li> |
55 | | - <li>Paste: <code>https://docs.faxbot.net/openapi.json</code></li> |
56 | | - <li>Click "Continue" → "Import"</li> |
57 | | - </ol> |
58 | | - |
59 | | - <h3>Insomnia</h3> |
60 | | - <ol> |
61 | | - <li>File → Import/Export → Import Data → From URL</li> |
62 | | - <li>Paste: <code>https://docs.faxbot.net/openapi.json</code></li> |
63 | | - </ol> |
64 | | - |
65 | | - <h3>Stoplight Studio</h3> |
66 | | - <ol> |
67 | | - <li>Create New Project → Import OpenAPI</li> |
68 | | - <li>Paste: <code>https://docs.faxbot.net/openapi.json</code></li> |
69 | | - </ol> |
70 | | - |
71 | | - <h3>Redoc</h3> |
72 | | - <ol> |
73 | | - <li>Go to <a href="https://redocly.github.io/redoc/">redocly.github.io/redoc</a></li> |
74 | | - <li>Add <code>?url=https://docs.faxbot.net/openapi.json</code> to the URL</li> |
75 | | - </ol> |
76 | | - </div> |
77 | | - |
78 | | - <div class="section"> |
79 | | - <h2>⚡ Quick API Test</h2> |
80 | | - <p>Test the API directly:</p> |
81 | | - |
82 | | - <h3>Health Check</h3> |
83 | | - <pre>curl http://localhost:8080/health</pre> |
84 | | - |
85 | | - <h3>Send a Fax</h3> |
86 | | - <pre>curl -X POST "http://localhost:8080/fax" \ |
87 | | - -H "X-API-Key: your_key_here" \ |
88 | | - -F "to=+15551234567" \ |
89 | | - |
90 | | - |
91 | | - <h3>Check Status</h3> |
92 | | - <pre>curl -H "X-API-Key: your_key_here" \ |
93 | | - "http://localhost:8080/fax/{job_id}"</pre> |
94 | | - </div> |
95 | | - |
96 | | - <div class="section"> |
97 | | - <h2>📚 Core Endpoints</h2> |
98 | | - <table style="width: 100%; border-collapse: collapse;"> |
99 | | - <tr style="background: #f8f9fa;"> |
100 | | - <th style="padding: 12px; text-align: left; border: 1px solid #dee2e6;">Method</th> |
101 | | - <th style="padding: 12px; text-align: left; border: 1px solid #dee2e6;">Endpoint</th> |
102 | | - <th style="padding: 12px; text-align: left; border: 1px solid #dee2e6;">Description</th> |
103 | | - </tr> |
104 | | - <tr> |
105 | | - <td style="padding: 12px; border: 1px solid #dee2e6;"><code>POST</code></td> |
106 | | - <td style="padding: 12px; border: 1px solid #dee2e6;"><code>/fax</code></td> |
107 | | - <td style="padding: 12px; border: 1px solid #dee2e6;">Send a fax</td> |
108 | | - </tr> |
109 | | - <tr> |
110 | | - <td style="padding: 12px; border: 1px solid #dee2e6;"><code>GET</code></td> |
111 | | - <td style="padding: 12px; border: 1px solid #dee2e6;"><code>/fax/{id}</code></td> |
112 | | - <td style="padding: 12px; border: 1px solid #dee2e6;">Get fax status</td> |
113 | | - </tr> |
114 | | - <tr> |
115 | | - <td style="padding: 12px; border: 1px solid #dee2e6;"><code>GET</code></td> |
116 | | - <td style="padding: 12px; border: 1px solid #dee2e6;"><code>/health</code></td> |
117 | | - <td style="padding: 12px; border: 1px solid #dee2e6;">Health check</td> |
118 | | - </tr> |
119 | | - <tr> |
120 | | - <td style="padding: 12px; border: 1px solid #dee2e6;"><code>GET</code></td> |
121 | | - <td style="padding: 12px; border: 1px solid #dee2e6;"><code>/inbound</code></td> |
122 | | - <td style="padding: 12px; border: 1px solid #dee2e6;">List received faxes</td> |
123 | | - </tr> |
124 | | - </table> |
125 | | - </div> |
126 | | - |
127 | | - <div class="section"> |
128 | | - <h2>🔧 If Nothing Works</h2> |
129 | | - <p>Download the spec file directly:</p> |
130 | | - <a href="/openapi.json" download="faxbot-openapi.json" class="button warning"> |
131 | | - 📥 Download JSON |
132 | | - </a> |
133 | | - <a href="/openapi.yaml" download="faxbot-openapi.yaml" class="button warning"> |
134 | | - 📥 Download YAML |
135 | | - </a> |
136 | | - <p>Then import the downloaded file into your tool.</p> |
137 | | - </div> |
138 | | - |
139 | | - <div id="test-status"></div> |
| 19 | + <h1>API Reference</h1> |
| 20 | + <p class="muted">The live, always‑up‑to‑date API reference is hosted on the website.</p> |
| 21 | + |
| 22 | + <div class="card"> |
| 23 | + <p> |
| 24 | + <a href="https://faxbot.net/api/v1/" class="button">📚 View API (ReDoc)</a> |
| 25 | + <a href="https://faxbot.net/api/v1/swagger" class="button secondary">🔍 Swagger UI</a> |
| 26 | + </p> |
| 27 | + <p> |
| 28 | + Spec files: <a href="https://faxbot.net/api/v1/openapi.json">JSON</a> · <a href="https://faxbot.net/api/v1/openapi.yaml">YAML</a> |
| 29 | + </p> |
140 | 30 | </div> |
141 | 31 |
|
142 | | - <script> |
143 | | - // Test if our URLs actually work |
144 | | - function testUrl(url, format) { |
145 | | - fetch(url) |
146 | | - .then(response => { |
147 | | - if (response.ok) { |
148 | | - return response.text(); |
149 | | - } |
150 | | - throw new Error(`HTTP ${response.status}`); |
151 | | - }) |
152 | | - .then(data => { |
153 | | - const statusDiv = document.getElementById('test-status'); |
154 | | - statusDiv.innerHTML += `<p style="color: #28a745;">✅ ${format} format is accessible and ready!</p>`; |
155 | | - }) |
156 | | - .catch(error => { |
157 | | - const statusDiv = document.getElementById('test-status'); |
158 | | - statusDiv.innerHTML += `<p style="color: #dc3545;">❌ ${format} format: ${error.message}</p>`; |
159 | | - }); |
160 | | - } |
161 | | - |
162 | | - // Test both formats |
163 | | - setTimeout(() => { |
164 | | - testUrl('https://docs.faxbot.net/openapi.json', 'JSON'); |
165 | | - testUrl('https://docs.faxbot.net/openapi.yaml', 'YAML'); |
166 | | - }, 1000); |
167 | | - </script> |
| 32 | + <h2>Developers</h2> |
| 33 | + <p>For local preview, you can still use repo helpers:</p> |
| 34 | + <ul class="muted"> |
| 35 | + <li><code>./scripts/regenerate-openapi-yaml.sh http://localhost:8080</code></li> |
| 36 | + <li><code>./scripts/preview-openapi-docs.sh</code> → <code>http://localhost:8081/swagger.html</code></li> |
| 37 | + </ul> |
168 | 38 | </body> |
169 | 39 | </html> |
| 40 | + |
0 commit comments