# jsdoc-api

> A programmatic interface for jsdoc

Latest version **9.3.6** (published 2026-04-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install jsdoc-api
pnpm add jsdoc-api
yarn add jsdoc-api
bun add jsdoc-api
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 9.3.6 |
| Published | 2026-04-28 |
| First published | 2015-12-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=12.17 |
| Dependencies | 7 |
| Unpacked size | 27.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 68 |
| Author | Lloyd Brookes |
| Maintainers | 75lb |
| Keywords | jsdoc, api, programmatic, interface, javascript, documentation |

## Links

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

## Dependencies (7)

- [jsdoc](https://npm.io/package/jsdoc.md) ^4.0.5
- [file-set](https://npm.io/package/file-set.md) ^5.3.0
- [walk-back](https://npm.io/package/walk-back.md) ^5.1.2
- [array-back](https://npm.io/package/array-back.md) ^6.2.3
- [cache-point](https://npm.io/package/cache-point.md) ^3.0.1
- [current-module-paths](https://npm.io/package/current-module-paths.md) ^1.1.3
- [object-to-spawn-args](https://npm.io/package/object-to-spawn-args.md) ^2.0.1

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 9.3.6 (latest) — 2026-04-28
- 9.0.0-1 (next) — 2024-08-25
- 9.3.5 — 2025-07-17
- 9.3.4 — 2024-11-01
- 9.3.3 — 2024-10-19
- 9.3.2 — 2024-10-19
- 9.3.1 — 2024-08-31
- 9.3.0 — 2024-08-30
- 9.2.0 — 2024-08-27
- 9.1.0 — 2024-08-26
- 9.0.2 — 2024-08-26
- 9.0.1 — 2024-08-25
- 9.0.0 — 2024-08-25
- 8.1.1 — 2024-07-24
- 8.1.0 — 2024-07-19
- … 44 more at https://npm.io/package/jsdoc-api/versions

## README

[![view on npm](https://badgen.net/npm/v/jsdoc-api)](https://www.npmjs.org/package/jsdoc-api)
[![npm module downloads](https://badgen.net/npm/dt/jsdoc-api)](https://www.npmjs.org/package/jsdoc-api)
[![Gihub repo dependents](https://badgen.net/github/dependents-repo/jsdoc2md/jsdoc-api)](https://github.com/jsdoc2md/jsdoc-api/network/dependents?dependent_type=REPOSITORY)
[![Gihub package dependents](https://badgen.net/github/dependents-pkg/jsdoc2md/jsdoc-api)](https://github.com/jsdoc2md/jsdoc-api/network/dependents?dependent_type=PACKAGE)
[![Node.js CI](https://github.com/jsdoc2md/jsdoc-api/actions/workflows/node.js.yml/badge.svg)](https://github.com/jsdoc2md/jsdoc-api/actions/workflows/node.js.yml)

***Upgraders, please check the [release notes](https://github.com/jsdoc2md/jsdoc-api/releases).***

# jsdoc-api

A programmatic interface for [jsdoc3](https://github.com/jsdoc3/jsdoc) with a few features:

- Asynchronous 'explain' and 'render documentation' methods (the two main jsdoc operations).
- Input (source code) can supplied as a string or set of file names and/or globs.
- Optional caching, dramatically speeding up future invocations with the same input.

## Synopsis

To output an array of json objects, each representing a doclet, use [.explain()](https://github.com/jsdoc2md/jsdoc-api/blob/master/docs/api.md#module_jsdoc-api--jsdoc.explain). Pass in an array of file names and/or glob expressions. Use the `cache: true` flag for a faster, more efficient invocation (cached output from a prior invocation will be returned if the input has not changed).

```js
import jsdoc from 'jsdoc-api'

const data = await jsdoc.explain({ files: ['index.js', 'lib/*.js'], cache: true })
console.log(data)
```

Typical output (truncated):

```js
[
    {
        comment: '/**\n' +
          '  * The [cache-point](https://github.com/75lb/cache-point) instance used when `cache: true` is specified on `.explain()`.\n' +
          '  * @type {external:cache-point}\n' +
          '  */',
        meta: {
          range: [ 491, 554 ],
          filename: 'index.js',
          lineno: 21,
          columnno: 6,
          path: '/Users/lloyd/Documents/jsdoc2md/jsdoc-api',
          code: { id: 'astnode100000027', name: 'cache', type: 'NewExpression', value: '' }
        },
        description: 'The [cache-point](https://github.com/75lb/cache-point) instance used when `cache: true` is specified on `.explain()`.',
        type: { names: [ 'external:cache-point' ] },
        name: 'cache',
        longname: 'module:jsdoc-api~cache',
        kind: 'constant',
        scope: 'inner',
        memberof: 'module:jsdoc-api',
        params: []
    },
    // etc
    // etc
]
```

As an alternative to passing in file names/globs (above), you can pass in one or more source code strings.

```js
import jsdoc from 'jsdoc-api'

const data = await jsdoc.explain({ source: '/** example doclet */ \n var example = true' })
console.log(data)
```

Output:

```js
[
  {
    comment: '/** example doclet */',
    meta: {
      range: [ 28, 42 ],
      filename: '934b1fbe2810.js',
      lineno: 2,
      columnno: 5,
      path: '/var/folders/bt/jgn73jf50vsb5gj92dk00v3r0000gn/T/jsdoc-api-W854dk',
      code: { id: 'astnode100000003', name: 'example', type: 'Literal', value: true }
    },
    description: 'example doclet',
    name: 'example',
    longname: 'example',
    kind: 'member',
    scope: 'global',
    params: []
  },
  { kind: 'package', longname: 'package:undefined', files: [ '/var/folders/bt/jgn73jf50vsb5gj92dk00v3r0000gn/T/jsdoc-api-W854dk/934b1fbe2810.js' ] }
]
```

Finally, use the `render()` method to invocate jsdoc directly, generating your documentation.

```js
import jsdoc from 'jsdoc-api'

await jsdoc.render({ files: ['index.js', 'lib/something.js'], destination: 'jsdoc-output' })
```

If you need to use a specific `jsdoc` version or fork, specify its path via `JSDOC_PATH` and jsdoc-api will use it instead of the default.

```sh
$ export JSDOC_PATH=./node_modules/.bin/jsdoc # An alternative jsdoc version you installed
$ node my-jsdoc-api-script.js                 # Run your jsdoc-api app as usual
```

See the [API documentation](https://github.com/jsdoc2md/jsdoc-api/blob/master/docs/api.md) for further details. See the [example folder](https://github.com/jsdoc2md/jsdoc-api/tree/master/example) for code examples.

* * *

&copy; 2015-2026 [Lloyd Brookes](https://github.com/75lb) \<opensource@75lb.com\>.

Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).

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