OpenAPI Client Generator
Generate a typed TypeScript API client from an OpenAPI/Swagger spec — fetch or axios with interfaces for every endpoint
About this tool
An OpenAPI specification describes every endpoint in your API — paths, HTTP methods, parameters, request bodies, and response schemas. Instead of hand-writing fetch calls and TypeScript interfaces, paste the spec here and get a complete typed client that mirrors the API contract.
The generator produces one async function per endpoint, each typed end-to-end: path and query parameters become typed function arguments, JSON request bodies are typed from the spec's requestBody schema, and the return type is derived from the 200/201 response. Every function throws an ApiError with the HTTP status and error body on non-2xx responses.
Example: a GET /pets/{petId} endpoint becomes async function getPet(petId: string): Promise<Pet> — call it, and TypeScript knows exactly what you get back. The Pet interface, along with every other schema from components/schemas, is generated alongside the client.
Switch between fetch (zero dependencies) and axios (with interceptors and configurable base client). Toggle Export types to include or hide the generated interfaces. Use setBaseUrl() to point the client at your staging or production server.
FAQ
Does this tool actually call the API? ›
No. It only generates code from the spec — nothing is sent anywhere. The generated client is ready to paste into your project, and you call the endpoints from your own code.
Which OpenAPI versions are supported? ›
OpenAPI 3.0 and 3.1 specs are supported, in JSON or YAML format. Swagger 2.0 specs will also work for most endpoints, though some OpenAPI 3.x features (like oneOf/anyOf) are 3.x-only.
How are error responses handled? ›
Every generated function checks the HTTP status. On non-2xx responses it throws an <code>ApiError</code> with the status code and the parsed error body (typed from the 4xx/5xx/default response schema). Wrap calls in try/catch and inspect the error.
What about authentication? ›
The generated client does not include auth — add it yourself by setting an <code>Authorization</code> header. With fetch, attach it to the <code>headers</code> object; with axios, use an interceptor or <code>configureClient()</code> to set a base config with auth headers.
How does this compare to the HTTP Request Builder? ›
The HTTP Request Builder generates code for a single request that you configure manually (like curl → fetch). This tool reads your entire OpenAPI spec and generates a complete typed client for every endpoint at once — the whole API surface, not one call.
What happens with $ref references? ›
<code>$ref</code> pointers (like <code>#/components/schemas/Pet</code>) are resolved inline before code generation. Circular references are detected and replaced with a generic object type to avoid infinite recursion.