<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->

# Detecting Dependency Namespace Attacks — API Reference

## npm Registry API

```bash
# Check package existence
curl -s "https://registry.npmjs.org/package-name" | jq '.name // .error'

# Check scope existence
curl -s "https://registry.npmjs.org/@scope/package" | jq '.'

# Get package metadata
npm view package-name --json | jq '{name, version, maintainers}'
```

## PyPI API

```bash
# Check package existence
curl -s "https://pypi.org/pypi/package-name/json" | jq '.info.name // "NOT_FOUND"'

# List all versions
curl -s "https://pypi.org/pypi/package-name/json" | jq '.releases | keys'

# Get maintainer info
curl -s "https://pypi.org/pypi/package-name/json" | jq '.info | {author, maintainer}'
```

## Package Verification

```bash
# Verify npm package integrity
npm pack package-name --dry-run 2>&1

# Verify PyPI hashes
pip download package-name==1.0 --no-deps -d /tmp/verify
pip hash /tmp/verify/package-name-1.0.tar.gz
```

