Skip to main content

SDKConfig

Pass a config object to the VulcxSDK constructor:
import { VulcxSDK } from "@vulcx/sdk";

const sdk = new VulcxSDK({
  apiKey: "vulcx_your_api_key",
  baseUrl: "https://api.vulcx.xyz",
  timeout: 30000,
  retries: 2,
});

Options

OptionTypeDefaultRequiredDescription
apiKeystringyesYour Vulcx API key. Sent as Authorization: Bearer <apiKey>.
baseUrlstring"https://api.vulcx.xyz"noAPI base URL. Trailing slashes are stripped automatically.
timeoutnumber30000noPer-request timeout in milliseconds. Uses AbortController.
retriesnumber2noNumber of retry attempts for retryable errors (429, 5xx, network failures). Total attempts = retries + 1.

Retry Behavior

The SDK retries automatically on transient failures:
ConditionRetriedBackoff
HTTP 429 (rate limit)yesExponential: 1s, 2s, 4s, … (max 8s)
HTTP 5xx (server error)yesExponential: 1s, 2s, 4s, … (max 8s)
Network error / timeoutyesExponential: 1s, 2s, 4s, … (max 8s)
HTTP 400 (bad request)no
HTTP 401/403 (auth)no
HTTP 404 (no route)no
With the default retries: 2, the SDK makes up to 3 attempts before throwing.

Self-Hosted API

If you run your own route-engine instance, point the SDK at it:
const sdk = new VulcxSDK({
  apiKey: "any-value",
  baseUrl: "http://localhost:8080",
});
Last modified on July 5, 2026