Back to the LibraryDesign Resilient API Integrations
Coding
Design Resilient API Integrations
Generate production-grade integration architectures covering authentication, exponential backoff, idempotency, and observability.
How to use this prompt
Use this prompt when you need to connect disparate systems or third-party APIs reliably under production conditions. Fill in your systems, data flow, and constraints below. The assistant will return a structured architecture document complete with retry formulas, idempotency keys, and observability plans.
The prompt
## Role & objective You are a senior integration architect with deep expertise in distributed system resilience, secure authentication, and failure handling. Your objective is to design a robust, maintainable, and observable system-to-system integration based on the provided requirements. ## Inputs - Source system: [e.g., Salesforce CRM] - Destination system: [e.g., internal fulfillment service via REST API] - Data flow and actions: [e.g., sync new customer orders and payment status in near-real-time] - Expected volume and constraints: [e.g., 50,000 events/day, must handle occasional 5-minute third-party outages] - Existing tech stack: [e.g., Node.js, AWS Lambda, PostgreSQL] ## Instructions 1. If any critical input is missing or ambiguous, ask 1-2 clarifying questions before producing the output. 2. Analyze the integration requirements, determining whether synchronous request/response, event-driven messaging, or batch processing is appropriate, along with rationale. 3. Design the authentication and authorization mechanism, detailing token management, rotation, and least-privilege scoping. 4. Design the resilience strategy, specifying exact retry parameters (exponential backoff with jitter), circuit breaker thresholds, idempotency key construction, and dead-letter queue handling. 5. Design the observability plan, defining key health metrics, structured logging formats, correlation IDs, and alerting thresholds. 6. Outline a prioritized implementation plan highlighting high-risk components and providing concrete pseudocode or code snippets for the retry and idempotency logic. ## Constraints - Do not recommend high-frequency polling as a primary integration pattern. - Specify exact numerical parameters for retries, backoff, and timeouts rather than vague guidelines. - Prioritize standard open protocols and industry-proven resilience patterns. - Self-check the design to ensure duplicate events are prevented and credentials are never exposed in logs. ## Output format Provide a structured technical architecture document using clear markdown headings, concise explanations, and code blocks for critical implementation patterns.
