| name | scalar-galaxy-typescript-sdk |
| description | TypeScript SDK for Scalar Galaxy API. Use when writing TypeScript code that calls Scalar Galaxy API with the @scalar/galaxy-node package: installing it, constructing and authenticating the client, and calling API operations. |
Scalar Galaxy TypeScript SDK
Generated TypeScript client for Scalar Galaxy API, published as @scalar/galaxy-node. Use the generated client instead of hand-writing HTTP requests.
Install
npm install @scalar/galaxy-node
Client setup and authentication
import Galaxy from '@scalar/galaxy-node';
const client = new Galaxy({
bearerAuth: process.env['BEARER_AUTH'],
environment: 'production',
});
Provide credentials using the options below. Environment variables are read automatically when the target runtime supports them:
bearerAuth (env: BEARER_AUTH) — JWT Bearer token authentication
basicAuthUsername (env: BASIC_AUTH_USERNAME) — Basic HTTP authentication
basicAuthPassword (env: BASIC_AUTH_PASSWORD) — Basic HTTP authentication
apiKeyHeader (env: API_KEY_HEADER) — API key request header
apiKeyQuery (env: API_KEY_QUERY) — API key query parameter
apiKeyCookie (env: API_KEY_COOKIE) — API key browser cookie
oAuth2 (env: SCALAR_O_AUTH2) — OAuth 2.0 authentication
openIDConnect (env: SCALAR_OPEN_ID_CONNECT) — OpenID Connect Authentication
Calling operations
import Galaxy from '@scalar/galaxy-node';
const client = new Galaxy({
bearerAuth: process.env['BEARER_AUTH'],
environment: 'production',
});
const planet = await client.planets.listAllData({
limit: 10,
offset: 0,
});
console.log(planet);
Method names, parameter shapes, and response types are generated from the API description — do not guess them. Look up the exact call signature in api.md before writing a call.
Error handling
Non-success responses throw generated API errors. Error objects expose status, headers, response body, and request metadata where the target runtime supports it.
import { APIError } from '@scalar/galaxy-node';
try {
const planet = await client.planets.listAllData({
limit: 10,
offset: 0,
});
} catch (err) {
if (err instanceof APIError) {
console.log(err.status, err.name, err.headers);
}
throw err;
}
Requirements
- Node.js 20+, a modern browser, or any runtime with
fetch support
Reference files
- README.md — full feature tour: client options, request options, retries and timeouts, logging.
- api.md — complete catalogue of every operation with request and response types.