Registry / devops / snyk-api-import

snyk-api-import

JSON →
library2.23.1jsnpmunverified

Snyk API Import is a CLI tool for importing projects into Snyk via the Snyk API at a controlled pace, with built-in rate limiting handling, queuing, and retries. Current stable version is 2.23.1, with releases on a monthly/quarterly cadence. It supports GitHub, GitLab, Bitbucket Server, Bitbucket Cloud, and Azure Repos. Key differentiators include automatic rate limit handling for SCMs, queuing to reduce failures, and ability to resume after interruption. This repository is in maintenance mode (no new features, only bug & security fixes). Node.js >=20 required.

npm install snyk-api-import
INSTALL
IMPORT
SIG · SNYK-API-IMPORT
S
snyk-api-import
devopsjavascriptv2.23.1
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
import snykApiImport from 'snyk-api-import'
const snykApiImport = require('snyk-api-import')
ESM-only since v2.0; requires Node.js >=20 and "type": "module" in package.json.
runImport
import { runImport } from 'snyk-api-import'
const { runImport } = require('snyk-api-import')
Named export for programmatic use; ESM-only.
generateImportData
import { generateImportData } from 'snyk-api-import'
Available as named export for generating import data programmatically.
SnykApiImportError
import { SnykApiImportError } from 'snyk-api-import'
import SnykApiImportError from 'snyk-api-import'
This is a named export, not default. TypeScript types included.

Demonstrates programmatic usage of runImport with async/await and environment variables for credentials.

import { runImport } from 'snyk-api-import'; const options = { org: process.env.SNYK_ORG_ID ?? '', source: process.env.IMPORT_SOURCE ?? 'github', integrationId: process.env.SNYK_INTEGRATION_ID ?? '', concurrency: 5, skipExisting: true }; async function main() { try { const result = await runImport(options); console.log('Import completed:', result); } catch (error) { console.error('Import failed:', error); } } main();
snyk-api-import --version
Debug
Known issues
gotchaImport will skip repos already imported unless --force is used
fix
Use --force flag to re-import existing targets
affects: >=0.0.0
deprecatedThe --rateLimit option has been deprecated since v2.0
fix
Rate limiting is now automatic; remove the flag
affects: >=2.0.0
breakingNode.js 18 support dropped in v2.0, requires >=20
fix
Upgrade to Node.js 20 or later
affects: >=2.0.0
breakingESM-only since v2.0; CommonJS require() no longer works
fix
Convert to ES module imports or use dynamic import()
affects: >=2.0.0
deprecatedThe --token flag is deprecated; use SNYK_TOKEN environment variable
fix
Set SNYK_TOKEN environment variable and omit --token
affects: >=1.20.0
breakingSNYK_API environment variable removed; use SNAPI_BASE_URL instead
fix
Set SNAPI_BASE_URL instead of SNYK_API
affects: >=2.0.0
gotchaLarge imports may hit GitHub API rate limits; script handles 429 responses but may slow down
fix
Ensure your GitHub personal access token has sufficient rate limits; consider using a GitHub App token
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'snyk-api-import'
Missing npm install or wrong environment (CJS vs ESM)
fix
Run 'npm install snyk-api-import@latest' and ensure 'type': 'module' in package.json
snyk-api-import: command not found
Package not installed globally or not in PATH
fix
Install globally: 'npm install -g snyk-api-import' or use npx: 'npx snyk-api-import'
Error: SNYK_TOKEN is not set
Missing environment variable for authentication
fix
Set SNYK_TOKEN environment variable: 'export SNYK_TOKEN=your-token'
SyntaxError: Cannot use import statement outside a module
Running ESM code without module context
fix
Add 'type': 'module' to package.json or rename file to .mjs
Upgrade
Version history
2.23.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
OpenAI (training)
1
Resources