# swagger-typescript-api

> Generate the API client for Fetch or Axios from an OpenAPI Specification

Latest version **13.13.0** (published 2026-09-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install swagger-typescript-api
pnpm add swagger-typescript-api
yarn add swagger-typescript-api
bun add swagger-typescript-api
```

Provides the command `swagger-typescript-api`.

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 13.13.0 |
| Published | 2026-09-18 |
| First published | 2020-01-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20 |
| Dependencies | 17 |
| Unpacked size | 1.3 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 4120 |
| Author | Sergey Volkov |
| Maintainers | acacode, smorimoto |

## Links

- npm: https://www.npmjs.com/package/swagger-typescript-api
- Repository: https://github.com/acacode/swagger-typescript-api
- Issues: https://github.com/acacode/swagger-typescript-api/issues
- npm.io page: https://npm.io/package/swagger-typescript-api

## Dependencies (17)

- [c12](https://npm.io/package/c12.md) ^3.3.4
- [eta](https://npm.io/package/eta.md) ^3.5.0
- [yaml](https://npm.io/package/yaml.md) ^2.9.0
- [citty](https://npm.io/package/citty.md) ^0.2.2
- [nanoid](https://npm.io/package/nanoid.md) ^5.1.16
- [consola](https://npm.io/package/consola.md) ^3.4.2
- [yummies](https://npm.io/package/yummies.md) 7.20.1
- [type-fest](https://npm.io/package/type-fest.md) ^5.7.0
- [es-toolkit](https://npm.io/package/es-toolkit.md) ^1.49.0
- [typescript](https://npm.io/package/typescript.md) ^6.0.3
- [openapi-types](https://npm.io/package/openapi-types.md) ^12.1.3
- [@biomejs/js-api](https://npm.io/package/@biomejs/js-api.md) 6.0.0
- [swagger2openapi](https://npm.io/package/swagger2openapi.md) ^7.0.8
- [@biomejs/wasm-nodejs](https://npm.io/package/@biomejs/wasm-nodejs.md) 2.5.2
- [swagger-schema-official](https://npm.io/package/swagger-schema-official.md) 2.0.0-bab6bed
- [@apidevtools/swagger-parser](https://npm.io/package/@apidevtools/swagger-parser.md) 12.1.0
- [@types/swagger-schema-official](https://npm.io/package/@types/swagger-schema-official.md) ^2.0.25

## Recent versions

- 13.13.0 (latest) — 2026-09-18
- 13.12.6 — 2026-07-17
- 13.12.5 — 2026-07-14
- 13.12.4 — 2026-07-02
- 13.12.3 — 2026-06-24
- 13.12.2 — 2026-06-08
- 13.12.1 — 2026-06-04
- 13.12.0 — 2026-05-28
- 13.11.2 — 2026-05-28
- 13.11.1 — 2026-05-28
- 13.11.0 — 2026-05-28
- 13.10.0 — 2026-05-21
- 13.9.3 — 2026-05-19
- 13.9.2 — 2026-05-15
- 13.9.1 — 2026-05-08
- … 186 more at https://npm.io/package/swagger-typescript-api/versions

## README

# Swagger TypeScript API

- Support for OpenAPI 3.0, 2.0, JSON and YAML
- Generate the API Client for Fetch or Axios from an OpenAPI Specification

Any questions you can ask here: <https://github.com/acacode/swagger-typescript-api/discussions>

## Examples

All examples you can find here: <https://github.com/acacode/swagger-typescript-api/tree/main/tests>

## Usage

You can use this package in two ways:

### CLI

```bash
npx swagger-typescript-api generate --path ./swagger.json
```

Or install locally in your project:

```bash
npm install --save-dev swagger-typescript-api
npx swagger-typescript-api generate --path ./swagger.json
```

### Library

```bash
npm install --save-dev swagger-typescript-api
```

```typescript
import * as path from "node:path";
import * as process from "node:process";
import { generateApi } from "swagger-typescript-api";

await generateApi({ input: path.resolve(process.cwd(), "./swagger.json") });
```

For more detailed configuration options, please consult the documentation.

## Mass media

- [5 Lessons learned about swagger-typescript-api](https://christo8989.medium.com/5-lessons-learned-about-swagger-typescript-api-511240b34c1)
- [Why Swagger schemes are needed in frontend development ?](https://dev.to/js2me/why-swagger-schemes-are-needed-in-frontend-development-2cb4)
- [Migration en douceur vers TypeScript (French)](https://www.premieroctet.com/blog/migration-typescript/)
- [swagger-typescript-api usage (Japanese)](https://zenn.dev/watahaya/articles/2f4a716c47903b)
- [Working with REST APIs using swagger-typescript-api (Russian)](https://habr.com/ru/articles/799853/)
- [Using custom templates and configs for swagger-typescript-api (Russian)](https://habr.com/ru/articles/802097/)

## License

Licensed under the [MIT License](https://github.com/acacode/swagger-typescript-api/blob/main/LICENSE).

---
_Source: https://npm.io/package/swagger-typescript-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
