Registry / http-networking / vault-api

vault-api

JSON →
library1.1.2jsnpmunverified

vault-api is an Axios-like Node.js library for interacting with Hashicorp Vault. Currently at version 1.1.2 (last updated December 2021), it supports KV v1 and v2 secrets engines. It provides a simple, promise-based API similar to Axios for reading and writing secrets. The library is TypeScript-compatible with included type definitions. No major updates since 2021.

npm install vault-api
INSTALL
IMPORT
SIG · VAULT-API
V
vault-api
http-networkingjavascriptv1.1.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (vault function)
import vault from 'vault-api'
const vault = require('vault-api')
ESM import is preferred. CommonJS require also works but may have compatibility issues in strict ESM environments.
vault (named import)
import { vault } from 'vault-api'
import { vault } from 'vault-api'
Both default and named imports are valid and refer to the same function.
Vault types
import type { VaultConfig } from 'vault-api'
TypeScript types are bundled. Use `import type` for type-only imports.

Basic read/write operations using vault-api with Axios-like configuration object.

import vault from 'vault-api'; // Write a secret vault({ method: 'write', path: 'secret/apiKey', data: { webApp: '5cfdf55e-cfa9-5da8-b2b2-64f30a462a09' } }).then(() => console.log('Written successfully')) .catch(err => console.error(err)); // Read a secret vault({ method: 'read', path: 'secret/apiKey' }).then(response => { console.log(response.data); }).catch(err => console.error(err));
Debug
Known issues
gotchaThe library does not handle Vault authentication (token, approle, etc.) automatically. You must authenticate via Vault's auth endpoints first or set environment variables.
fix
Ensure you either authenticate before using vault() or set VAULT_TOKEN environment variable.
affects: >=1.0.0
gotchaThe library only supports KV v1 and v2 engines. Other Vault secret engines (e.g., database, transit, PKI) are not supported.
fix
Use another library (like node-vault) for non-KV engines.
affects: >=1.0.0
gotchaThe 'config' parameter in convenience methods (added in 1.1.0) is optional but if misused can cause silent failures.
fix
Refer to the library's wiki for proper configuration.
affects: >=1.1.0
Errors
Common errors & fixes
Cannot find module 'vault-api'
Package not installed or path incorrect.
fix
Run `npm install vault-api` and ensure your import path is correct.
TypeError: vault is not a function
Importing incorrectly, e.g., using default import when named import expected.
fix
Use `import vault from 'vault-api'` (default import) or `const { vault } = require('vault-api')`.
Response { status: 404, data: { errors: ['no handler for route'] } }
The Vault server does not have the requested path or secret engine mounted.
fix
Verify the Vault server is running and the secret engine is enabled at that path.
Upgrade
Version history
1.1.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
25 hits · last 30 days
node
20
OpenAI (training)
1
Resources
vault-api — npm install vault-api · libregistry