Skip to main content
The TikTok Connector API lets an unattended integration deliver audiences to TikTok Ads Manager and send offline conversion events to TikTok Events Manager. A person signs in once to create an API key and once to connect a profile to TikTok, and the integration works from the API key after that. Complete the prerequisites and set up API access on this page before you follow either guide.

Choose a guide

Audience delivery

Upload hashed identifiers and deliver them into a new TikTok audience, or into one that already exists.

Conversion events

Send offline conversion events, such as in-store purchases, to a TikTok Offline Event Set.

Prerequisites

What you need depends on the guide you follow:

API key

Create the key under Settings → API Keys with read and write on datasets and connections, write on uploads, and read on installations. Add read and write on webhooks if you want delivery notifications. See API Keys for the procedure and the Permissions Reference for what each resource covers. Create it from a shared team account rather than a personal login, so the integration keeps working when someone changes roles.

TikTok Connector installed

The TikTok Connector is app 19. Find your installation of it:
Record the installation ID. If no record has "app_id": 19, install the TikTok Connector from the Narrative Marketplace.

A profile connected to TikTok

A connector profile holds the TikTok for Business authorization that every delivery uses. The profile also decides which TikTok advertisers you can deliver to. Create the profile once, in the Narrative UI:
1

Open the connector

In Narrative, go to Installed Apps and select TikTok Connector.
2

Create a profile

In the Profiles tab, create a profile and give it a name.
3

Connect to TikTok

Choose Connect, sign in to TikTok for Business as someone with access to the advertisers you want to deliver to, select those advertisers, and approve the access request.
You can also start the sign-in from the API, once you have an installation token. Ask the connector for the profile’s TikTok authorization URL:
Open the url in a browser before expires_at, which is 24 hours after the request. Sign in to TikTok for Business, select the advertisers, and approve. TikTok then sends the browser to the TikTok connector, which saves the authorization and returns an empty page. To confirm the profile is connected, list its advertisers. You connect a profile once. The profile can then deliver to every advertiser you selected, from any number of connections.

An Offline Event Set ID

Conversion events go to an Offline Event Set in TikTok Events Manager. Create one there for the advertiser that should receive the events, and copy its ID. Each event row you upload carries this ID.

Set up API access

The guides talk to two hosts, and each takes its own credential:

Get an installation token

The TikTok connector authenticates requests with an installation token, which you get by exchanging your API key. Use the installation ID from TikTok Connector installed:
Store access_token as $INSTALLATION_TOKEN. It lasts about three hours, so request a new one at the start of each run of your integration. Confirm that both hosts answer:
Send the API key to api.narrative.io and the installation token to tiktok.narrativeconnectors.com.
API keys contain characters that shells mangle. Read the key from a file or an environment variable rather than pasting it inline.

Find your profile

GET /profiles lists every TikTok profile in your company. To read one:
Use a profile whose status is enabled. Record its id.

List your advertisers

Advertisers are the TikTok advertiser accounts the profile can deliver to, which are the ones selected when the profile was connected:
Record the id of the advertiser you deliver to.

List the audiences in an advertiser

Each record is an audience in that advertiser, with its TikTok audience ID and name. When total_page is more than 1, request the next page. The audience delivery guide uses this list to find audience IDs.

What the connection does

A connection’s quick_settings pick the interface and set how the connection delivers. The fields depend on the interface.

Audiences (audience_first_party)

One interface covers new and existing audiences. Set create_new_for, existing_audiences, or both. An advertiser can appear in create_new_for or in existing_audiences, not in both. The connector creates new audiences on the connection’s first delivery and reuses them for every delivery after that.

Conversion events (conversion_events)

Each event names its event set in tiktok_conversion_event.event_set_id, so the connection has no advertiser or event set setting. The connection sends events up to 90 days old that carry an email address or a phone number.

Existing and new rows

A connection delivers every snapshot written to the dataset after the connection is created. The historical_data_enabled quick setting decides whether the connection also delivers data that was already in the dataset when you created it:
  • With historical_data_enabled set to true, the connection first delivers data already in the dataset, then keeps delivering new snapshots as they land.
  • With historical_data_enabled set to false, the connection delivers only snapshots written after it was created.
How far back the first delivery reaches depends on the connector, and each connector’s guide states it. For TikTok, historical_data_enabled delivers everything in the dataset when the connection is created. After that, each new snapshot is delivered as it lands. An audience connection adds members and never removes them. When you overwrite the dataset, the connection adds the rows in the new snapshot, and members missing from it stay in the audience. A conversion connection sends each event in each snapshot it delivers. Uploading the same events again in a new snapshot sends them again.

Delivery notifications

The TikTok Connector reports each delivery as an app webhook event. Subscribe a webhook to app 19 to receive them:
Keep the secret to verify each delivery. The connector sends these events: Read a subscription with GET /webhooks/{webhook_id}. To stop the notifications, delete the subscription with DELETE /webhooks/{webhook_id}. See App subscription for the subscription fields and Verifying deliveries for checking the secret.

TikTok Connector

Supported identifiers and connector setup

TikTok Conversions API Connector

Conversion event fields, event names, and identifier matching

Webhook Event Reference

Subscription fields, delivery payloads, and verification

API Keys

Create and rotate keys for programmatic access