OpenAPI to TypeScript types
Turn an OpenAPI or Swagger document into TypeScript interfaces and types.
OpenAPI to TypeScript types
Paste an OpenAPI 3 or Swagger 2 document — JSON or YAML — and this tool generates matching TypeScript interfaces for every schema in components/schemas, plus one type per endpoint for its path and query parameters, request body and responses. It saves the step of hand-writing API types every time a spec changes, and keeps the client in sync with what the server actually returns.
The options control the shape of the output. Choose interface or type declarations, and decide how nullable fields are represented: as an optional property (x?: string) or as a union with null (x: string | null). $ref references can either stay as named types pointing at the matching interface, or be expanded inline wherever they're used. Turn off "generate path, parameter and response types" to get only the component schemas, or turn on a status-code union to see every response code an endpoint can return as a single type. Descriptions from the spec become JSDoc comments above each field, and a name prefix keeps generated types from colliding with your own when you paste them into a larger codebase.
The parser reads standard OpenAPI constructs — object and array schemas, enums, oneOf/anyOf/allOf, nullable, additionalProperties — and follows local $ref pointers within the same document. Endpoints marked deprecated can be skipped entirely, and a document that doesn't look like OpenAPI (no components/schemas or paths section) produces a clear error instead of a blank output.
Everything runs locally in your browser — your API specification, which may describe an unreleased product or an internal system, is never uploaded anywhere. Copy the generated types, download them as a .txt file to paste into a .ts file, or send the output straight back to the input to keep refining it.