New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@backwork/api

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@backwork/api

TypeScript/JavaScript SDK for Backwork API - Medicare coverage policies and prior authorization

latest
bootstrap
Source
npmnpm
Version
0.0.0
Version published
Maintainers
1
Created
Source

Backwork TypeScript SDK

Official TypeScript and JavaScript client for the Backwork API: Medicare coverage policies, medical code intelligence, prior authorization checks, claim validation, compliance review, and drug formulary evidence.

The SDK is Promise-based, fully typed, and uses native fetch with an Effect-backed request layer for response parsing, timeouts, and safe retries.

Installation

npm install @backwork/api

Requires Node.js 18 or newer, or a modern browser runtime with fetch.

Quick Start

import { BackworkClient } from '@backwork/api';

const client = new BackworkClient(process.env.BACKWORK_API_KEY!);

const code = await client.lookupCode({
  code: '76942',
  include: ['rvu', 'policies'],
});

console.log(code.data?.description);

const priorAuth = await client.checkPriorAuth({
  procedureCodes: ['76942'],
  diagnosisCodes: ['M54.5'],
  state: 'TX',
  payer: 'medicare',
});

console.log(priorAuth.data?.pa_required);

Get an API key from the Backwork dashboard.

API keys and environment variables

The SDK takes the key as an argument and never reads the environment itself. Read it from BACKWORK_API_KEY in your application configuration:

const apiKey = process.env.BACKWORK_API_KEY;

Core Workflows

Code Lookup

const result = await client.lookupCode({
  code: '76942',
  codeSystem: 'CPT',
  jurisdiction: 'JM',
  include: ['rvu', 'policies', 'rates'],
  fuzzy: true,
});

Policy Search and Retrieval

const policies = await client.listPolicies({
  q: 'ultrasound guidance',
  mode: 'keyword',
  policyType: 'LCD',
  status: 'active',
  limit: 25,
});

const policy = await client.getPolicy('L33831', {
  include: ['criteria', 'codes'],
});

Prior Authorization and Claim Validation

const priorAuth = await client.checkPriorAuth({
  procedureCodes: ['76942'],
  diagnosisCodes: ['M54.5'],
  state: 'TX',
  payer: 'medicare',
});

const claim = await client.validateClaim({
  procedureCodes: ['99213'],
  diagnosisCodes: ['E11.9'],
  payer: 'Medicare',
  state: 'TX',
  dateOfService: '2026-05-23',
});

console.log(claim.data?.coverage_status, claim.data?.denial_risk);
console.log(claim.data?.issues, claim.data?.matched_policies);

Coverage, Spending, and Compliance

const criteria = await client.searchCriteria({
  q: 'diabetes',
  section: 'indications',
  limit: 10,
});
console.log(criteria.data?.[0]?.policy_id, criteria.data?.[0]?.policy_title);

const spending = await client.getSpendingByCode({
  codes: ['T1019', 'T1020'],
  year: 2023,
});

const changes = await client.listUnreviewedChanges({ limit: 10 });
const stats = await client.getComplianceStats();

Drug Formulary Evidence

const formulary = await client.searchDrugFormularyEvidence({
  q: 'ozempic',
  payer: 'all',
  limit: 5,
});

Error Handling

import {
  AuthenticationError,
  NotFoundError,
  RateLimitError,
  ValidationError,
  BackworkError,
} from '@backwork/api';

try {
  const result = await client.lookupCode({ code: '76942' });
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error('Invalid API key');
  } else if (error instanceof ValidationError) {
    console.error('Invalid request:', error.message);
  } else if (error instanceof NotFoundError) {
    console.error('Resource not found');
  } else if (error instanceof RateLimitError) {
    console.error('Rate limit exceeded:', error.reset);
  } else if (error instanceof BackworkError) {
    console.error('Backwork API error:', error.message);
  }
}

Configuration

const client = new BackworkClient({
  apiKey: process.env.BACKWORK_API_KEY!,
  baseUrl: 'https://backworkhealth.com/api/v1',
  timeout: 30_000,
});

Browser Usage

<script type="module">
  import { BackworkClient } from 'https://cdn.skypack.dev/@backwork/api';

  const client = new BackworkClient('bwk_live_YOUR_API_KEY');
  const result = await client.lookupCode({ code: '76942' });
  console.log(result.data);
</script>

Development

npm install
npm run lint
npm run format:check
npm run build
npm test

Release

The package publishes to npm as @backwork/api.

  • Configure npm Trusted Publishing for tylergibbs1/backwork-ts, workflow release.yml, environment npm, package @backwork/api.
  • Update package.json to the new version.
  • Push a matching tag, for example v2.0.0.
  • The release workflow installs with npm ci, runs lint/format/build/tests, runs npm pack --dry-run, and publishes with npm provenance.

npm test runs a structure check by default. Set BACKWORK_API_KEY to run live API smoke checks.

Support

License

MIT

Keywords

backwork

FAQs

Package last updated on 22 Aug 2026

Related posts