@instantlyai/sdk
v1.0.0-beta.1
Published
Official TypeScript SDK for the Instantly API.
Readme
Instantly TypeScript SDK
The official TypeScript SDK for the Instantly API.
This is a beta release. The concise resource API is ready to test, but may receive minor refinements before the stable
1.0.0release.
Install
npm install @instantlyai/sdk@betaThe SDK requires Node.js 22 or later and works with TypeScript or JavaScript.
Quick start
import { Instantly, type CreateCampaign } from '@instantlyai/sdk';
const instantly = new Instantly({
apiKey: process.env.INSTANTLY_API_KEY,
});
const campaign: CreateCampaign = {
name: 'My campaign',
campaign_schedule: {
schedules: [],
},
};
const created = await instantly.campaigns.create(campaign);
const campaigns = await instantly.campaigns.list({
limit: 10,
search: 'campaign',
});
await instantly.campaigns.update(created.id, {
name: 'Updated campaign',
});
await instantly.campaigns.delete(created.id);Keep API keys in a secure server-side environment. Do not embed them in browser bundles or public source code.
Client configuration
Instantly accepts the generated client's configuration options, including basePath, custom headers, middleware,
and a custom fetchApi implementation.
const instantly = new Instantly({
apiKey: process.env.INSTANTLY_API_KEY,
headers: {
'User-Agent': 'my-integration/1.0',
},
});Errors
Non-successful API responses throw ResponseError. Its response property is the standard Fetch API Response.
import { ResponseError } from '@instantlyai/sdk';
try {
await instantly.campaigns.list({ limit: 10 });
} catch (error) {
if (error instanceof ResponseError) {
console.error(error.response.status, await error.response.text());
}
throw error;
}Generated resources and types
Resource namespaces such as instantly.campaigns are derived automatically from the OpenAPI schema. Concise methods
accept path parameters and request bodies directly, while query parameters remain in an options object. Editor hover
information includes each endpoint's description, HTTP method, path, and original generated method.
The original OpenAPI Generator methods are also available for advanced use, such as
instantly.campaigns.listCampaign().
See the API documentation for all resources, request fields, and responses. Release notes are available in the changelog.
