New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@socketsecurity/sdk

Package Overview
Dependencies
Maintainers
2
Versions
196
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@socketsecurity/sdk

SDK for the Socket API client

latest
Source
npmnpm
Version
4.3.0
Version published
Weekly downloads
16K
-15.15%
Maintainers
2
Weekly downloads
 
Created
Source

@socketsecurity/sdk

Socket Badge Coverage

Follow @SocketSecurity Follow @socket.dev on Bluesky

JavaScript SDK for the Socket.dev API - package scoring, quota management, batch lookups, dependency analysis.

@socketsecurity/sdk is the canonical JavaScript/TypeScript client for the Socket.dev API. It exists so any Node app - your build pipeline, your registry tooling, your custom security gate - can call Socket's package-scoring and analysis endpoints without hand-rolling auth, retries, and response shapes. The SDK is consumed by Socket's own CLI, MCP server, and third-party integrations.

Install

pnpm add @socketsecurity/sdk

Usage

Quickstart: construct SocketSdk with retries, retryDelay and timeout, then call getQuota, getScoreByNpmPackage, and batchPackageFetch
import { SocketSdk } from '@socketsecurity/sdk'

const client = new SocketSdk('your-api-key', {
  retries: 3, // Retry failed requests up to 3 times
  retryDelay: 1000, // Start with 1s delay, exponential backoff
  timeout: 30000, // 30 second timeout
})

// Check your quota
const quota = await client.getQuota()
if (quota.success) {
  console.log(`Available quota: ${quota.data.quota} units`)
}

// Analyze a package
const result = await client.getScoreByNpmPackage('express', '4.18.0')
if (result.success) {
  console.log(`Dependency Score: ${result.data.depscore}`)
}

// Batch analyze multiple packages
const batchResult = await client.batchPackageFetch({
  components: [
    { purl: 'pkg:npm/express@4.18.0' },
    { purl: 'pkg:npm/react@18.0.0' },
  ],
})

Development

Contributor commands
pnpm install
pnpm run build
pnpm test
pnpm run check

Documentation

GuideDescription
API ReferenceClass methods, exported helpers, and types
SDK ConceptsResults, pagination, uploads, and runtime behavior
Quota ManagementMetadata-backed costs and quota helpers
Unsupported endpointsEndpoints the SDK does not wrap

License

MIT

Socket

FAQs

Package last updated on 23 Oct 2026

Related posts