PBJ SDK documentation

Configuration

Configure authentication, API routing, request deadlines, retry behavior, Solana defaults, and custom transports.

Client options

OptionTypeDefaultDescription
apiKeystringRequiredBearer token included with every request.
baseUrlstringhttps://api.pbjspace.devHTTP(S) API endpoint; base paths are preserved.
timeoutnumber10000Total deadline across attempts, body reading, and retry waits.
maxRetriesnumber2Additional GET attempts after retryable responses.
retryDelaynumber250Initial exponential backoff delay in milliseconds.
maxRetryDelaynumber30000Maximum delay for one retry.
networkdevnet | mainnetdevnetDefault Solana network.
rpcUrlstringCustom RPC endpoint forwarded to PBJ.
fetchtypeof fetchglobalThis.fetchInjected Fetch-compatible transport.

Configuration validation

The constructor rejects an empty API key, non-HTTP URLs, URLs containing credentials, query parameters or fragments, and invalid numeric limits. Numeric settings must be safe integers no larger than 2147483647.

  • timeout must be positive.
  • Retry settings may be zero.
  • maxRetries: 0 disables automatic retries.
  • signal belongs to request options, not client configuration.

Base URL behavior

ts
const pbj = new PBJClient({
  apiKey,
  baseUrl: "https://api.pbjspace.dev/v1",
});

// projects.list() requests:
// https://api.pbjspace.dev/v1/projects

Trailing slashes are normalized, and path identifiers are URL-encoded before requests are sent.

Per-request overrides

Program tracking, wallet activity, and treasury balance requests can override network and rpcUrl. Every request accepts an AbortSignal.

ts
await pbj.wallets.getActivity(address, {
  network: "mainnet",
  rpcUrl: process.env.SOLANA_RPC_URL,
  signal: controller.signal,
});