BACK TO TEMPLATES
promptany

Type-Safe API Client Generator Prompt

Prompt for generating strongly typed HTTP API clients with error handling, retries, and rate limiting.

When to use this

Use this prompt to generate type-safe HTTP client functions from OpenAPI specs or JSON endpoints.

The template

Generate a type-safe API client wrapper in `[TypeScript / Python / Rust / Go]` for the endpoint schema below.

Requirements:
1. Define strict type interfaces for Request Body, Path Parameters, Query Parameters, and Response Payloads.
2. Include automatic exponential backoff retries for transient HTTP errors (`429`, `502`, `503`, `504`).
3. Parse and throw custom typed error classes containing status codes and response error messages.
4. Support abort signals or context cancellation for request timeouts.

Endpoint Specification:
```json
[PASTE JSON ENDPOINT SPECIFICATION OR OPENAPI SNIPPET HERE]
```

How to use

Fill in your language choice and endpoint JSON schema.

Last verified 2026-07-26