Skip to main content
InstantCampaign has two official SDKs. Both wrap the same public API described in the API reference, use your workspace API key, and are built from the same OpenAPI document, so a field the API documents is a field the SDK knows.
Version 0.1.0 covers every public endpoint except the MCP server, which AI assistants connect to directly (MCP server). Method names may still change before 1.0.

Install

Pre-release. Version 0.1.0 of both packages is not yet published to npm or PyPI. Until it is, install from the repository’s sdks/typescript and sdks/python folders, or use the REST API directly. The commands below will work once 0.1.0 is published.

Send your first email

Create a key under Settings → Developers → API Keys with the Transactional — send scope, and keep it in an environment variable called INSTANTCAMPAIGN_API_KEY. Both SDKs read that variable when you do not pass a key.

What is covered

For an endpoint a version does not wrap yet, both clients have a low-level request(method, path, …) that still adds the key, the retries and the typed errors.

Idempotency: safe retries

The API’s idempotency key is the externalId field on transactional sends and on events. A repeat with the same externalId returns the original result (deduplicated: true, or status: "duplicate" for events) and sends or records nothing. The SDKs’ idempotencyKey / idempotency_key option fills in externalId for you; an externalId you set yourself always wins. There is no Idempotency-Key header. The SDKs retry on their own only when it is safe:
  • 429 Rate limit exceeded, on any request, after the Retry-After the server sends (a rate-limited request was not processed).
  • 5xx and network errors, on GET and DELETE only.
A POST that fails with a 5xx is never retried for you. Send it again with the same externalId. Set maxRetries (TypeScript) or max_retries (Python) to change the number of retries; the default is 2.

Errors

Every error response becomes a typed error with status, the API’s machine-readable code, the response body and the request id to quote to support.
A scoped key that lacks a scope gets InsufficientScopeError. Add the scope to the key from Settings → Developers → API Keys (pencil icon → Edit key); the change applies on the key’s next request.

Pagination

Contacts are paged by number and transactional messages by a before cursor. The listAll / list_all helpers walk every page for you:

Options

Never put a workspace API key in code that runs in a browser. For events from a website, use a tracking token and track.js instead.