Skip to content
TTopSend

SDKs

Official client libraries for integrating with the TopSend API.

TypeScript / Node.js

The official TopSend SDK for TypeScript and Node.js provides a fully typed client with built-in error handling, pagination helpers, and idempotency support.

Installation

npm install @topsend/sdk

Quick Start

# The SDK is for Node.js/TypeScript.
# For shell scripts, use cURL directly:
curl https://api.topsend.com/api/v1/health \
-H "Authorization: Bearer tm_live_abc123"

Available Resources

The SDK provides typed methods for all API resources.

ResourceMethodsDescription
topsend.contactslist, get, create, update, deleteManage contacts and their attributes
topsend.listslist, get, create, update, delete, addMembers, removeMembersManage contact lists and memberships
topsend.emailsend, batch, getStatus, getBatchStatusSend emails and check delivery status
topsend.suppressionslist, add, removeManage the email suppression list
topsend.webhookssubscribe, unsubscribe, testManage webhook subscriptions
topsend.trackingproductViewTrack product views and browsing behavior
topsend.conversionslist, createTrack revenue and conversion events
topsend.segmentslist, get, create, update, delete, estimateCount, listContactsCreate and manage audience segments
topsend.tagslist, get, create, update, delete, contacts.assign, contacts.removeTag contacts for organization and automation
topsend.automationslist, get, activate, pause, trigger, listRunsControl automation workflows programmatically
topsend.healthcheckCheck API and service health status

Error Handling

The SDK throws typed errors that you can catch and handle programmatically.

# Check the HTTP status code and error response body:
# {"error": {"code": "validation_error", "message": "..."}}

Configuration

The SDK accepts an optional configuration object for customizing behavior.

# cURL does not use the SDK configuration.
# Set the base URL and headers directly:
curl https://api.topsend.com/api/v1/health \
-H "Authorization: Bearer tm_live_abc123"

Idempotency

For send and batch endpoints, pass an idempotency key to prevent duplicate operations from network retries.

curl -X POST https://api.topsend.com/api/v1/email/send \
-H "Authorization: Bearer tm_live_abc123" \
-H "Idempotency-Key: order-confirmation-12345" \
-H "Content-Type: application/json" \
-d '{"to": "user@example.com", "subject": "Order confirmed", "html": "<p>Done!</p>"}'

Resources

SDKs — Node.js & TypeScript Email API Client | TopSend