Generate ready TypeScript types from an OpenAPI spec
You have an OpenAPI spec for your API and you need TypeScript types for it. Right now. Without writing every route and every shape by hand, without missing a parameter, without forgetting that one paths field is optional.
Paste the YAML or JSON on the left, get a clean `paths` type (URL to method to request and response shapes) plus typed Schema components on the right. The generator follows \$ref pointers, walks every operationId, and emits a single self-contained `.ts` file you can drop into your project.
Three quick options: schemas only (skip the `paths` block when you only want the data shapes), JSDoc from descriptions (so your IDE shows the API docs on hover), and real `enum` declarations instead of string-literal unions when you prefer that style.
How to use it
- Paste your OpenAPI spec on the left. YAML or JSON, version 3.0 or 3.1. The default sample is the Petstore minimal spec so you can see the generator working right away.
- Pick a format: leave it on Auto and the tool detects YAML or JSON from the first character (`{` means JSON, anything else is YAML). Force one explicitly if your spec is unusual.
- Toggle "Schema components only" when you just want the data shapes (the `components.schemas` block) without the `paths` mapping. Useful when you write your own HTTP client by hand.
- Toggle "Add JSDoc from descriptions" to keep your `description` and `title` fields as JSDoc comments above each generated property. Your IDE will surface the API docs on hover.
- Toggle "Use enums instead of string unions" for fields with `enum: [available, pending, sold]`. With it on you get `enum Status { available, pending, sold }`. With it off you get `"available" | "pending" | "sold"` (the default, friendlier for tree-shaking).
- Click `Copy` to put the result on your clipboard or `Download` to save it as an `openapi.ts` file. Paste it into your project, import the `paths` and `components` types, done.
- Output regenerates automatically as you type (with a half-second pause). No need to click a build button.
When this is useful
Five concrete situations where this saves you hours of manual typing:
- Onboarding to an existing API. Backend team published an OpenAPI spec. Paste it here, get every request and response shape typed in seconds. Build a typed `fetch` wrapper around them and your IDE autocompletes every endpoint.
- Keeping types in sync with the backend. The spec is the contract. Re-run the tool whenever the backend ships a new endpoint, paste the new `openapi.ts` into your project, the TypeScript compiler flags every place that needs updating.
- Generating a typed SDK from a public API. Stripe, GitHub, Linear and most modern SaaS providers publish an OpenAPI spec. Drop it in here and you have a typed client in one minute, no `any` anywhere.
- Writing a test fixture from a real shape. You need a mock `Pet` for a test. Generate the types, hover the type in your editor, the IDE shows you every required field. No more guessing what the API actually returns.
- Migrating from Swagger 2.0 / OpenAPI 3.0 to 3.1. Both versions are supported. Paste the old spec, regenerate, compare the diff: now you can see exactly which fields gained `nullable` semantics or moved to a tagged union.
To test the actual endpoints once the types are in place, the HTTP request tester speaks every method, and the mock API generator can stand in for the real backend while you build the frontend.