TikTok for Developers

Developer Docs

Last updated October 22, 2026

In-App Ads

Create and manage rewarded video and interstitial ad instances with event-driven lifecycle callbacks.

TTMinis.createRewardedVideoAd(options)

Creates a rewarded video ad instance.

Parameters

Field

Type

Description

Required

adUnitId

string

The ad unit ID.

Yes

Returns

A RewardedVideoAd instance with the following methods:

Method

Description

show(): Promise<void>

Displays the ad.

onClose(callback)

Listens for the ad close event. The callback receives { isEnded?: boolean }.

offClose(callback)

Removes the ad close event listener.

onError(callback)

Listens for the ad error event. The callback receives { error_code, error_msg, sub_error_code? }.

offError(callback)

Removes the ad error event listener.

Example

const rewardedAd = TTMinis.createRewardedVideoAd({
  adUnitId: 'rewarded_ad_unit_001',
});

rewardedAd.onClose(function (res) {
  if (res.isEnded) {
    console.log('User watched the rewarded video to the end');
  } else {
    console.log('User closed the rewarded video early');
  }
});

rewardedAd.onError(function (err) {
  console.error('rewardedAd error:', err);
});

rewardedAd.show().catch(function (err) {
  console.error('rewardedAd show failed:', err);
});

TTMinis.createInterstitialAd(options)

Creates an interstitial ad instance.

Parameters

Field

Type

Description

Required

adUnitId

string

The ad unit ID.

Yes

Returns

An InterstitialAd instance with the following methods:

Method

Description

show(): Promise<void>

Displays the ad.

onClose(callback)

Listens for the ad close event.

offClose(callback)

Removes the ad close event listener.

onError(callback)

Listens for the ad error event. The callback receives { error_code, error_msg, sub_error_code? }.

offError(callback)

Removes the ad error event listener.

Example

const interstitialAd = TTMinis.createInterstitialAd({
  adUnitId: 'interstitial_ad_unit_001',
});

interstitialAd.onClose(function () {
  console.log('interstitial ad closed');
});

interstitialAd.onError(function (err) {
  console.error('interstitialAd error:', err);
});

interstitialAd.show().catch(function (err) {
  console.error('interstitialAd show failed:', err);
});
TikTok for Developers