Get a package from npm
Answers whether a package exists on the public npm registry, the version a selector resolves to, its licence, whether it has an install script and whether it is deprecated. exists is null when the registry could not be asked.
Query parameters
The package's name on the npm registry, with its @scope/ when it has one. Lower case, at most 214 characters; not a URL, a git address, a file or a tarball.
A version, a range written without spaces or a tag, such as 0.34, ^1.90 or latest, at most 64 characters. Left out, the newest version is looked up.
Returns
200 What the registry says about the package.
Fields of the 200 answer
The deprecation notice, when the version is deprecated.
Null when the registry could not be asked.
The version the selector resolves to now.
If it is refused
| Status | Reason | What to do |
|---|---|---|
401 | none | Send a valid token as Authorization: Bearer <token>. |
403 | company_unavailable | Your company is unavailable. |
403 | scope_required | Use a token with the scope named in scope. |
403 | two_factor_required | Turn on two-factor on your account, then send again. |
404 | feature_off | This feature is not on for your organisation yet. |
422 | invalid_arguments | The arguments do not match the tool's input schema, or the Control Panel refused a field. Fix the fields named in the answer and call again. |
422 | package_spec_invalid | A package comes from the npm registry by name: no URL, git, GitHub, file, link, npm alias or workspace spec. |
429 | rate_limited | Wait for the seconds in Retry-After. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
curl 'https://manage.corefinity.com/api/corestack/node/packages/lookup?name=sharp' \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json"use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->get('https://manage.corefinity.com/api/corestack/node/packages/lookup?name=sharp');
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/corestack/node/packages/lookup?name=sharp', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
},
});
// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);import os
import requests
res = requests.get(
"https://manage.corefinity.com/api/corestack/node/packages/lookup?name=sharp",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
)
data = res.json() if res.content else None{
"deprecated": null,
"description": "High performance image processing",
"exists": true,
"has_install_script": true,
"latest": "0.34.4",
"licence": "Apache-2.0",
"resolved_version": "0.34.4"
}{
"message": "Unauthenticated."
}{
"code": "company_unavailable",
"message": "Your company is unavailable.",
"reason": "company_unavailable"
}{
"code": "feature_off",
"message": "Not found.",
"reason": "feature_off"
}{
"code": "invalid_arguments",
"errors": {
"name": [
"Name the package to look up."
]
},
"field": "name",
"message": "Name the package to look up.",
"reason": "invalid_arguments"
}{
"code": "rate_limited",
"message": "Too many requests. Try again in 60 seconds.",
"reason": "rate_limited",
"retry_after_seconds": 60
}