-
Notifications
You must be signed in to change notification settings - Fork 0
API Specifications
TMI provides comprehensive API specifications in multiple formats to support integration with various tools and clients.
The primary REST API is fully documented using OpenAPI 3.0.3.
-
File:
tmi-openapi.json(v1.0.0) - Location: tmi/docs/reference/apis/tmi-openapi.json
-
Format: JSON with
$refreferences - Includes: Complete request/response schemas, authentication, and examples
For tools that don't support $ref resolution, use resolved specifications with all references inlined:
- Resolved JSON - Self-contained JSON
- Resolved YAML - Self-contained YAML
-
Unresolved JSON - Modular with
$refpointers -
Unresolved YAML - Modular with
$refpointers
The OpenAPI specification documents all REST endpoints including:
- Threat Models - Create, read, update, delete threat models
- Diagrams - Manage data flow diagrams
- Threats - Identify and track threats
- Users - User management and authentication
- Authorization - Role-based access control
For detailed endpoint documentation:
- View the HTML documentation
- Open
tmi-openapi.jsonin Swagger Editor - Use the generated client SDKs below
The WebSocket collaboration protocol is documented using AsyncAPI.
-
File:
tmi-asyncapi.yml - Location: tmi/docs/reference/apis/tmi-asyncapi.yml
- Describes: Real-time diagram updates and collaborative editing via WebSocket
Pre-defined workflow patterns for common integration scenarios.
-
File:
api-workflows.json - Location: tmi/docs/reference/apis/api-workflows.json
- Includes: Workflows for threat model creation, diagram editing, threat identification, and more
Auto-generated client libraries for multiple programming languages (from OpenAPI spec):
- Go SDK - Go client library
- Java SDK - Java client with Maven support
- JavaScript SDK - JavaScript/Node.js client
- Python SDK - Python client with pip
Each SDK includes type-safe models, OAuth 2.0 authentication helpers, and usage examples.
All API endpoints require OAuth 2.0 authentication with JWT tokens.
See Setting-Up-Authentication and the Authorization Reference for details on:
- OAuth flow and token acquisition
- Role-based access control (owner, writer, reader)
- Permission resolution logic
- Pseudo-groups (e.g., "everyone")
TMI implements a comprehensive tiered rate limiting strategy with four tiers:
- Public Discovery - IP-based limits for metadata endpoints
- Auth Flows - Multi-scope limits (session, IP, user identifier) for OAuth/SAML
- Resource Operations - User-based configurable limits for API endpoints
- Webhooks - Database-backed quotas for webhook subscriptions
The OpenAPI specification includes x-rate-limit extensions documenting rate limits for all endpoints. See API-Rate-Limiting for:
- Detailed tier definitions and limits
- Multi-scope enforcement mechanisms
- Client integration best practices with code examples
- Database schema for configurable quotas
- Implementation roadmap and status
For practical guidance on using the APIs:
- API-Integration - Getting started with the API
- Client Integration Guide - Detailed integration patterns
- WebSocket Testing - Real-time collaboration testing
- Quick Reference: View the interactive HTML documentation
- Client Development: Use the appropriate SDK for your language
- Tool Integration: Import resolved specifications into tools like Postman, Insomnia, or API management platforms
- Validation: Validate requests/responses against the source specification
-
Source of Truth: Edit
tmi-openapi.json- never modify generated artifacts -
Validation: Run
make validate-openapibefore committing changes - Regeneration: After updates, regenerate specs via SwaggerHub
- Version Control: Commit both source and generated artifacts to track evolution
The current API version is 1.0.0. Breaking changes will increment the major version number.
- API-Workflows - Pre-built workflow patterns
- Configuration-Reference - API configuration options
- Security-Best-Practices - API security guidance
- Testing Guide
- Using TMI for Threat Modeling
- Accessing TMI
- Creating Your First Threat Model
- Understanding the User Interface
- Working with Data Flow Diagrams
- Managing Threats
- Collaborative Threat Modeling
- Using Notes and Documentation
- Metadata and Extensions
- Planning Your Deployment
- Deploying TMI Server
- Deploying TMI Web Application
- Setting Up Authentication
- Database Setup
- Component Integration
- Post-Deployment
- Monitoring and Health
- Database Operations
- Security Operations
- Performance and Scaling
- Maintenance Tasks