Skip to content
Eight Effect-native API SDKs are live.Explore the catalog
Distilled
Esc
navigateopen⌘Jpreview
On this page

Basis Theory SDK

Install, authenticate, and manage sensitive-data workflows through Basis Theory with Effect.

Public package OpenAPI 3.0.1 117 operations

The Basis Theory SDK pins the official API contract and keeps API-key redaction, production/test addressing, problem-details errors, and retry policy in the handwritten provider layer.

Install

npm install @kevinmichaelchen/distilled-basis-theory effect
pnpm add @kevinmichaelchen/distilled-basis-theory effect
bun add @kevinmichaelchen/distilled-basis-theory effect

Authentication

Variable Purpose
BASIS_THEORY_API_KEY Private application key sent as BT-API-KEY
BASIS_THEORY_API_URL Optional API base URL; use https://api.test.basistheory.com for test tenants

Use the narrowest application permissions your workflow needs. Never place real cardholder data or other sensitive production values in source code, fixtures, logs, or metadata.

Quickstart

Search for tokens belonging to a customer without retrieving every vault entry:

import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
import {
  CredentialsFromEnv,
  tokensSearchV2,
} from "@kevinmichaelchen/distilled-basis-theory";

const BasisTheoryLive = Layer.mergeAll(
  FetchHttpClient.layer,
  CredentialsFromEnv,
);

const program = tokensSearchV2({
  query: "metadata.customer_id:cus_12345",
  size: 20,
});

const tokens = await Effect.runPromise(
  Effect.provide(program, BasisTheoryLive),
);

Source and package

Last updated on July 15, 2026

Was this page helpful?