Skip to content

Python & npm libraries

Our SDKs handle authentication, token renewal, request types, and common enrichment workflows so your team can focus on the customer experience around them.

Terminal window
npm install @infiniteaudience/sdk@alpha
import { InfiniteAudience } from '@infiniteaudience/sdk';
const client = new InfiniteAudience({ apiKey: process.env.IA_API_KEY! });
const result = await client.match.microbatch(
[{ row_id: 'customer-1', email: '[email protected]' }],
{ fieldList: ['birth_generation', 'estimated_household_income'] },
);
console.log(result.byRowId('customer-1'));

The file workflow keeps the multi-step upload, matching, delivery, and download process in one readable sequence.

import { readFile } from 'node:fs/promises';
import { InfiniteAudience } from '@infiniteaudience/sdk';
const client = new InfiniteAudience({ apiKey: process.env.IA_API_KEY! });
const csv = await readFile('./customers.csv');
const job = await client.match.file.create({
name: 'Spring customers',
file_format: 'csv',
});
await client.match.file.upload(job, [csv]);
await client.match.file.wait(job.match_id);
const delivery = await client.deliveries.create(job.match_id, {
include_unmatched: true,
});
const finished = await client.deliveries.wait(job.match_id, delivery.delivery_id);
const downloadUrls = client.deliveries.download(finished);

Both libraries turn common API failures into named error classes: insufficient balance, postpay ceiling, rate limits, idempotency conflicts, file-analysis failures, and a general API fallback. Catch only the cases your workflow can recover from and let the rest reach your normal application error handling.

import {
FileAnalysisError,
IdempotencyConflict,
InsufficientBalance,
RateLimited,
} from '@infiniteaudience/sdk';

Both libraries support small record batches, file workflows, delivery status, typed errors, and API-key or OAuth authentication.

For the complete request and response shapes, use the API reference.