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
| Feature | Description |
|---|---|
Auto-pagination (PageIterator) | Automatically iterate through all pages of results |
| Environment variable fallback | SDK reads ANIMA_API_KEY if no key is passed |
| Debug logging | Built-in structured logging with ANIMA_LOG |
| Per-request options | Override timeout, headers, and idempotency per call |
| Raw response access | Get the full HTTP response alongside typed data |
| Request/response events | Hook into the request lifecycle for observability |
| Webhook middleware | Framework-native webhook verification |
Auto-Pagination (PageIterator)
No more manual cursor management. The newPageIterator handles pagination automatically.
Before
After
Environment Variable Fallback
The SDK now reads configuration from environment variables automatically. TheapiKey parameter is now optional — if omitted, the SDK looks for ANIMA_API_KEY.
Before
After
Supported Environment Variables
| Variable | Description | Default |
|---|---|---|
ANIMA_API_KEY | API key for authentication | none |
ANIMA_API_URL | Base URL for the API | https://api.useanima.sh |
ANIMA_LOG | Log 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_keyis now optional (falls back toANIMA_API_KEY), but passing it explicitly still works- All existing method signatures remain unchanged
- New methods (
listAutoPaging,withRawResponse) are additions, not replacements
Upgrade Steps
- Update your SDK to the latest version:
- (Optional) Set
ANIMA_API_KEYin your environment and remove hardcoded keys - (Optional) Replace manual pagination loops with
listAutoPaging - (Optional) Add
ANIMA_LOG=debugduring development for visibility
Next Steps
- Official SDKs — Full SDK reference for TypeScript and Python
- Go SDK — Go SDK documentation
- Webhooks — Webhook event reference
- Examples — Complete runnable examples
