Skip to main content

SDK Migration Guide

This guide covers the new features in the latest Anima SDKs and how to adopt them. The upgrade is non-breaking — your existing code will continue to work.

What’s New

FeatureDescription
Auto-pagination (PageIterator)Automatically iterate through all pages of results
Environment variable fallbackSDK reads ANIMA_API_KEY if no key is passed
Debug loggingBuilt-in structured logging with ANIMA_LOG
Per-request optionsOverride timeout, headers, and idempotency per call
Raw response accessGet the full HTTP response alongside typed data
Request/response eventsHook into the request lifecycle for observability
Webhook middlewareFramework-native webhook verification

Auto-Pagination (PageIterator)

No more manual cursor management. The new PageIterator handles pagination automatically.

Before

After

Environment Variable Fallback

The SDK now reads configuration from environment variables automatically. The apiKey parameter is now optional — if omitted, the SDK looks for ANIMA_API_KEY.

Before

After

Supported Environment Variables

VariableDescriptionDefault
ANIMA_API_KEYAPI key for authenticationnone
ANIMA_API_URLBase URL for the APIhttps://api.useanima.sh
ANIMA_LOGLog level (debug, info, warn, error)warn

Debug Logging

Enable structured debug logs to inspect HTTP requests, retries, and timing.

Before

After

Per-Request Options

Override client-level settings on a per-request basis. Useful for setting custom timeouts, idempotency keys, or extra headers.

Before

After

Raw Response Access

Access the full HTTP response (status, headers) alongside the parsed body.

Before

After

Request/Response Events

Hook into the SDK’s request lifecycle for logging, metrics, or tracing.

Before

After

Webhook Middleware

Framework-native webhook verification replaces manual signature checking.

Before

After

Breaking Changes

There are no breaking changes in this release. All new features are additive:
  • apiKey / api_key is now optional (falls back to ANIMA_API_KEY), but passing it explicitly still works
  • All existing method signatures remain unchanged
  • New methods (listAutoPaging, withRawResponse) are additions, not replacements

Upgrade Steps

  1. Update your SDK to the latest version:
  1. (Optional) Set ANIMA_API_KEY in your environment and remove hardcoded keys
  2. (Optional) Replace manual pagination loops with listAutoPaging
  3. (Optional) Add ANIMA_LOG=debug during development for visibility

Next Steps