API Reference¶
CalcBridge provides a comprehensive REST API for programmatic access to all platform features. This reference documents all available endpoints, authentication methods, and data models.
Base URL¶
All API endpoints are relative to the base URL:
Production: https://api.calcbridge.io/api/v1
Staging: https://api-staging.calcbridge.io/api/v1
Development: http://localhost:8000/api/v1
API Versioning¶
The API version is included in the URL path (/api/v1). When breaking changes are introduced, a new version will be released while maintaining backward compatibility for existing versions.
| Version | Status | End of Life |
|---|---|---|
v1 | Current | - |
Authentication¶
CalcBridge supports two authentication methods:
JWT Bearer Token¶
For user-facing applications. Obtain tokens via the /auth/login endpoint.
curl -X GET https://api.calcbridge.io/api/v1/workbooks \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
API Key¶
For service-to-service integrations. Create API keys in the dashboard or via the Admin API.
See Authentication API for complete details.
Rate Limiting¶
Rate limits vary by subscription tier and are applied per-tenant or per-API-key.
| Tier | Requests/Minute | Burst Limit |
|---|---|---|
| Free | 60 | 10 |
| Standard | 300 | 50 |
| Premium | 1,000 | 100 |
| Enterprise | 10,000 | 500 |
Rate Limit Headers¶
Every response includes rate limit information:
When rate limited, you'll receive a 429 Too Many Requests response:
{
"error": "rate_limit_exceeded",
"message": "Too many requests. Please slow down.",
"retry_after": 32
}
Error Response Format¶
All errors follow a consistent format:
{
"detail": "Human-readable error message",
"error_code": "SPECIFIC_ERROR_CODE",
"request_id": "req_abc123xyz"
}
HTTP Status Codes¶
| Status | Description |
|---|---|
200 | Success |
201 | Resource created |
204 | No content (successful deletion) |
400 | Bad request - invalid input |
401 | Unauthorized - authentication required |
403 | Forbidden - insufficient permissions |
404 | Resource not found |
409 | Conflict - resource already exists or concurrent modification |
422 | Validation error |
429 | Rate limit exceeded |
500 | Internal server error |
Common Error Codes¶
| Code | Description |
|---|---|
INVALID_TOKEN | JWT token is invalid or expired |
TOKEN_REVOKED | Token has been revoked |
RESOURCE_NOT_FOUND | Requested resource does not exist |
VALIDATION_ERROR | Request body validation failed |
RATE_LIMIT_EXCEEDED | Too many requests |
CALCULATION_ERROR | Formula evaluation failed |
FILE_PARSE_ERROR | Excel file could not be parsed |
Pagination¶
List endpoints support cursor-based pagination:
Request Parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
page | integer | 1 | Page number (1-indexed) |
page_size | integer | 20 | Items per page (max 100) |
Response Format¶
Request Headers¶
| Header | Required | Description |
|---|---|---|
Authorization | Yes* | Bearer token: Bearer <token> |
X-API-Key | Yes* | API key for service auth |
Content-Type | Yes | application/json for POST/PUT/PATCH |
X-Request-ID | No | Custom request ID for tracing |
X-Tenant-ID | No | Override tenant (admin only) |
*One of Authorization or X-API-Key is required.
Quick Links¶
Core APIs¶
| API | Description |
|---|---|
| Authentication | User registration, login, token management |
| Workbooks | Excel file upload, sheet management |
| Calculations | Formula evaluation, batch processing |
| Scenarios | What-if trade simulation |
| Compliance | Compliance test execution |
Supporting APIs¶
| API | Description |
|---|---|
| Reports | Report generation and export |
| Alerts | Alert configuration and history |
| Mappings | Column mapping configuration |
| Admin | Tenant and user management |
Data Models¶
| Model | Description |
|---|---|
| Workbook Models | Workbook, Sheet, SheetData |
| Scenario Models | Scenario, Trade, SimulationResult |
| Compliance Models | TestSuite, TestResult, Threshold |
| User Models | User, Tenant, Role |
SDK Support¶
Official SDKs are available for common languages:
OpenAPI Specification¶
The complete OpenAPI 3.0 specification is available at:
- Interactive Docs:
https://api.calcbridge.io/docs - ReDoc:
https://api.calcbridge.io/redoc - OpenAPI JSON:
https://api.calcbridge.io/openapi.json
Changelog¶
v1.0.0 (Current)¶
- Initial stable release
- Authentication (JWT + API Key)
- Workbook management
- Formula evaluation
- What-if scenarios
- Compliance testing
- Report generation
- Alert management
Support¶
For API support, contact:
- Documentation Issues: GitHub Issues
- Technical Support: support@calcbridge.io
- Enterprise Support: enterprise@calcbridge.io