# @microsoft/api-extractor-model

> A helper library for loading and saving the .api.json files created by API Extractor

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

## Install

```sh
npm install @microsoft/api-extractor-model
pnpm add @microsoft/api-extractor-model
yarn add @microsoft/api-extractor-model
bun add @microsoft/api-extractor-model
```

## Health

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

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 7.33.12 |
| Published | 2026-09-09 |
| First published | 2018-12-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20.9.0 |
| Dependencies | 3 |
| Unpacked size | 1.3 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6494 |
| Maintainers | microsoft1es, microsoft-oss-releases, odspnpm |

## Links

- npm: https://www.npmjs.com/package/@microsoft/api-extractor-model
- Repository: https://github.com/microsoft/rushstack
- Homepage: https://api-extractor.com
- Issues: https://github.com/microsoft/rushstack/issues
- npm.io page: https://npm.io/package/@microsoft/api-extractor-model

## Dependencies (3)

- [@microsoft/tsdoc](https://npm.io/package/@microsoft/tsdoc.md) ~0.16.0
- [@microsoft/tsdoc-config](https://npm.io/package/@microsoft/tsdoc-config.md) ~0.18.1
- [@rushstack/node-core-library](https://npm.io/package/@rushstack/node-core-library.md) 5.24.1

## Recent versions

- 7.33.12 (latest) — 2026-09-09
- 7.33.11 — 2026-08-20
- 7.33.10 — 2026-07-17
- 7.33.9 — 2026-07-16
- 7.33.8 — 2026-04-18
- 7.33.7 — 2026-04-17
- 7.33.6 — 2026-04-09
- 7.33.5 — 2026-03-31
- 7.33.4 — 2026-02-25
- 7.33.3 — 2026-02-25
- 7.33.2 — 2026-02-24
- 7.33.1 — 2026-02-20
- 7.33.0 — 2026-02-19
- 7.32.2 — 2025-12-06
- 7.32.1 — 2025-11-21
- … 210 more at https://npm.io/package/@microsoft/api-extractor-model/versions

## README

# @microsoft/api-extractor-model

Use this library to read and write *.api.json files as defined by the [API Extractor](https://api-extractor.com/) tool.
These files are used to generate a documentation website for your TypeScript package.  The files store the
API signatures and doc comments that were extracted from your package.

API documentation for this package: https://api.rushstack.io/pages/api-extractor-model/

## Example Usage

The following code sample shows how to load `example.api.json`, which would be generated by API Extractor
when it analyzes a hypothetical NPM package called `example`:

```ts
import { ApiModel, ApiPackage } from '@microsoft/api-extractor-model';

const apiModel: ApiModel = new ApiModel();
const apiPackage: ApiPackage = apiModel.loadPackage('example.api.json');

for (const member of apiPackage.members) {
  console.log(member.displayName);
}
```

The `ApiModel` is acts as a container for various packages that are loaded and operated on as a group.
For example, a documentation tool may need to resolve `@link` references across different packages.
In this case we would load the various packages into the `ApiModel`, and then use
the `ApiModel.resolveDeclarationReference()` to resolve the `@link` targets.

The data structure forms a tree of various classes that start with the `Api` prefix.  The nesting hierarchy
might look like this:

```
- ApiModel
  - ApiPackage
    - ApiEntryPoint
      - ApiClass
        - ApiMethod
        - ApiProperty
      - ApiEnum
        - ApiEnumMember
      - ApiInterface
        - ApiMethodSignature
        - ApiPropertySignature
      - ApiNamespace
        - (ApiClass, ApiEnum, ApiInterface, ...)
```

You can use the `ApiItem.members` property to traverse this tree.

Note that the non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
to extend more than one base class).  The "mixin" is a TypeScript merged declaration with three components:
the function that generates a subclass, an interface that describes the members of the subclass, and
a namespace containing static members of the class.

> For a complete project that uses these APIs to generate an API reference web site,
> see the [@microsoft/api-documenter](https://www.npmjs.com/package/@microsoft/api-documenter) source code.

## Links

- [CHANGELOG.md](
  https://github.com/microsoft/rushstack/blob/main/libraries/api-extractor-model/CHANGELOG.md) - Find
  out what's new in the latest version
- [API Reference](https://api.rushstack.io/pages/api-extractor-model/)

API Extractor is part of the [Rush Stack](https://rushstack.io/) family of projects.

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