api-reference.md.hbs•4.7 kB
# {{server.name}} API Reference
{{#if server.description}}{{server.description}}{{/if}}
{{#if baseUrl}}
**Base URL**: `{{baseUrl}}`
{{/if}}
## Table of Contents
{{#each apis}}
- [{{name}}](#{{kebabCase name}})
{{/each}}
## Authentication
{{#if hasAuthentication}}
This API requires authentication. The following authentication methods are supported:
{{#each authMethods}}
- **{{type}}**: {{description}}
{{/each}}
{{else}}
This API does not require authentication for the documented endpoints.
{{/if}}
## API Endpoints
{{#each apis}}
---
### {{name}}
{{#if description}}{{description}}{{else}}No description available{{/if}}
**Request**
`{{method}} {{url}}`
{{#if authentication}}
**Authentication**
{{authentication}}
{{/if}}
{{#if headers}}
**Headers**
| Header | Value | Required |
|--------|-------|----------|
{{#each headers}}
| `{{@key}}` | `{{this}}` | {{#if (isRequiredHeader @key)}}Yes{{else}}No{{/if}} |
{{/each}}
{{/if}}
{{#if parameters}}
**Parameters**
| Name | Type | Location | Required | Description |
|------|------|----------|----------|-------------|
{{#each parameters}}
| `{{name}}` | {{type}} | {{location}} | {{#if required}}Yes{{else}}No{{/if}} | {{#if description}}{{description}}{{else}}No description{{/if}} |
{{/each}}
{{/if}}
{{#if examples}}
**Examples**
{{#each examples}}
**{{name}}**
{{#if description}}{{description}}{{/if}}
*cURL:*
```bash
{{curlCommand}}
```
*Request:*
```http
{{request.method}} {{request.url}}
{{#each request.headers}}
{{@key}}: {{this}}
{{/each}}
{{#if request.body}}
{{#if (isObject request.body)}}{{json request.body 2}}{{else}}{{request.body}}{{/if}}
{{/if}}
```
{{#if response}}
*Response:*
```http
HTTP/1.1 {{response.status}}
{{#each response.headers}}
{{@key}}: {{this}}
{{/each}}
{{#if response.body}}
{{#if (isObject response.body)}}{{json response.body 2}}{{else}}{{response.body}}{{/if}}
{{/if}}
```
{{/if}}
{{/each}}
{{/if}}
{{#if responses}}
**Responses**
| Status | Description |
|--------|-------------|
{{#each responses}}
| {{status}} | {{description}} |
{{/each}}
{{/if}}
{{#if notes}}
**Notes**
{{#each notes}}
- {{this}}
{{/each}}
{{/if}}
{{/each}}
## Error Responses
All endpoints may return the following error responses:
| Status Code | Description | Example |
|-------------|-------------|---------|
| 400 | Bad Request | Invalid parameters or malformed request |
| 401 | Unauthorized | Missing or invalid authentication |
| 403 | Forbidden | Insufficient permissions |
| 404 | Not Found | Resource not found |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Server-side error |
| 502 | Bad Gateway | Upstream service error |
| 503 | Service Unavailable | Service temporarily unavailable |
### Error Response Format
```json
{
"error": {
"type": "validation|network|http|parsing",
"message": "Human-readable error message",
"statusCode": 400,
"details": {
"field": "Additional context about the error"
}
}
}
```
## Rate Limiting
{{#if rateLimiting}}
{{rateLimiting}}
{{else}}
Rate limiting information is not available for this API. Please refer to the API provider's documentation for rate limiting details.
{{/if}}
## SDK Examples
### JavaScript/Node.js
```javascript
const fetch = require('node-fetch');
async function callAPI() {
try {
const response = await fetch('{{#if baseUrl}}{{baseUrl}}{{else}}https://api.example.com{{/if}}/endpoint', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
// Add authentication headers as needed
}
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
console.log(data);
} catch (error) {
console.error('API call failed:', error);
}
}
```
### Python
```python
import requests
import json
def call_api():
try:
response = requests.get(
'{{#if baseUrl}}{{baseUrl}}{{else}}https://api.example.com{{/if}}/endpoint',
headers={
'Content-Type': 'application/json',
# Add authentication headers as needed
}
)
response.raise_for_status()
data = response.json()
print(data)
except requests.exceptions.RequestException as error:
print(f'API call failed: {error}')
```
### cURL
```bash
curl -X GET \
'{{#if baseUrl}}{{baseUrl}}{{else}}https://api.example.com{{/if}}/endpoint' \
-H 'Content-Type: application/json' \
# Add authentication headers as needed
```
---
*This API reference was automatically generated by the MCP Builder CLI on {{metadata.generatedAt}}.*