Back to guide/Developer Tools

API Integration Scaffold

Copilot Chat generates more accurate API clients when it knows the auth method, base URL, and specific endpoints upfront. Specifying typed errors and retry logic avoids the most common follow-up edits developers make to generated API code.

copilot-promptsapiNamefilePathbaseUrl
Edit View
Prompt
Create a typed API client for the {{apiName}} API in #file:{{filePath}}.

Requirements:
- Base URL: {{baseUrl}}
- Auth: {{authMethod}} ({{authDetails}})
- Endpoints to implement: {{endpoints}}
- Use fetch with proper error handling (throw typed errors)
- Add request/response TypeScript interfaces for each endpoint
- Include retry logic with exponential backoff (max {{maxRetries}} retries)
- Add JSDoc with example usage for each method

Variables to customize

{{apiName}}{{filePath}}{{baseUrl}}{{authMethod}}{{authDetails}}{{endpoints}}{{maxRetries}}

Why this prompt works

Copilot Chat generates more accurate API clients when it knows the auth method, base URL, and specific endpoints upfront. Specifying typed errors and retry logic avoids the most common follow-up edits developers make to generated API code.

Save this prompt to your library

Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.