Modern TypeScript SDK for the TikTok Business API with strict type checking and Deno support.
import { ApiClient } from "https://deno.land/x/tiktok_business_api_sdk/mod";
Or specify a version:
import { ApiClient } from "https://deno.land/x/tiktok_business_api_sdk@0.1.0/mod";
import { ApiClient, AdApi } from "https://deno.land/x/tiktok_business_api_sdk/mod";
// Get singleton instance
const client = ApiClient.instance;
// Configure the client
client.basePath = 'https://business-api.tiktok.com';
client.timeout = 30000;
// Set up OAuth2 authentication
client.authentications['oauth2'] = {
type: 'oauth2',
accessToken: 'YOUR_ACCESS_TOKEN'
};
// Create API instance
const adApi = new AdApi();
// Make API calls
try {
const response = await adApi.getAd({
advertiser_id: '123456',
ad_id: '789012'
});
console.log(response);
} catch (error) {
console.error('Error:', error);
}
- Full TypeScript support with strict typing
- Native Deno integration
- ESM modules
- Promise-based async/await API
- Comprehensive error handling
- Built-in TypeScript definitions
- No external dependencies
The SDK provides access to all TikTok Business API endpoints:
- Ad Management
- Campaign Management
- Audience Management
- Creative Management
- Report Generation
- And more...
- Deno 1.38.0 or higher
deno test --allow-net
deno bundle mod.ts dist/mod.js
- Fork it
- Create your feature branch (
git checkout -b feature/my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin feature/my-new-feature
) - Create new Pull Request
MIT