Developer Documentation

Comprehensive guides and API reference for integrating DependencyHQ into your development workflow.

Quick Start Guide

Installation

npm install @dependencyhq/sdk

# or with yarn
yarn add @dependencyhq/sdk

# or with pnpm
pnpm add @dependencyhq/sdk

Basic Usage

import { DependencyHQ } from '@dependencyhq/sdk';

const dhq = new DependencyHQ({
  apiKey: 'your-api-key',
  baseUrl: 'https://api.dependencyhq.com'
});

// Fetch dependency graph
const graph = await dhq.getDependencyGraph('react-web-app');
console.log(graph);

Risk Analysis

// Get risk analysis
const risks = await dhq.getRiskAnalysis('react-web-app');

// Filter critical issues
const critical = risks.filter(r => r.severity === 'critical');
console.log(`Found ${critical.length} critical issues`);

API Reference

GET /api/v1/dependency-graph

GET

Retrieve dependency graph for a project

curl -X GET \
  https://api.dependencyhq.com/api/v1/dependency-graph \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"repository":"react-web-app"}'

GET /api/v1/risk-analysis

GET

Analyze security risks in dependencies

curl -X GET \
  https://api.dependencyhq.com/api/v1/risk-analysis \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"repository":"react-web-app"}'

GET /api/v1/updates

GET

Get available package updates

curl -X GET \
  https://api.dependencyhq.com/api/v1/updates \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"repository":"react-web-app"}'

Authentication

All API requests require authentication using Bearer tokens. Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

You can generate API keys in your account settings.

Never share your API keys. Always keep them secure and rotate them regularly.

Code Examples

JavaScript/Node.js

const dhq = require('@dependencyhq/sdk');

async function checkDependencies() {
  const client = new dhq.Client({
    apiKey: process.env.DHQ_API_KEY
  });

  const graph = await client
    .getDependencyGraph('my-app');

  return graph;
}

Python

from dependencyhq import Client

def check_dependencies():
  client = Client(
    api_key='YOUR_API_KEY'
  )

  graph = client.get_dependency_graph(
    'my-app'
  )

  return graph

if __name__ == '__main__':
  result = check_dependencies()
  print(result)

Need Help?

Check our FAQ, community forums, or contact our support team for detailed assistance with API integration and troubleshooting.