Integration Contracts - Audit Trail Platform (ATP)¶
Contracts as code — ATP's integration contracts define precise, versioned, and testable interfaces for REST APIs, async messaging, webhooks, and SDK integration with contract-first development and automated validation.
📋 Documentation Generation Plan¶
This document will be generated in 4 cycles. Current progress:
| Cycle | Topics | Estimated Lines | Status |
|---|---|---|---|
| Cycle 1 | Contract-First Development & Overview (1-2) | ~2,000 | ⏳ Not Started |
| Cycle 2 | Contract Types & API Design (3-4) | ~2,500 | ⏳ Not Started |
| Cycle 3 | Contract Testing & Versioning (5-6) | ~2,000 | ⏳ Not Started |
| Cycle 4 | Contract Governance & Best Practices (7-8) | ~1,500 | ⏳ Not Started |
Total Estimated Lines: ~8,000
Purpose & Scope¶
This document serves as the navigation hub and overview for all integration contracts in the Audit Trail Platform (ATP), introducing contract-first development principles, explaining contract types (REST, messages, webhooks), and providing guided navigation to detailed contract specifications based on integration needs.
Key Contract Principles - Contract-First Development: Contracts defined before implementation - Versioned Contracts: All contracts versioned with semantic versioning - Backward Compatibility: Breaking changes avoided; managed through versions - Automated Validation: Contract tests run in CI/CD pipelines - Published Specifications: OpenAPI for REST, AsyncAPI for messaging, JSON Schema for webhooks - Consumer-Driven: Contracts consider consumer needs and use cases - Technology-Agnostic: Contracts independent of implementation technology
What this document covers
- Introduce ATP's contract-first philosophy: Why contracts matter, benefits for ATP
- Explain contract types: REST APIs, Message Schemas, Webhooks, SDK contracts
- Provide navigation to contract specifications: Links organized by integration type
- Define contract versioning strategy: Semantic versioning, compatibility rules, deprecation
- Describe contract testing: Producer tests, consumer tests, contract validation
- Outline contract governance: Who owns contracts, approval process, change management
- Document shared contracts: Idempotency, correlation, tenancy, error handling
- Specify contract evolution: Adding, changing, deprecating contracts safely
Out of scope (covered in linked documents)
- Detailed REST API specifications (see rest-apis.md)
- Complete message schemas (see message-schemas.md)
- Webhook specifications (see webhooks.md)
- Idempotency patterns (see shared/idempotency.md)
- Domain model details (see ../aggregates-entities.md)
- Implementation patterns (see ../../implementation/)
Readers & ownership
- Integration Engineers (owners): Contract design, specification, testing, evolution
- Backend Developers: API implementation, message handling, contract validation
- Frontend Developers: REST API consumption, SDK usage
- Partner Engineers: External system integration, webhook handling
- QA/Test Engineers: Contract testing, validation, compatibility testing
- Architects: Contract design patterns, versioning strategy, governance
Artifacts produced
- Contract Index: This document - navigation hub for all contracts
- OpenAPI Specifications: REST API contracts (ingestion, query, policy, export)
- AsyncAPI Specifications: Message contracts for domain and integration events
- Webhook Specifications: JSON Schema for webhook payloads and callbacks
- SDK Documentation: C# and JavaScript SDK usage with examples
- Contract Tests: Automated tests for all producer/consumer contracts
- Versioning Guide: Compatibility rules and migration procedures
- Contract Changelog: History of contract changes per version
- Integration Examples: Sample code for common integration scenarios
- Contract Validation Pipeline: CI/CD integration for automated validation
Acceptance (done when)
- Contract types are explained with examples of when to use each
- Navigation to specifications is clear and organized by integration pattern
- Versioning strategy is documented with compatibility rules and examples
- Contract testing approach is explained with examples and CI/CD integration
- Governance process is documented for contract changes and approvals
- Shared contracts are documented (idempotency, correlation, errors)
- Evolution guide explains how to add, change, and deprecate contracts
- Quick reference enables fast navigation to specific contracts
- Integration examples show end-to-end usage of contracts
- Documentation complete with diagrams, code examples, and cross-references
Detailed Cycle Plan¶
CYCLE 1: Contract-First Development & Overview (~2,000 lines)¶
Topic 1: Contract-First Development Philosophy¶
What will be covered:
- What is Contract-First Development?
- Define contracts before implementation
- Contracts are executable specifications
- Implementation must satisfy contract
- Tests validate contract compliance
-
Benefits: parallel development, clear interfaces, fewer integration bugs
-
Why Contract-First for ATP?
- Multiple teams integrating with ATP (producers and consumers)
- External partners need stable interfaces
- Compliance requires documented, versioned contracts
- Parallel development of services
-
Early validation of integration patterns
-
Contract-First vs Code-First
- Contract-First: Contract → Implementation → Validation
- Code-First: Implementation → Generated Contract → Hope it works
- Trade-offs and when to use each
-
ATP's approach: Contract-first for external, code-first internal
-
ATP Contract Philosophy
- Consumer-Driven: Design for consumer needs
- Backward Compatible: Never break existing consumers
- Versioned: All contracts have explicit versions
- Testable: Automated contract validation
- Documented: Self-documenting (OpenAPI, AsyncAPI, JSON Schema)
-
Published: Contracts available before implementation
-
Contract Development Workflow
- Define contract (OpenAPI, AsyncAPI, JSON Schema)
- Review with consumers and producers
- Validate contract (linting, policy checks)
- Generate code stubs (optional)
- Implement against contract
- Validate implementation matches contract
- Publish contract to registry
-
Monitor contract usage and compatibility
-
Contract Validation
- Syntax validation (YAML/JSON linting)
- Schema validation (OpenAPI Spec, AsyncAPI Spec)
- Breaking change detection
- Policy compliance (naming conventions, security)
-
Contract tests (producer and consumer)
-
Contract Registry
- Centralized storage for all contracts
- Version history and changelog
- Contract discovery and search
- Dependency tracking (who uses which contracts)
- Deprecation notices
Code Examples: - OpenAPI contract example - AsyncAPI contract example - JSON Schema webhook contract - Contract validation in CI pipeline - Contract test example
Diagrams: - Contract-first workflow - Contract development lifecycle - Contract validation flow - Contract registry architecture
Deliverables: - Contract-first development guide - Validation framework - Contract registry setup - CI/CD integration templates
Topic 2: ATP Contracts Overview¶
What will be covered:
- Contract Categories in ATP
1. REST API Contracts - Synchronous HTTP APIs - OpenAPI 3.0 specifications - Request/response schemas - Authentication and authorization - Error responses
2. Message Contracts (Async) - Domain events (within bounded contexts) - Integration events (across contexts) - AsyncAPI specifications - Message routing and filtering - Schema registry integration
3. Webhook Contracts - Outbound notifications - JSON Schema definitions - Webhook security (signatures) - Retry and delivery guarantees
4. SDK Contracts - C# SDK for producers - JavaScript SDK for frontend - SDK versioning and compatibility - SDK documentation and examples
5. Shared Contracts - Idempotency patterns - Correlation ID propagation - Tenant context headers - Error response formats - Rate limiting contracts
-
Contract Landscape in ATP
Contracts ├── REST APIs │ ├── Ingestion API (POST /audit-events) │ ├── Query API (GET /audit-events) │ ├── Policy API (CRUD policies) │ └── Export API (POST /exports) ├── Message Contracts │ ├── Domain Events (50+ events) │ ├── Integration Events (20+ events) │ └── Command Messages (if used) ├── Webhooks │ ├── Event Notifications │ ├── Export Completion │ └── Policy Violations ├── SDKs │ ├── C# SDK (NuGet) │ ├── JavaScript SDK (npm) │ └── Python SDK (pip) - future └── Shared Contracts ├── Idempotency Headers ├── Correlation Context ├── Error Responses └── Rate Limit Headers -
Integration Patterns
- Synchronous: REST APIs for commands and queries
- Asynchronous: Messages for events and background processing
- Push Notifications: Webhooks for real-time updates
-
SDK Integration: Libraries for language-specific convenience
-
Contract Ownership Model
- Ingestion Context: Owns ingestion API and AuditEventReceived event
- Query Context: Owns query API and projection events
- Policy Context: Owns policy API and policy events
- Export Context: Owns export API and export events
-
Shared: Platform team owns shared contracts
-
Contract Dependencies
- REST APIs depend on domain model (DTOs from aggregates)
- Messages depend on domain events
- Webhooks depend on integration events
- SDKs depend on REST APIs and message contracts
- Shared contracts used by all
Code Examples: - Contract namespace organization - OpenAPI specification structure - AsyncAPI specification structure - JSON Schema webhook example - SDK usage example
Diagrams: - Contract landscape architecture - Integration patterns overview - Contract ownership map - Contract dependencies
Deliverables: - Contracts overview guide - Contract categorization - Ownership model - Dependency matrix
CYCLE 2: Contract Types & API Design (~2,500 lines)¶
Topic 3: REST API Contracts Overview¶
What will be covered:
- ATP REST APIs Catalog
Ingestion API
- POST /api/v1/audit-events - Ingest single event
- POST /api/v1/audit-events/batch - Batch ingestion
- GET /api/v1/health - Health check
- OpenAPI: rest-apis.md#ingestion-api
Query API
- GET /api/v1/audit-events - List events with filters
- GET /api/v1/audit-events/{id} - Get event by ID
- POST /api/v1/audit-events/search - Advanced search
- GET /api/v1/event-streams/{id} - Get event stream
- OpenAPI: rest-apis.md#query-api
Policy API
- POST /api/v1/policies - Create policy
- GET /api/v1/policies - List policies
- PUT /api/v1/policies/{id} - Update policy
- DELETE /api/v1/policies/{id} - Delete policy
- OpenAPI: rest-apis.md#policy-api
Export API
- POST /api/v1/exports - Request export
- GET /api/v1/exports/{id} - Get export status
- GET /api/v1/exports/{id}/download - Download export
- OpenAPI: rest-apis.md#export-api
- RESTful Design Principles
- Resource-oriented URLs
- HTTP verbs semantics (GET, POST, PUT, DELETE)
- Status codes (200, 201, 400, 401, 404, 500)
-
HATEOAS (optional, for discoverability)
-
Request/Response Patterns
- Request headers (correlation, tenant, idempotency)
- Request body (JSON, validation)
- Response headers (rate limiting, pagination)
- Response body (data, metadata, links)
-
Error responses (standard format)
-
Authentication & Authorization
- Bearer token (OAuth 2.0, Azure AD)
- API key (for service-to-service)
- Tenant context resolution
-
RBAC enforcement
-
Pagination & Filtering
- Pagination (offset/limit or cursor-based)
- Filtering (query parameters)
- Sorting (orderBy parameter)
-
Field selection (fields parameter)
-
Rate Limiting
- Per-tenant rate limits
- Rate limit headers (X-RateLimit-*)
- 429 Too Many Requests response
- Retry-After header
Code Examples: - OpenAPI specification excerpt - Request/response examples (cURL) - Authentication header examples - Error response examples
Diagrams: - REST API architecture - Request/response flow - Authentication flow - Rate limiting mechanism
Deliverables: - REST API overview - API design guidelines - OpenAPI spec templates - Authentication guide
Topic 4: Message Contracts Overview¶
What will be covered:
- ATP Message Catalog
Domain Events (Internal to Bounded Contexts) - Ingestion: AuditEventReceived, ValidationFailed - Storage: EventStreamCreated, EventStreamSealed - Classification: EventClassified, PIIDetected - Full catalog: message-schemas.md#domain-events
Integration Events (Cross-Context Communication) - Tenant: TenantOnboarded, TenantSuspended - Export: ExportRequested, ExportCompleted - Integrity: HashChainValidated, SignatureVerified - Full catalog: message-schemas.md#integration-events
Command Messages (If Used) - IngestAuditEvent, CreateExport, ApplyPolicy - Command vs Event distinction - Command routing and handling
- Messaging Patterns
- Publish/Subscribe: Broadcast to multiple consumers
- Point-to-Point: Single consumer per message
- Request/Reply: Synchronous-like over async (rare in ATP)
-
Event Streaming: Continuous event flow
-
Message Structure
- Envelope: Metadata (EventId, Timestamp, TenantId, CorrelationId)
- Payload: Business data specific to event type
-
Headers: Routing, filtering, security metadata
-
Message Routing
- Azure Service Bus topics and subscriptions
- Routing rules (content-based, topic-based)
- Message filtering
-
Fan-out patterns
-
Message Schema Formats
- JSON: Primary format (human-readable)
- Protocol Buffers: Alternative (compact, typed)
- Apache Avro: Alternative (schema evolution)
-
Format selection criteria
-
Schema Registry Integration
- Centralized schema storage
- Schema validation at publish/consume
- Schema evolution tracking
- Schema compatibility checking
Code Examples: - AsyncAPI specification excerpt - Message envelope structure - Domain event class (C#) - Integration event class (C#) - Service Bus configuration
Diagrams: - Message architecture - Pub/sub pattern - Message routing - Schema registry flow
Deliverables: - Message contracts overview - AsyncAPI spec templates - Message routing guide - Schema registry setup
CYCLE 3: Contract Testing & Versioning (~2,000 lines)¶
Topic 5: Contract Testing¶
What will be covered:
- What is Contract Testing?
- Verify producer and consumer agree on contract
- Test contracts independently of full integration
- Prevent breaking changes from reaching production
-
Faster feedback than end-to-end tests
-
Producer Contract Tests
- Producer generates messages matching contract
- Validate response schemas match OpenAPI
- Validate message schemas match AsyncAPI
-
Run in producer's CI pipeline
-
Consumer Contract Tests
- Consumer can handle messages per contract
- Consumer expects specific contract version
- Run in consumer's CI pipeline
-
Pact framework for consumer-driven contracts
-
Contract Compatibility Testing
- Backward compatibility validation
- Forward compatibility validation
- Breaking change detection
-
Cross-version testing
-
REST API Contract Tests
- Request validation (body, headers, parameters)
- Response validation (status, body, headers)
- Error response validation
-
Authentication and authorization testing
-
Message Contract Tests
- Event schema validation (JSON Schema)
- Message envelope validation
- Required vs optional fields
-
Data type validation
-
Webhook Contract Tests
- Webhook payload validation
- Signature verification
- Retry behavior testing
-
Callback response validation
-
Contract Test Automation
- Tests run in CI/CD pipeline
- Tests block deployment on failure
- Test results published
-
Contract coverage metrics
-
Tools and Frameworks
- Pact (consumer-driven contracts)
- Spring Cloud Contract (JVM)
- Postman/Newman (API testing)
- JSON Schema validators
- Custom test frameworks
Code Examples: - Producer contract test (C#, xUnit) - Consumer contract test (Pact) - REST API contract test (Postman) - Message contract test (JSON Schema) - CI pipeline with contract tests
Diagrams: - Contract testing flow - Producer/consumer test interaction - Pact broker architecture - CI/CD integration
Deliverables: - Contract testing guide - Test framework setup - Pact integration - CI/CD templates
Topic 6: Contract Versioning & Evolution¶
What will be covered:
- Why Contract Versioning Matters
- Multiple versions in production simultaneously
- Consumer migration takes time
- Zero-downtime upgrades required
-
Backward compatibility essential
-
Semantic Versioning for Contracts
MAJOR.MINOR.PATCHfor contract versions- MAJOR: Breaking changes (incompatible)
- MINOR: New features (backward compatible)
-
PATCH: Bug fixes, clarifications
-
REST API Versioning Strategies
- URI Versioning:
/api/v1/,/api/v2/(ATP approach) - Header Versioning:
Accept: application/vnd.atp.v1+json - Query Parameter:
?version=1(not recommended) -
ATP uses URI versioning for clarity
-
Message Versioning Strategies
- Event Name Versioning: AuditEventReceivedV2
- Schema Version Field:
schemaVersion: "2.0" - Content Negotiation: Consumer specifies accepted versions
-
ATP uses schema version field
-
Compatibility Rules
- Backward Compatible Changes (safe):
- Add optional fields
- Add new endpoints
- Add new event types
- Relax validation rules
- Forward Compatible Changes (safe):
- Remove optional fields (if consumers ignore unknown)
- Deprecate endpoints (with notice)
-
Breaking Changes (requires new version):
- Remove required fields
- Change field types
- Rename fields
- Add required fields
- Tighten validation rules
-
Deprecation Process
- Announce deprecation (minimum 6 months notice)
- Mark as deprecated in contract (OpenAPI
deprecated: true) - Provide migration guide
- Monitor usage of deprecated contracts
-
Remove after sunset date
-
Contract Migration
- Dual Publishing: Support v1 and v2 simultaneously
- Adapter Pattern: Transform v1 to v2 internally
- Consumer Migration: Gradual migration of consumers
-
Sunset Timeline: Remove old version after all migrated
-
Version Compatibility Matrix
- Which producer versions work with which consumer versions
- API version to message version mapping
- SDK version compatibility
- Support matrix (which versions are supported)
Code Examples: - Versioned API endpoints - Versioned message schemas - Deprecation annotations (OpenAPI) - Migration code examples - Compatibility test cases
Diagrams: - Versioning strategy - Deprecation timeline - Migration workflow - Compatibility matrix
Deliverables: - Versioning strategy guide - Compatibility rules - Deprecation process - Migration playbooks
CYCLE 4: Contract Governance & Best Practices (~1,500 lines)¶
Topic 7: Contract Governance¶
What will be covered:
- Contract Ownership
- Each context owns its contracts
- Shared contracts owned by platform team
-
Clear ownership in contract metadata
-
Contract Change Process
- Proposal (describe change and rationale)
- Impact analysis (who's affected?)
- Contract review (architects, affected teams)
- Breaking change approval (if needed)
- Implementation
- Contract tests updated
- Documentation updated
-
Publication and notification
-
Contract Review Guidelines
- Naming conventions compliance
- Schema design best practices
- Backward compatibility check
- Security review (sensitive data, authorization)
-
Performance impact assessment
-
Contract Approval Workflow
- Non-breaking changes: Team lead approval
- Breaking changes: Architecture review + affected teams approval
-
Shared contracts: Platform team + all consumers approval
-
Contract Documentation Requirements
- Description of contract purpose
- Usage examples (requests, responses, events)
- Error scenarios and handling
- Authentication and authorization
- Rate limiting and quotas
-
Versioning and deprecation info
-
Contract Registry Governance
- Who can publish contracts
- Version immutability (published = locked)
- Deprecation authority
-
Sunset enforcement
-
Compliance and Security Review
- Data classification (what sensitivity data in contract)
- GDPR compliance (personal data handling)
- HIPAA compliance (PHI handling)
- Security scanning (credential exposure, injection risks)
Code Examples: - Contract metadata (ownership, version) - Approval workflow (Azure DevOps) - Review checklist - Compliance annotations
Diagrams: - Contract change workflow - Approval process - Governance model - Review criteria
Deliverables: - Governance process guide - Review checklists - Approval templates - Compliance review procedures
Topic 8: Contract Best Practices¶
What will be covered:
- REST API Design Best Practices
- Resource naming (plural nouns)
- HTTP verb usage (GET, POST, PUT, DELETE, PATCH)
- Status code selection (2xx, 4xx, 5xx)
- Pagination patterns (limit/offset or cursor)
- Error response structure (consistent format)
-
Security (authentication, authorization, input validation)
-
Message Design Best Practices
- Event naming (past tense, specific)
- Event size (keep < 64KB for Service Bus)
- Event granularity (one business fact per event)
- Event enrichment vs minimal payload
-
Ordering and causation (CausationId)
-
Webhook Design Best Practices
- Retry logic (exponential backoff)
- Signature verification (HMAC)
- Timeout configuration
- Delivery confirmation
-
Error handling
-
Schema Design Best Practices
- Use JSON Schema for validation
- Required vs optional fields (minimize required)
- Data types (string, number, boolean, object, array)
- Enums for fixed values
- Format annotations (date-time, email, uri)
-
Examples in schema
-
Versioning Best Practices
- Start with v1, not v0
- Avoid breaking changes
- Use optional fields for extensions
- Deprecate gracefully (6+ months notice)
-
Document all changes
-
Documentation Best Practices
- Self-documenting contracts (OpenAPI, AsyncAPI)
- Comprehensive descriptions
- Usage examples for all endpoints/events
- Error scenario documentation
-
Authentication instructions
-
Testing Best Practices
- Contract tests for all contracts
- Backward compatibility tests
- Breaking change detection automated
-
Consumer-driven contract tests (Pact)
-
Security Best Practices
- Never expose credentials in contracts
- Validate all inputs
- Sanitize outputs (no PII leakage)
- Rate limiting on all APIs
-
Audit all contract usage
-
Performance Best Practices
- Pagination for large result sets
- Filtering server-side, not client-side
- Caching headers (ETag, Cache-Control)
- Compression (gzip, br)
-
Async for long-running operations
-
Common Anti-Patterns to Avoid
- Exposing internal IDs in public APIs
- Versioning in query parameters
- Overly large payloads
- Mutable events
- Undocumented breaking changes
- No versioning strategy
- Missing error handling
- Inconsistent naming conventions
Code Examples: - Best practice examples (good vs bad) - API design patterns - Message design patterns - Security patterns - Performance optimizations
Diagrams: - Best practices checklist - Anti-patterns to avoid - Design decision trees
Deliverables: - Best practices catalog - Anti-patterns guide - Design guidelines - Security checklist
Contract Documentation Index¶
REST API Contracts¶
→ REST APIs Specification - Complete OpenAPI specs for all HTTP endpoints
- Ingestion API (event publishing)
- Query API (event retrieval and search)
- Policy API (policy management)
- Export API (eDiscovery and compliance)
Message Contracts¶
→ Message Schemas - AsyncAPI specs for all events
- Domain Events (50+ events)
- Integration Events (20+ events)
- Command Messages (if applicable)
- Event envelope structure
Webhook Contracts¶
→ Webhooks Specification - Outbound notification contracts
- Event notification webhooks
- Export completion webhooks
- Policy violation webhooks
- Webhook security and retry
Shared Contracts¶
→ Idempotency Contracts - Idempotency patterns
- Idempotency-Key header
- Deduplication strategies
- Idempotency in REST and messaging
Integration Scenarios¶
Scenario 1: Producing Audit Events¶
Use Case: Microservice wants to emit audit events to ATP
Contracts Needed:
1. REST API: POST /api/v1/audit-events
2. SDK: C# SDK IAuditEventPublisher
3. Shared: Idempotency-Key header
4. Shared: Correlation-Id header
Documentation:
→ REST APIs: Ingestion
→ SDK Usage
→ Idempotency
Scenario 2: Querying Audit Events¶
Use Case: Application needs to search audit events
Contracts Needed:
1. REST API: GET /api/v1/audit-events (list/filter)
2. REST API: POST /api/v1/audit-events/search (advanced search)
3. Shared: Pagination contracts
4. Shared: Filtering contracts
Documentation:
→ REST APIs: Query
→ Query Examples
Scenario 3: Receiving Event Notifications¶
Use Case: External system wants real-time notifications
Contracts Needed: 1. Webhook: Event notification webhook 2. Shared: Webhook signature verification 3. Message: Integration event schemas
Documentation:
→ Webhooks
→ Message Schemas: Integration Events
Scenario 4: Exporting for eDiscovery¶
Use Case: Legal team needs export for compliance
Contracts Needed:
1. REST API: POST /api/v1/exports (request export)
2. REST API: GET /api/v1/exports/{id} (check status)
3. Webhook: Export completion notification
4. Message: ExportCompleted event
Documentation:
→ REST APIs: Export
→ Webhooks: Export Completion
→ Export Guide
Contract Quick Reference¶
REST API Endpoints Summary¶
| Endpoint | Method | Purpose | Auth | Rate Limit |
|---|---|---|---|---|
/api/v1/audit-events |
POST | Ingest event | Bearer | 1000/min |
/api/v1/audit-events |
GET | List events | Bearer | 100/min |
/api/v1/audit-events/search |
POST | Search events | Bearer | 50/min |
/api/v1/audit-events/{id} |
GET | Get by ID | Bearer | 100/min |
/api/v1/event-streams/{id} |
GET | Get stream | Bearer | 100/min |
/api/v1/policies |
POST | Create policy | Bearer | 10/min |
/api/v1/policies |
GET | List policies | Bearer | 50/min |
/api/v1/exports |
POST | Request export | Bearer | 5/min |
/api/v1/exports/{id} |
GET | Export status | Bearer | 20/min |
Full specs: rest-apis.md
Domain Events Summary¶
| Event | Producer | Consumers | Purpose |
|---|---|---|---|
| AuditEventReceived | Ingestion | Storage, Classification | Event ingested |
| EventStreamCreated | Storage | Query, Integrity | Stream started |
| EventStreamSealed | Storage | Integrity, Export | Stream finalized |
| EventClassified | Classification | Query, Retention | Classification applied |
| RetentionApplied | Retention | Query | Retention set |
| TenantOnboarded | Tenant | All Contexts | New tenant |
| ExportCompleted | Export | Webhook, SIEM | Export ready |
Full catalog: events-catalog.md
Integration Events Summary¶
| Event | Producer Context | Consumer Context(s) | Purpose |
|---|---|---|---|
| TenantOnboarded | Policy | All | New tenant setup |
| ExportRequested | Export | Storage, Query | Start export |
| IntegrityVerified | Integrity | Query, Export | Verification passed |
Full schemas: message-schemas.md
Contract Standards¶
Shared Headers (All Contracts)¶
| Header | Required | Description | Example |
|---|---|---|---|
X-Tenant-Id |
Yes | Tenant context | tenant-abc-123 |
X-Correlation-Id |
Yes | Request correlation | corr-abc-123-def-456 |
Idempotency-Key |
For writes | Duplicate detection | idem-xyz-789 |
Authorization |
Yes | Bearer token | Bearer eyJ0eXAi... |
Content-Type |
Yes | Media type | application/json |
User-Agent |
Recommended | Client identification | ATP-SDK/1.2.3 |
Details: shared/idempotency.md
Error Response Format (All REST APIs)¶
{
"error": {
"code": "VALIDATION_FAILED",
"message": "The request contains invalid data",
"details": [
{
"field": "timestamp",
"issue": "Timestamp cannot be in the future",
"value": "2025-01-01T00:00:00Z"
}
],
"traceId": "00-abc123...-def456...-01",
"timestamp": "2024-10-30T10:30:00Z"
}
}
Specification: rest-apis.md#error-responses
Summary & Implementation Plan¶
Implementation Phases¶
Phase 1: Foundation (Cycle 1) - 1 week - Contract-first philosophy - Contracts overview
Phase 2: Specifications (Cycle 2) - 1 week - REST API and message contract overviews
Phase 3: Validation (Cycle 3) - 1 week - Contract testing and versioning
Phase 4: Governance (Cycle 4) - 1 week - Contract governance and best practices
Success Metrics¶
- Navigation Speed: Find relevant contract in < 30 seconds
- Integration Time: New integrations complete in < 1 day using contracts
- Breaking Changes: Zero unplanned breaking changes
- Contract Coverage: 100% of APIs/events have contracts
- Test Coverage: 100% of contracts have automated tests
- Documentation: 100% of contracts documented with examples
Ownership & Maintenance¶
- Integration Engineers: Cycles 1-2, contract design
- QA Engineers: Cycle 3, contract testing
- Architects: Cycle 4, governance and standards
- All Teams: Contract usage and feedback
Related Documentation¶
Domain Model¶
→ Domain Overview - Domain layer introduction
→ Ubiquitous Language - Shared vocabulary
→ Aggregates & Entities - Domain model
→ Events Catalog - All events
Implementation¶
→ Messaging Implementation - Event bus
→ Outbox/Inbox Pattern - Reliable messaging
→ Persistence - Data access
Integration Guides¶
→ Producing Audit Events - How to publish events
→ Querying Audit Logs - How to query events
→ Export and eDiscovery - How to export
SDK Documentation¶
→ C# SDK - .NET integration
→ JavaScript SDK - Frontend integration
→ SDK Examples - Sample code
Document Status: ✅ Plan Approved - Ready for Content Generation
Target Start Date: Q2 2025
Expected Completion: Q2 2025 (1 month)
Owner: Integration Engineering Team
Last Updated: 2024-10-30