
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
The Scale Node.js library provides access to the Scale API from JavaScript/TypeScript.
API reference documentation is available here.
npm install scaleapi
or
yarn add scaleapi
import { ScaleClient } from 'scaleapi';
const scale = new ScaleClient({
token: 'YOUR_API_KEY',
});
const batch = await scale.batches.create({
project: 'project-id',
name: 'My project',
});
console.log('Received response from Scale', response);
You can find your API keys on your dashboard, which you can access by logging in or signing up.
When you constuct the ScaleClient
, you can pass in your API key.
import { ScaleClient } from 'scaleapi';
const scale = new ScaleClient({
token: process.env.SCALE_API_KEY,
});
You can also pass a function:
import { ScaleClient } from 'scaleapi';
const scale = new ScaleClient({
token: getScaleApiKey,
});
function getScaleApiKey() {
...
}
The Scale SDK is crafted to give you a great experience in your IDE. All types are nested
in the Scale
export.
import { ScaleClient, Scale } from 'scaleapi';
const scale = new ScaleClient({
token: process.env.SCALE_API_KEY,
});
const batch: Scale.Batch = await scale.batches.create({
project: 'project-id',
name: 'My project',
});
You'll get autocomplete for methods:
and properties:
The SDK is fully typed. If you're using TypeScript, you'll get compiler errors if misuse the SDK:
When an error is encountered, a ScaleError
is thrown. The error may contain
a message
or a response body
, which you can log to see additional information.
import { ScaleClient, ScaleError } from 'scaleapi';
const scale = new ScaleClient({
token: process.env.SCALE_API_KEY,
});
try {
const batch = await scale.batches.create({
project: 'project-id',
name: 'My project',
});
...
} catch (error) {
if (error instanceof ScaleError) {
console.error("Failed to create batch", error.message, error.body);
} else {
console.error(error);
}
}
The Scale SDK will timeout after 60 seconds. When this happens, a ScaleTimeoutError
is thrown:
import { ScaleClient, ScaleTimeoutError } from 'scaleapi';
const scale = new ScaleClient({
token: process.env.SCALE_API_KEY,
});
try {
const batch = await scale.batches.create({
project: 'project-id',
name: 'My project',
});
...
} catch (error) {
if (error instanceof ScaleTimeoutError) {
console.error("Timed out while trying to create batch.");
} else {
console.error(error);
}
}
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning the package version to a specific version in your package.json file. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!
On the other hand, contributions to the README are always very welcome!
FAQs

The npm package scaleapi receives a total of 1,738 weekly downloads. As such, scaleapi popularity was classified as popular.
We found that scaleapi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.