# swagger-client

> Swagger Client - a collection of interfaces for OAI specs

Latest version **3.38.0** (published 2026-08-13) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install swagger-client
pnpm add swagger-client
yarn add swagger-client
bun add swagger-client
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 3.38.0 |
| Published | 2026-08-13 |
| First published | 2013-02-08 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2694 |
| Maintainers | swagger-api, fehguy, kyleshockey |
| Keywords | oai, swagger, js, spec, resolver, json-refs |

## Links

- npm: https://www.npmjs.com/package/swagger-client
- Repository: https://github.com/swagger-api/swagger-client
- Homepage: https://github.com/swagger-api/swagger-client#readme
- Issues: https://github.com/swagger-api/swagger-client/issues
- npm.io page: https://npm.io/package/swagger-client

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 3.38.0 (latest) — 2026-08-13
- 3.19.0-beta.8 (beta) — 2023-03-01
- 3.19.0-alpha.4 (alpha) — 2023-02-01
- 3.37.8 — 2026-08-03
- 3.37.7 — 2026-07-21
- 3.37.6 — 2026-07-21
- 3.37.5 — 2026-06-17
- 3.37.4 — 2026-05-07
- 3.37.3 — 2026-04-27
- 3.37.2 — 2026-04-14
- 3.37.1 — 2026-03-17
- 3.37.0 — 2026-02-27
- 3.36.2 — 2026-02-20
- 3.36.1 — 2026-01-29
- 3.36.0 — 2025-10-27
- … 317 more at https://npm.io/package/swagger-client/versions

## README

# Swagger Client <img src="https://raw.githubusercontent.com/swagger-api/swagger.io/wordpress/images/assets/SW-logo-clr.png" height="50" align="right">

[![Build Status](https://github.com/swagger-api/swagger-js/actions/workflows/nodejs.yml/badge.svg)](https://github.com/swagger-api/swagger-js/actions)

**Swagger Client** is a JavaScript module that allows you to fetch, resolve, and interact with Swagger/OpenAPI documents.

## New!

**This is the new version of swagger-js, 3.x.** The new version supports Swagger 2.0 as well as OpenAPI 3.

Want to learn more? Check out our [FAQ](docs/migration/migration-2-x-to-3-x.md).

For features known to be missing from 3.x please see the [Graveyard](docs/migration/graveyard-3-x.md).


For the older version of swagger-js, refer to the [*2.x branch*](https://github.com/swagger-api/swagger-js/tree/2.x).

> *The npm package is called `swagger-client` and the GitHub repository is `swagger-js`.
We'll be consolidating that soon. Just giving you the heads-up. You may see references to both names.*

## Compatibility
The OpenAPI Specification has undergone multiple revisions since initial creation in 2010.
Compatibility between Swagger Client and the OpenAPI Specification is as follows:

Swagger Client Version | Release Date | OpenAPI Spec compatibility                              | Notes
------------------ |--------------|---------------------------------------------------------| -----
3.37.x | 2026-02-27    | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.1.0, 3.2.0   | [tag v3.37.0](https://github.com/swagger-api/swagger-js/releases/tag/v3.37.0)
3.33.x | 2024-12-30   | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.1.0           | [tag v3.33.0](https://github.com/swagger-api/swagger-js/releases/tag/v3.33.0)
3.19.x | 2023-01-23   | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.1.0                  | [tag v3.19.0-alpha.3](https://github.com/swagger-api/swagger-js/releases/tag/v3.19.0-alpha.3)
3.10.x | 2020-01-17   | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3                         | [tag v3.10.0](https://github.com/swagger-api/swagger-js/tree/v3.10.0)
2.1.32 | 2017-01-12   | 1.0, 1.1, 1.2                                           | [tag v2.1.32](https://github.com/swagger-api/swagger-js/tree/v2.1.32). This [release](https://github.com/swagger-api/swagger-js/releases/tag/v2.1.32) is only available on GitHub.

## Anonymized analytics

Swagger Client uses [Scarf](https://scarf.sh/) to collect [anonymized installation analytics](https://github.com/scarf-sh/scarf-js?tab=readme-ov-file#as-a-user-of-a-package-using-scarf-js-what-information-does-scarf-js-send-about-me). These analytics help support the maintainers of this library and ONLY run during installation. To [opt out](https://github.com/scarf-sh/scarf-js?tab=readme-ov-file#as-a-user-of-a-package-using-scarf-js-how-can-i-opt-out-of-analytics), you can set the `scarfSettings.enabled` field to `false` in your project's `package.json`:

```
// package.json
{
  // ...
  "scarfSettings": {
    "enabled": false
  }
  // ...
}
```

Alternatively, you can set the environment variable `SCARF_ANALYTICS` to `false` as part of the environment that installs your npm packages, e.g., `SCARF_ANALYTICS=false npm install`.

## Documentation

#### Usage

- [Installation](docs/usage/installation.md)
- [Tags Interface](docs/usage/tags-interface.md)
- [HTTP client for OAS operations](docs/usage/http-client-for-oas-operations.md)
- [OpenAPI Definition Resolver](docs/usage/openapi-definition-resolver.md)
- [HTTP Client](docs/usage/http-client.md)
- [Swagger Client API](docs/usage/api.md)

#### Development

- [Contributing](https://github.com/swagger-api/.github/blob/main/CONTRIBUTING.md)
- [Setting up](docs/development/setting-up.md)
- [Scripts](docs/development/scripts.md)

#### Migrations 

- [Migration guide](docs/migration/migration-2-x-to-3-x.md)
- [Graveyard](docs/migration/graveyard-3-x.md)

### Runtime 

### Node.js

`swagger-client` requires Node.js `>=22` and uses [native Node.js fetch](https://nodejs.org/dist/latest-v22.x/docs/api/globals.html#fetch).
Node.js `12`, `14`, `16`, `18`, and `20` are EOL and are no longer supported.

> NOTE: swagger-client minimum Node.js runtime version aligns with [Node.js Releases](https://nodejs.org/en/about/releases/)
> which means that we can drop support for **EOL** (End Of Life) Node.js versions without doing major version bump.

### Browsers

`swagger-client` works in the latest versions of Chrome, Safari, Firefox, and Edge
and uses [native fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) implementation
provided by each supported browser.

## Security contact

Please disclose any security-related issues or vulnerabilities by emailing [security@swagger.io](mailto:security@swagger.io), instead of using the public issue tracker.

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