TypeScript SDK
The @voxburst/sdk package is the official TypeScript/JavaScript client for the VoxBurst API.
Features:
- Full TypeScript support with Zod runtime validation
- Auto-pagination for list endpoints
- Automatic retries with exponential backoff
- Rate limit handling with
Retry-Aftersupport - Tree-shakeable for minimal bundle size
Installation
npm
npm install @voxburst/sdkQuick Start
import { VoxBurstClient } from '@voxburst/sdk'
const client = new VoxBurstClient({
apiKey: process.env.VOXBURST_API_KEY,
})
// Create and schedule a post
const post = await client.posts.create({
content: 'Hello from VoxBurst! 🚀',
platforms: ['TWITTER', 'LINKEDIN'],
accountIds: ['acc_123', 'acc_456'],
scheduledFor: new Date('2026-03-01T14:00:00Z').toISOString(),
})
console.log(`Post created: ${post.id}`)Configuration
const client = new VoxBurstClient({
apiKey: 'sk_live_xxxxxxxxxxxxx',
// Optional: use staging environment
baseUrl: 'https://api-staging.voxburst.io/v1',
// Optional: customize retry behavior
maxRetries: 3,
timeout: 30_000,
})Resources
Posts
// Create a post
const post = await client.posts.create({
content: 'Hello world!',
platforms: ['TWITTER'],
accountIds: ['acc_123'],
})
// Get a post
const post = await client.posts.get('post_abc123')
// List posts (manual pagination)
const { posts, pagination } = await client.posts.list({
status: 'SCHEDULED',
limit: 50,
})
// Auto-paginate through all posts
for await (const post of client.posts.listAll({ status: 'PUBLISHED' })) {
console.log(post.content)
}
// Update a post
const updated = await client.posts.update('post_abc123', {
content: 'Updated content!',
})
// Delete a post
await client.posts.delete('post_abc123')
// Publish immediately
await client.posts.publish('post_abc123')Accounts
// List all connected accounts
const { accounts } = await client.accounts.list()
// Initiate OAuth connection
const { authorizationUrl } = await client.accounts.connect('twitter', {
redirectUri: 'https://yourapp.com/oauth/callback',
})
// Complete OAuth flow
const { account } = await client.accounts.callback('twitter', {
code: 'oauth_code',
state: 'oauth_state',
redirectUri: 'https://yourapp.com/oauth/callback',
})
// Disconnect an account
await client.accounts.disconnect('acc_123')Analytics
// Get post metrics
const metrics = await client.analytics.getPostMetrics('post_abc123')
// Get account metrics
const accountMetrics = await client.analytics.getAccountMetrics('acc_123', {
from: '2026-01-01',
to: '2026-01-31',
})
// Get overview
const overview = await client.analytics.getOverview({
startDate: '2026-01-01',
endDate: '2026-01-31',
})Batch Operations
// Create multiple posts at once (up to 100)
const results = await client.batch.createPosts([
{
content: 'Post 1',
platforms: ['TWITTER'],
accountIds: ['acc_123'],
},
{
content: 'Post 2',
platforms: ['LINKEDIN'],
accountIds: ['acc_456'],
},
])
console.log(`${results.summary.succeeded} posts created`)Error Handling
import { VoxBurstClient, VoxBurstError, RateLimitError, NotFoundError } from '@voxburst/sdk'
try {
await client.posts.create(input)
} catch (error) {
if (error instanceof RateLimitError) {
console.log(`Rate limited. Retry after ${error.retryAfter}s`)
} else if (error instanceof NotFoundError) {
console.log('Resource not found')
} else if (error instanceof VoxBurstError) {
console.log(`API Error: ${error.code} - ${error.message}`)
console.log('Details:', error.details)
}
}The SDK automatically retries on 429 Rate Limited and 5xx Server Error responses with exponential backoff. You only need to handle errors that exhaust all retries.
TypeScript Types
All request and response types are exported from the package:
import type {
Post,
CreatePostParams,
Account,
Platform,
PostStatus,
} from '@voxburst/sdk'Last updated on