npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tiktok-ads-kit

v0.2.0

Published

Typed, quirk-aware TikTok Marketing API client — campaign management, reporting, pixels, Smart+ fallbacks.

Readme

tiktok-ads-kit

Typed, quirk-aware TikTok Marketing API client for TypeScript. Campaign management, reporting, pixels, Spark ads, automated rules — with the API's sharp edges absorbed so you don't rediscover them in production.

npm install tiktok-ads-kit
import { createTikTokAds } from "tiktok-ads-kit";

const tiktok = createTikTokAds({
  accessToken: process.env.TIKTOK_ACCESS_TOKEN!,
  advertiserId: process.env.TIKTOK_ADVERTISER_ID!,
});

const campaigns = await tiktok.getCampaigns();
const report = await tiktok.getReport({
  dataLevel: "AUCTION_CAMPAIGN",
  dimensions: ["campaign_id"],
  startDate: "2026-01-01",
  endDate: "2026-01-28",
});

Why this exists

The official SDK is autogenerated and faithfully exposes every quirk of the raw API. This kit encodes the lessons you'd otherwise learn one production incident at a time:

| Quirk | What the kit does | |---|---| | Errors arrive as HTTP 200 with code !== 0 in the body | Parsed and thrown with the real message; transport failures (non-JSON, 5xx) get distinct errors | | Two incompatible filtering formats — entity endpoints take {campaign_ids: [...]}, report endpoints take [{field_name, filter_type, filter_value}] | Each method uses the right one; you pass campaignIds: string[] | | Smart+ campaigns reject standard update endpoints ("This API does not support Upgraded Smart Plus ads") and need /smart_plus/... twins with targeting nested under targeting_spec | Updates fall back automatically | | stat_time_day reports cap at 30-day spans; pixel event stats at 28 days | Documented on the methods; chunk longer windows yourself | | Video info lookups cap at 60 ids per call | Chunked automatically | | All report metric values are strings | Typed honestly as Record<Metric, string> | | Spark ads reference an organic post via tiktok_item_id + identity, not a video_id; their covers come from /identity/video/info/ | getPostInfo() resolves video posters and carousel covers | | Smart+ "ads" are auto-generated variants of one container ad — individually unpausable | Surfaced in docs so you don't fight it |

API surface

Reads: getAdvertiserInfo · getCampaigns · getAdGroups · getAds · getVideoInfo · getPostInfo · getReport · getAudienceReport · getRegionNames · getPixels · getPixelEventStats · getRules

Writes: updateEntityStatus · updateAdGroupBudget · updateAdGroupAgeGroups · updateAdGroupSchedule · createCampaign · createAdGroup (paused by default) · createSparkAd · createRule · uploadVideo

Safety defaults: ad groups are created DISABLEd (you flip them live explicitly), and nothing is cached — bring your own caching layer.

Sandbox

createTikTokAds({
  accessToken,
  advertiserId,
  baseUrl: "https://sandbox-ads.tiktok.com/open_api/v1.3",
});

Related

next-pixels — the other direction: events from your site into TikTok/Meta (pixel + CAPI + first-touch attribution). The two meet at the ttclid.

License

MIT