npm Package
Get an npm package version and its dependencies.
GET/api/v1/npm/package
Costs 1 credit per request; failed requests are refunded. Authentication, the search_metadata envelope and error codes are the same as for every endpoint (see the API reference). Try it in the playground.
Parameters
Request parameters
| Parameter | Type | Description |
|---|---|---|
packagerequired | string | npm package name, including an optional scope, such as @vue/server-renderer.Up to 214 characters. |
version | string | Published version or distribution tag. Defaults to latest.Default: latest.Up to 100 characters. |
Response
A JSON object with search_metadata (request id, credits used and remaining) and the result groups the page returns. Groups and fields depend on the content of each page, so treat every field as optional.
Examples
cURL
curl "https://serpfast.com/api/v1/npm/package?package=requests" \
-H "Authorization: Bearer $SERPFAST_KEY"Node.js 18+
const params = new URLSearchParams({
"package": "requests"
});
const res = await fetch(`https://serpfast.com/api/v1/npm/package?${params}`, {
headers: { Authorization: `Bearer ${process.env.SERPFAST_KEY}` },
});
const data = await res.json();
console.log(data);Python
import os, requests
params = {
"package": "requests"
}
res = requests.get(
"https://serpfast.com/api/v1/npm/package",
params=params,
headers={"Authorization": f"Bearer {os.environ['SERPFAST_KEY']}"},
timeout=120,
)
print(res.json())