Skip to main content

SDK Authentication

The SDK manages API tokens for you. Provide credentials once during initialization; the SDK requests and attaches the bearer token to all calls. It also refreshes the token when needed.

Configure

  • Node (JS/TS)
  • Python
import { IdCanopy } from "idcanopy-sdk";

const canopy = new IdCanopy({
  apiKey: process.env.IDCANOPY_API_KEY!,
  customerId: process.env.IDCANOPY_CUSTOMER_ID!,
  environment: "sandbox" // or "production"
});

// Optional: prefetch on startup
await canopy.auth.getToken();
Under the hood, the SDK calls the same /auth endpoint documented in API Authentication and caches the token until it expires.