> **For coding agents and LLMs:** This is one page from the Social Fetch docs (markdown export). For curated orientation and workflow guidance, start with [`/llms.txt`](https://www.socialfetch.dev/llms.txt); for agent onboarding and crawl rules, use [`/agents.txt`](https://www.socialfetch.dev/agents.txt); for the full endpoint list with links to pages like this one, use [`/llms-endpoints.txt`](https://www.socialfetch.dev/llms-endpoints.txt); for one platform's parameters and curls, use [`/llms-{platform}.txt`](https://www.socialfetch.dev/llms-tiktok.txt); use [`/llms.json`](https://www.socialfetch.dev/llms.json) when you need structured JSON for tool registration.

## This page

- **On-site (HTML):** <https://www.socialfetch.dev/docs/api/v1/npm/package/get>
- **Markdown (.mdx) URL:** <https://www.socialfetch.dev/docs/api/v1/npm/package/get.mdx>

## API base URL and authentication

- **API origin (from OpenAPI `servers`):** `https://api.socialfetch.dev`
- **Authentication:** send `x-api-key: sfk_...` on `/v1/**` and `/v2/**` routes unless the operation is explicitly anonymous (check OpenAPI `security`, the [API reference hub](https://www.socialfetch.dev/docs/api.mdx), [`/llms.txt`](https://www.socialfetch.dev/llms.txt), or [`/llms.json`](https://www.socialfetch.dev/llms.json) for each route).
- **OpenAPI JSON:** <https://www.socialfetch.dev/openapi.json>

## Recommended docs entrypoints (this site)

- [Documentation overview](https://www.socialfetch.dev/docs.mdx) — top-level orientation (markdown).
- [Quickstart](https://www.socialfetch.dev/docs/quickstart.mdx) — authenticate with `x-api-key`, validate auth with `whoami`, and understand the JSON envelope.
- [SDK](https://www.socialfetch.dev/docs/sdk.mdx) — official TypeScript SDK guide, including `SocialFetchClient`, `Result`, and `unwrap()`.
- [Capability matrix](https://www.socialfetch.dev/docs/capability-matrix.mdx) — every operation with identifiers, pagination, outcomes, media download, credits, and its SDK method. Generated from OpenAPI, so use it for route selection instead of scanning individual pages.
- [Recipes](https://www.socialfetch.dev/docs/recipes.mdx) — copyable workflows (brand monitoring, transcripts, Ad Library, creator scoring, Reddit research) with credit callouts and SDK examples.
- [Integrations](https://www.socialfetch.dev/docs/integrations.mdx) — MCP for AI clients, n8n verified node, Apify Store Actors, Make custom app, SDK, and REST API connection paths.
- [MCP product page](https://www.socialfetch.dev/mcp) — hosted MCP overview, OAuth, Skills install.
- [MCP integration](https://www.socialfetch.dev/docs/integrations/mcp.mdx) — hosted `/mcp` server, OAuth, Cursor/VS Code/Claude install snippets, 910 endpoint tools, plus docs_search/docs_read for implementation help.
- [n8n integration](https://www.socialfetch.dev/docs/integrations/n8n.mdx) — install `n8n-nodes-socialfetch`, credentials, and workflow examples.
- [Apify integration](https://www.socialfetch.dev/docs/integrations/apify.mdx) — Store Actors under @social-fetch, PPE billing, dataset export, and quick start.
- [Make integration](https://www.socialfetch.dev/docs/integrations/make.mdx) — custom app modules for Make scenarios, API key credentials, and module catalog.
- [`/llms-endpoints.txt`](https://www.socialfetch.dev/llms-endpoints.txt) — every documented operation with a direct link to that route's agent-readable markdown page (prefer this over parsing OpenAPI).
- [`/llms-{platform}.txt`](https://www.socialfetch.dev/llms-tiktok.txt) — per-platform endpoint files generated from OpenAPI (parameters, credits, curls).
- [`/agents.txt`](https://www.socialfetch.dev/agents.txt) — agent crawl/onboarding file with capabilities, auth rules, and allowlist.
- [`/llms.json`](https://www.socialfetch.dev/llms.json) — structured machine-readable operation inventory with parameter names, pagination, outcomes, credits, and SDK mapping.
- [API reference hub](https://www.socialfetch.dev/docs/api.mdx) — human-friendly index of operations with links into generated pages.
- [Errors](https://www.socialfetch.dev/docs/errors.mdx) — shared error envelope and HTTP status guidance.
- [Credits](https://www.socialfetch.dev/docs/credits.mdx) — metering, `402`, and planning batch jobs.
- Outcome semantics such as `found`, `not_found`, and `private` are documented in [Errors](https://www.socialfetch.dev/docs/errors.mdx) and on operation pages when present in the OpenAPI contract.

## Markdown docs convention

- Every docs page has a markdown twin: append **`.mdx`** to the docs pathname (for example `/docs/quickstart` → `/docs/quickstart.mdx`).
- Agents that send `Accept: text/markdown` on `/docs/**` HTML URLs may receive markdown directly (same URL, `Vary: Accept`).
- Published blog posts use the same convention: `/blog/{slug}` → `/blog/{slug}.mdx`, or `Accept: text/markdown` on the HTML URL (`Vary: Accept`).

---
# Get npm package (https://www.socialfetch.dev/docs/api/v1/npm/package/get)

## Summary

Get an npm package's latest version, every dist-tag, publisher, dependencies and last week's downloads.

**Tags:** `npm`

## HTTP

- **Method:** GET
- **Path:** `/v1/npm/package`
- **operationId:** `npm.package.get`
- **Base URL:** `https://api.socialfetch.dev`

## Capability summary

- **SDK mapping:** `client.npm.getPackage({ name: "express" })`
- **Pagination:** none
- **Business outcome field:** `data.lookupStatus` with values `found`, `not_found`

## Credits

- **Base:** 1 credit per successful lookup.
- **Maximum on success (200):** 1 credit.
- **Failed requests (`lookup_failed`, `503`):** not charged.
- **Authoritative field:** `meta.creditsCharged`.

## Authentication

- **`x-api-key`**: API key (`sfk_...`)

## Parameters

### `name` (query)

- **Required:** yes
- **Constraints:** type `string`; maxLength: 214
- **Description:** npm package name, e.g. `express`, `lodash.merge`, `@types/node` or `--file--1`. Names are case-sensitive (`Express` is a different package) and keep legacy punctuation such as a leading `-`.

## Responses (status codes)

- **200**: npm package.
- **400**: Invalid request
- **401**: Missing or invalid API key
- **402**: Insufficient credits
- **413**: The document is larger than the maximum size we can return; no charge.
- **500**: Unexpected or billing error
- **502**: Lookup could not be completed.
- **503**: Service temporarily unavailable; safe to retry with backoff.

## Response body (200)

npm package.

### Field outline

- **data** (required) — type `object`. Endpoint-specific response payload.
  - **lookupStatus** (required) — type `string`; enum: found, not_found. Whether the item exists. Every outcome is HTTP 200; branch on this field.
  - **distTags** (required) — type `object`. Every dist-tag.
  - **latestVersion** (required) — type `string`; nullable. The version the `latest` dist-tag points at.
  - **package** (required) — type `object`; nullable. The latest version when found; otherwise null.
    - **name** (required) — type `string`. Package name, as the registry stores it.
    - **scope** (required) — type `string`; nullable. Package scope including `@`, or null for an unscoped name.
    - **version** (required) — type `string`. Version.
    - **description** (required) — type `string`; nullable. Description.
    - **keywords** (required) — type `array`. Keywords.
      - _items:_
        - type `string`
    - **license** (required). Licence: an SPDX expression/string or the published object.
    - **homepage** (required) — type `string`; nullable. Project homepage.
    - **bugsUrl** (required) — type `string`; nullable. Issue tracker URL.
    - **repository** (required) — type `object`; nullable. Source repository.
      - **type** (required) — type `string`; nullable. Repository type, e.g. `git`.
      - **url** (required) — type `string`; nullable. Repository URL as published.
      - **directory** (required) — type `string`; nullable. Monorepo directory the package was published from.
    - **author** (required) — type `object`; nullable. Author.
      - **name** (required) — type `string`; nullable. Author name.
      - **url** (required) — type `string`; nullable. Author URL.
    - **contributors** (required) — type `array`. Contributors.
      - _items:_
    - **maintainers** (required) — type `array`. Maintainers at the time this version was published. The details route uses the package's current maintainer list instead.
      - _items:_
    - **publisher** (required) — type `object`; nullable. Publisher of this version.
      - **username** (required) — type `string`; nullable. Publishing username.
      - **trustedPublisher** (required) — type `object`; nullable. The CI identity, when the version was published by one.
      - **approver** (required) — type `object`; nullable. Who approved a trusted publication.
    - **funding** (required) — type `array`. Funding channels.
      - _items:_
    - **deprecated** (required) — type `string`; nullable. Deprecation message; null when the version is not deprecated.
    - **hasInstallScript** (required) — type `boolean`; nullable. Whether `preinstall`, `install` or `postinstall` is defined, inferred from `scripts` when the field is absent. Null when neither the field nor those scripts are present: an implicit node-gyp rebuild from binding.gyp cannot be seen.
    - **bin** (required) — type `object`; nullable. Command-name to file map, or null when the package has no binaries.
    - **entrypoints** (required) — type `object`. The package's entrypoints.
      - **main** (required) — type `string`; nullable. `main` entrypoint.
      - **module** (required) — type `string`; nullable. `module` entrypoint.
      - **types** (required) — type `string`; nullable. `types` or `typings` entrypoint.
      - **type** (required) — type `string`; nullable. `type` field (`module` or `commonjs`).
      - **exports** (required). The `exports` map, as published.
    - **files** (required) — type `array`. `files` patterns.
      - _items:_
        - type `string`
    - **sideEffects** (required) — type `boolean`; nullable. The `sideEffects` flag, when published as a boolean.
    - **engines** (required) — type `object`. Engine constraints.
    - **os** (required) — type `array`. Supported operating systems.
      - _items:_
        - type `string`
    - **cpu** (required) — type `array`. Supported CPU architectures.
      - _items:_
        - type `string`
    - **workspaces** (required) — type `array`. Workspace patterns.
      - _items:_
        - type `string`
    - **scripts** (required) — type `object`. Package scripts.
    - **dependencies** (required) — type `object`. Runtime dependencies.
    - **devDependencies** (required) — type `object`. Development dependencies.
    - **peerDependencies** (required) — type `object`. Peer dependencies.
    - **peerDependenciesMeta** (required) — type `object`. Peer dependency metadata.
    - **optionalDependencies** (required) — type `object`. Optional dependencies.
    - **bundleDependencies** (required). Bundled dependencies, as an array or the legacy boolean.
    - **dist** (required) — type `object`. The published artifact and its registry metadata.
      - **tarballUrl** (required) — type `string`; nullable. Tarball URL.
      - **shasum** (required) — type `string`; nullable. SHA-1 of the tarball.
      - **integrity** (required) — type `string`; nullable. Subresource-integrity hash of the tarball.
      - **fileCount** (required) — type `integer`; minimum: 0; nullable. Files in the tarball.
      - **unpackedSize** (required) — type `integer`; minimum: 0; nullable. Unpacked bytes.
      - **signatures** (required) — type `array`. Registry signatures. The legacy PGP block is not exposed.
        - _items:_
    - **provenance** (required) — type `object`. Whether this version was published with provenance.
      - **available** (required) — type `boolean`. Whether the version carries an attestation.
      - **predicateType** (required) — type `string`; nullable. Predicate type of the provenance attestation.
    - **gitHead** (required) — type `string`; nullable. Git commit the version was built from.
    - **publishedWith** (required) — type `object`. The publisher's toolchain, from the version document.
      - **node** (required) — type `string`; nullable. Node version used to publish.
      - **npm** (required) — type `string`; nullable. npm CLI version used to publish.
    - **types** (required) — type `string`; enum: bundled, definitelyTyped, null; nullable. How the package ships TypeScript types: bundled with it, or through a DefinitelyTyped `@types` package.
  - **downloads** (required) — type `object`; nullable. Last week's downloads, when available.
    - **weekly** (required) — type `integer`; minimum: 0. Downloads in the last week.
    - **start** (required) — type `string`; nullable. `YYYY-MM-DD`, or null when npm has none.
    - **end** (required) — type `string`; nullable. `YYYY-MM-DD`, or null when npm has none.
  - **complete** (required) — type `boolean`. False when part of the answer could not be filled (dist-tags or last week's downloads); `missing` says which.
  - **missing** (required) — type `array`. Parts of the answer that could not be filled.
    - _items:_
      - type `string`
- **meta** (required) — type `object`. Metadata describing the request and billing outcome.
  - **requestId** (required) — type `string`; minLength: 1. Unique request identifier for tracing this API call.
  - **creditsCharged** (required) — type `integer`; minimum: 0. Credits charged for this request.
  - **version** (required) — type `string`; enum: v1. Public API version that served the response.

### Example JSON (found)

```json
{
  "data": {
    "lookupStatus": "found",
    "distTags": {
      "latest": "5.3.0",
      "latest-4": "4.22.3"
    },
    "latestVersion": "5.3.0",
    "package": {
      "name": "express",
      "scope": null,
      "version": "5.3.0",
      "description": "Fast, unopinionated, minimalist web framework",
      "keywords": [
        "express"
      ],
      "license": "MIT",
      "homepage": "https://expressjs.com/",
      "bugsUrl": "https://github.com/expressjs/express/issues",
      "repository": {
        "type": "git",
        "url": "git+https://github.com/expressjs/express.git",
        "directory": null
      },
      "author": {
        "name": "TJ Holowaychuk",
        "url": null
      },
      "contributors": [
        {
          "name": "Aaron Heckmann",
          "url": null,
          "githubUsername": null
        }
      ],
      "maintainers": [
        {
          "username": "wesleytodd"
        }
      ],
      "publisher": {
        "username": "GitHub Actions",
        "trustedPublisher": {
          "id": "github",
          "oidcConfigId": "99dba195-afaa-4d25-9fac-f714da8caf90"
        },
        "approver": {
          "username": "ulisesgascon"
        }
      },
      "funding": [
        {
          "type": "opencollective",
          "url": "https://opencollective.com/express"
        }
      ],
      "deprecated": null,
      "hasInstallScript": null,
      "bin": null,
      "entrypoints": {
        "main": null,
        "module": null,
        "types": null,
        "type": null,
        "exports": null
      },
      "files": [],
      "sideEffects": null,
      "engines": {
        "node": ">= 18"
      },
      "os": [],
      "cpu": [],
      "workspaces": [],
      "scripts": {
        "lint": "eslint .",
        "test": "mocha --require test/support/env --reporter spec --check-leaks test/ test/acceptance/",
        "test-ci": "nyc --exclude examples --exclude test --exclude benchmarks --reporter=lcovonly --reporter=text npm test",
        "lint:fix": "eslint . --fix",
        "test-cov": "nyc --exclude examples --exclude test --exclude benchmarks --reporter=html --reporter=text npm test",
        "test-tap": "mocha --require test/support/env --reporter tap --check-leaks test/ test/acceptance/"
      },
      "dependencies": {
        "qs": "^6.16.0",
        "depd": "^2.0.0",
        "etag": "^1.8.1",
        "once": "^1.4.0",
        "send": "^1.1.0",
        "vary": "^1.1.2",
        "debug": "^4.4.0",
        "fresh": "^2.0.0",
        "cookie": "^0.7.1",
        "router": "^2.2.0",
        "accepts": "^2.0.0",
        "type-is": "^2.1.0",
        "parseurl": "^1.3.3",
        "statuses": "^2.0.1",
        "encodeurl": "^2.0.0",
        "mime-types": "^3.0.0",
        "proxy-addr": "^2.0.8",
        "body-parser": "^2.3.0",
        "escape-html": "^1.0.3",
        "http-errors": "^2.0.0",
        "on-finished": "^2.4.1",
        "content-type": "^2.0.0",
        "finalhandler": "^2.1.0",
        "range-parser": "^1.2.1",
        "serve-static": "^2.2.0",
        "cookie-signature": "^1.2.1",
        "merge-descriptors": "^2.0.0",
        "content-disposition": "^2.0.1"
      },
      "devDependencies": {
        "ejs": "^3.1.10",
        "hbs": "4.3.1",
        "nyc": "^17.1.0",
        "after": "0.8.2",
        "mocha": "^11.7.5",
        "vhost": "~3.0.2",
        "eslint": "8.47.0",
        "marked": "^15.0.3",
        "morgan": "1.12.1",
        "supertest": "^6.3.0",
        "connect-redis": "^8.0.1",
        "cookie-parser": "1.4.7",
        "cookie-session": "2.1.1",
        "express-session": "^1.18.1",
        "method-override": "3.0.0",
        "pbkdf2-password": "1.2.1"
      },
      "peerDependencies": {},
      "peerDependenciesMeta": {},
      "optionalDependencies": {},
      "bundleDependencies": null,
      "dist": {
        "tarballUrl": "https://registry.npmjs.org/express/-/express-5.3.0.tgz",
        "shasum": "ab72dace89c50c8417bd3f865dad0b4fd1ca1c73",
        "integrity": "sha512-qCqy1xSoaugxOD4IVHb1ZWdkvCF2W3aE2okKouWj8VwJ+ztskSiXoBnCSJqfKT+cVPJhuJqe9YLbY425+Zh00g==",
        "fileCount": 10,
        "unpackedSize": 76638,
        "signatures": [
          {
            "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U",
            "sig": "MEQCICHxm5Q3ouMkRSvPzBL4cd1e1inNV4jvmEskclN0pLl5AiAA2D5Tc8x4V1F3mmyvA+cVgJs6yQiGwONT44JG+yX29A=="
          }
        ]
      },
      "provenance": {
        "available": true,
        "predicateType": "https://slsa.dev/provenance/v1"
      },
      "gitHead": "cf6722bf89a86905281d9160b6482e08166b5ef0",
      "publishedWith": {
        "node": "24.21.0",
        "npm": "12.2.0"
      },
      "types": null
    },
    "downloads": {
      "weekly": 196349991,
      "start": "2026-10-30",
      "end": "2026-11-05"
    },
    "complete": true,
    "missing": []
  },
  "meta": {
    "requestId": "req_8c60b038-d9ad-43db-9dd1-376748c6c97b",
    "creditsCharged": 1,
    "version": "v1"
  }
}
```

### Machine-readable error codes

When an error JSON body is returned, it may include one of these `error.code` values (derived from the OpenAPI schemas for this operation; additional codes may exist at runtime):

- `bad_request`

## Error handling & retries

Interpret HTTP status codes using the descriptions below. Do not assume a JSON body unless the OpenAPI schema defines one for that status.

- **400**: Invalid request **Retry:** Fix the request; retrying the same invalid payload will not help.
- **401**: Missing or invalid API key **Retry:** Fix the API key first; retrying without changes will not help.
- **402**: Insufficient credits **Retry:** Do not retry without resolving billing/credits (retrying the same request will not help).
- **413**: The document is larger than the maximum size we can return; no charge.
- **500**: Unexpected or billing error
- **502**: Lookup could not be completed. **Retry:** May be transient; a few retries with backoff are reasonable.
- **503**: Service temporarily unavailable; safe to retry with backoff. **Retry:** Usually safe to retry with exponential backoff and jitter.

### Suggested client defaults

- Send the API key using the `x-api-key` header on every request.
- On `503` (and sometimes `502`), retry with backoff; cap retries and surface a clear error to the user.
- On `402`, surface an actionable billing message rather than blind retries.

## Examples

### TypeScript SDK

```typescript
import { SocialFetchClient } from "@socialfetch/sdk";

const client = new SocialFetchClient({
  apiKey: process.env.SOCIALFETCH_API_KEY!,
});

const result = await client.npm.getPackage({
  name: "express",
});

if (!result.ok) {
  console.error(result.error);
} else {
  console.log(result.value.data);
}
```

### Node.js

```javascript
const response = await fetch(
  "https://api.socialfetch.dev/v1/npm/package?name=express",
  {
    headers: {
      "x-api-key": "YOUR_API_KEY"
    }
  }
);

const data = await response.json();
console.log(data);
```

### cURL

```bash
curl "https://api.socialfetch.dev/v1/npm/package?name=express" \
  -H "x-api-key: YOUR_API_KEY"
```

### Python

```python
import requests

response = requests.get(
    "https://api.socialfetch.dev/v1/npm/package?name=express",
    headers={"x-api-key": "YOUR_API_KEY"},
)
data = response.json()
print(data)
```