### Get Smart Plus Material Report Overview (Python) Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/python_sdk/docs/ReportingApi.md This Python code snippet demonstrates how to use the business_api_client SDK to fetch an overview of material reports for a given advertiser ID. It includes optional parameters for filtering, sorting, and pagination. Ensure you have the business_api_client library installed and are properly authenticated. ```python from __future__ import print_function import time import business_api_client from business_api_client.rest import ApiException from pprint import pprint # create an instance of the API class api_instance = business_api_client.ReportingApi() advertiser_id = 'advertiser_id_example' # str | dimensions = ['dimensions_example'] # list[str] | access_token = 'access_token_example' # str | Authorized access token. For details, see [Authentication](https://ads.tiktok.com/marketing_api/docs?id=1738373164380162). metrics = ['metrics_example'] # list[str] | (optional) start_date = 'start_date_example' # str | (optional) end_date = 'end_date_example' # str | (optional) query_lifetime = False # bool | (optional) (default to false) filtering = business_api_client.FilteringSmartPlusMaterialReportOverview() # FilteringSmartPlusMaterialReportOverview | (optional) sort_field = 'spend' # str | (optional) (default to spend) sort_type = 'DESC' # str | (optional) (default to DESC) page = 1 # int | (optional) (default to 1) page_size = 10 # int | (optional) (default to 10) try: # Get overview of material reports [Smart Plus Material Report Overview] api_response = api_instance.smart_plus_material_report_overview(advertiser_id, dimensions, access_token, metrics=metrics, start_date=start_date, end_date=end_date, query_lifetime=query_lifetime, filtering=filtering, sort_field=sort_field, sort_type=sort_type, page=page, page_size=page_size) pprint(api_response) except ApiException as e: print("Exception when calling ReportingApi->smart_plus_material_report_overview: %s\n" % e) ``` -------------------------------- ### Install and Deploy SDK via Maven Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/java_sdk/README.md Commands to build, install, or deploy the SDK to local or remote Maven repositories. These commands ensure the library is correctly compiled and available for project use. ```shell mvn clean install mvn clean deploy mvn clean package ``` -------------------------------- ### Get Product Sets using CatalogApi in Python Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/python_sdk/docs/CatalogApi.md This code example shows how to retrieve product sets using the CatalogApi. It requires catalog ID, business center ID, and an access token. Optional parameters include product set ID and a flag to return product counts. Error handling for API exceptions is included. ```python from __future__ import print_function import time import business_api_client from business_api_client.rest import ApiException from pprint import pprint # create an instance of the API class api_instance = business_api_client.CatalogApi() catalog_id = 'catalog_id_example' # str | bc_id = 'bc_id_example' # str | access_token = 'access_token_example' # str | Authorized access token. For details, see [Authentication](https://ads.tiktok.com/marketing_api/docs?id=1738373164380162). product_set_id = 'product_set_id_example' # str | (optional) return_product_count = true # bool | (optional) (default to true) try: # Get product sets. [Catalog Set Get](https://business-api.tiktok.com/portal/docs?id=1740570556295169) api_response = api_instance.catalog_set_get(catalog_id, bc_id, access_token, product_set_id=product_set_id, return_product_count=return_product_count) pprint(api_response) except ApiException as e: print("Exception when calling CatalogApi->catalog_set_get: %s\n" % e) ``` -------------------------------- ### Install TikTok Business API SDK (Shell) Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/js_sdk/README.md Commands to clone the TikTok Business API SDK repository and install its Javascript dependencies using npm. ```shell git clone https://github.com/tiktok/tiktok-business-api-sdk.git cd your_path/tiktok-business-api-sdk/js_sdk npm install npm install your_path/tiktok-business-api-sdk/js_sdk --save ``` -------------------------------- ### Install TikTok Business API SDK Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/README.md Provides commands to install the official TikTok Business API SDK using pip or by cloning the repository and setting up a virtual environment. ```shell pip install tiktok-business-api-sdk-official # Alternative manual setup git clone https://github.com/tiktok/tiktok-business-api-sdk.git python3 -m venv your_virtual_env source your_virtual_env/bin/activate export PYTHONPATH=your_path/tiktok-business-api-sdk:your_path/tiktok-business-api-sdk/python_sdk:your_path/tiktok-business-api-sdk/python_sdk/business_api_client cd your_path/tiktok-business-api-sdk/python_sdk pip install -r requirements.txt python3 setup.py install ``` -------------------------------- ### Initialize and Use AccountApi Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/java_sdk/README.md A Java example demonstrating how to instantiate the AccountApi client and perform an advertiser update request using an access token. ```java import business_api.*; import business_api.auth.*; import business_api_client.*; import io.swagger.client.api.AccountApi; public class AccountApiExample { public static void main(String[] args) { AccountApi apiInstance = new AccountApi(); String accessToken = "accessToken_example"; AdvertiserUpdateBody body = new AdvertiserUpdateBody(); try { Response result = apiInstance.advertiserUpdate(accessToken, body); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling AccountApi#advertiserUpdate"); e.printStackTrace(); } } } ``` -------------------------------- ### Get Ad Group Details - JavaScript Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/js_sdk/docs/AdgroupApi.md This code example shows how to retrieve details for a specific ad group using the Smart Plus AdGroup Get API. It requires an advertiser ID and an access token, with optional parameters for filtering, pagination, and fields. The function returns ad group data or errors. ```javascript import {js_sdk} from 'business_api_client'; let apiInstance = new js_sdk.AdgroupApi(); let advertiser_id = "advertiser_id_example"; // String | let Access_Token = "Access_Token_example"; // String | Authorized access token. For details, see [Authentication](https://ads.tiktok.com/marketing_api/docs?id=1738373164380162). let opts = { 'filtering': new js_sdk.FilteringSmartPlusAdgroupGet(), // FilteringSmartPlusAdgroupGet | 'page': 1, // Number | 'page_size': 10, // Number | 'fields': ["fields_example"] // [String] | }; apiInstance.smartPlusAdgroupGet(advertiser_id, Access_Token, opts, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } }); ``` -------------------------------- ### Get Discovery Detail for Hashtag (JavaScript) Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/js_sdk/docs/CreativeManagementApi.md This example shows how to retrieve detailed information about a popular hashtag using the CreativeManagementApi. It requires a hashtag ID, discovery type, country code, date range, advertiser ID, and an access token. ```javascript import {js_sdk} from 'business_api_client'; let apiInstance = new js_sdk.CreativeManagementApi(); let hashtag_id = "hashtag_id_example"; // String | let discovery_type = "discovery_type_example"; // String | let country_code = "country_code_example"; // String | let date_range = "date_range_example"; // String | let advertiser_id = "advertiser_id_example"; // String | let Access_Token = "Access_Token_example"; // String | Authorized access token. For details, see [Authentication](https://ads.tiktok.com/marketing_api/docs?id=1738373164380162). apiInstance.discoveryDetail(hashtag_id, discovery_type, country_code, date_range, advertiser_id, Access_Token, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } }); ``` -------------------------------- ### Create Product Catalog via Python SDK Source: https://context7.com/tiktok/tiktok-business-api-sdk/llms.txt Initializes a new product catalog for dynamic product ads. Requires Business Center ID and vertical type configuration. ```python from business_api_client import CatalogApi, CatalogCreateBody from business_api_client.rest import ApiException api_instance = CatalogApi() ACCESS_TOKEN = "YOUR_ACCESS_TOKEN" body = CatalogCreateBody( bc_id="YOUR_BC_ID", catalog_name="E-commerce Products", vertical_type="ECOMMERCE", location_ids=["6252001"], currency="USD" ) try: response = api_instance.catalog_create(ACCESS_TOKEN, body=body) print(f"Catalog ID: {response['data']['catalog_id']}") except ApiException as e: print(f"Exception: {e}") ``` -------------------------------- ### Get Adgroups using TikTok Business API (Java) Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/java_sdk/docs/AdgroupApi.md This code example shows how to retrieve a list of adgroups using the AdgroupApi in Java. It requires an advertiser ID and an access token, and allows for optional filtering, pagination, and field selection. The response includes adgroup details. ```java import business_api.ApiException; import io.swagger.client.api.AdgroupApi; import io.swagger.client.model.FilteringAdgroupGet; import io.swagger.client.model.Response; import java.util.Arrays; import java.util.List; AdgroupApi apiInstance = new AdgroupApi(); String advertiserId = "advertiserId_example"; // String | String accessToken = "accessToken_example"; // String | Authorized access token. For details, see [Authentication](https://ads.tiktok.com/marketing_api/docs?id=1738373164380162). FilteringAdgroupGet filtering = new FilteringAdgroupGet(); // FilteringAdgroupGet | Integer page = 1; // Integer | Integer pageSize = 10; // Integer | List fields = Arrays.asList("fields_example"); // List | List excludeFieldTypesInResponse = Arrays.asList("excludeFieldTypesInResponse_example"); // List | try { Response result = apiInstance.adgroupGet(advertiserId, accessToken, filtering, page, pageSize, fields, excludeFieldTypesInResponse); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling AdgroupApi#adgroupGet"); e.printStackTrace(); } ``` -------------------------------- ### Initialize ToolApi Client in Java Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/java_sdk/docs/ToolApi.md Demonstrates how to instantiate the ToolApi class and prepare the required parameters for API requests. This includes setting up campaign objectives, promotion types, and authentication tokens. ```java ToolApi apiInstance = new ToolApi(); String advertiserId = "advertiserId_example"; String objectiveType = "objectiveType_example"; String promotionType = "promotionType_example"; List placements = Arrays.asList("placements_example"); String accessToken = "accessToken_example"; String pixelId = "pixelId_example"; String appId = "appId_example"; String optimizationEvent = "optimizationEvent_example"; String ios14QuotaType = "ios14QuotaType_example"; String appPromotionType = "appPromotionType_example"; String storeId = "storeId_example"; String campaignAppProfilePageState = "campaignAppProfilePageState_example"; Boolean isSmartPerformanceCampaign = true; Boolean budgetOptimizeOn = false; String campaignType = "campaignType_example"; try { // API call logic would follow here } catch (Exception e) { e.printStackTrace(); } ``` -------------------------------- ### Get GMV Max Report (Java) Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/java_sdk/docs/ReportingApi.md Retrieves the GMV Max report data. This method requires advertiser ID, store IDs, dimensions, metrics, start and end dates, and an access token. Optional parameters include filtering, sorting, pagination, and total metrics. ```java ReportingApi apiInstance = new ReportingApi(); String advertiserId = "advertiserId_example"; // String | List storeIds = Arrays.asList("storeIds_example"); // List | List dimensions = Arrays.asList("dimensions_example"); // List | List metrics = Arrays.asList("metrics_example"); // List | String startDate = "startDate_example"; // String | String endDate = "endDate_example"; // String | String accessToken = "accessToken_example"; // String | Authorized access token. For details, see [Authentication](https://ads.tiktok.com/marketing_api/docs?id=1738373164380162). Boolean enableTotalMetrics = false; // Boolean | FilteringGmvMaxReportGet filtering = new FilteringGmvMaxReportGet(); // FilteringGmvMaxReportGet | String sortField = "sortField_example"; // String | String sortType = "DESC"; // String | Long page = 1L; // Long | Long pageSize = 10L; // Long | ContextInfoGmvMaxReportGet contextInfo = new ContextInfoGmvMaxReportGet(); // ContextInfoGmvMaxReportGet | try { Response result = apiInstance.gmvMaxReportGet(advertiserId, storeIds, dimensions, metrics, startDate, endDate, accessToken, enableTotalMetrics, filtering, sortField, sortType, page, pageSize, contextInfo); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling ReportingApi#gmvMaxReportGet"); e.printStackTrace(); } ``` -------------------------------- ### Initialize and Test ToolApi in Java Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/README.md Demonstrates how to instantiate the ToolApi class and call the toolLanguage method using an access token and advertiser ID. ```java import io.swagger.client.api.ToolApi; import business_api.Response; public class ToolTest { public static void main(String[] args) { ToolApi apiInstance = new ToolApi(); String accessToken = "Your_accessToken_id"; String advertiserId = "Your_advertiser_id"; try { Response result = apiInstance.toolLanguage(advertiserId, accessToken); System.out.println(result); } catch (Exception e) { e.printStackTrace(); } } } ``` -------------------------------- ### Get BC Members using TikTok Business API SDK (JavaScript) Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/js_sdk/docs/BCApi.md This example shows how to retrieve a list of members associated with a Business Center account. It requires the business center ID and an access token, with optional parameters for further filtering. The code includes standard error handling. ```javascript import {js_sdk} from 'business_api_client'; let apiInstance = new js_sdk.BCApi(); let bc_id = "bc_id_example"; // String | let Access_Token = "Access_Token_example"; // String | Authorized access token. For details, see [Authentication](https://ads.tiktok.com/marketing_api/docs?id=1738373164380162). let opts = { // Any additional options for filtering or pagination can be added here }; apiInstance.bcMemberGet(bc_id, Access_Token, opts, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } }); ``` -------------------------------- ### POST /open_api/v1.3/catalog/create/ Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/js_sdk/docs/CatalogApi.md Creates a new product catalog by specifying name, targeted locations, and currency. ```APIDOC ## POST /open_api/v1.3/catalog/create/ ### Description Creates a new catalog for managing products. ### Method POST ### Endpoint /open_api/v1.3/catalog/create/ ### Parameters #### Request Body - **name** (string) - Required - The name of the catalog. - **currency** (string) - Required - The currency code for the catalog. - **location_id** (string) - Required - The targeted location identifier. ### Request Example { "name": "New Catalog", "currency": "USD", "location_id": "US" } ### Response #### Success Response (200) - **catalog_id** (string) - The ID of the newly created catalog. #### Response Example { "code": 0, "message": "OK", "data": { "catalog_id": "987654321" } } ``` -------------------------------- ### Create Ad ACO using Java SDK Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/README.md This snippet demonstrates how to initialize the Ad ACO body, configure media information (images and videos), set call-to-action parameters, and execute the API request to create the ad. ```java commonMaterial.setCreativeAuthorized(true); commonMaterial.setCallToActionId("CALL_TO_ACTION_ID"); commonMaterial.setIdentityId("IDENTITY_ID"); commonMaterial.setIdentityType("CUSTOMIZED_USER"); AdAcoBodyMediaInfo mediaInfo = new AdAcoBodyMediaInfo(); AdAcoBodyMediaInfoImageInfo imageInfo = new AdAcoBodyMediaInfoImageInfo(); imageInfo.setWebUri("IMAGE_URI"); AdAcoBodyMediaInfoVideoInfo videoInfo = new AdAcoBodyMediaInfoVideoInfo(); videoInfo.setVideoId("VIDEO_ID"); videoInfo.setFileName("VIDEO_FILE_NAME"); mediaInfo.setVideoInfo(videoInfo); mediaInfo.setImageInfo(Arrays.asList(imageInfo)); AdAcoBodyMediaInfoList mediaInfoList = new AdAcoBodyMediaInfoList(); mediaInfoList.setMediaInfo(mediaInfo); AdAcoBodyTitleList titleList = new AdAcoBodyTitleList(); titleList.setTitle("Sample Title"); AdAcoBodyDisplayNameList displayNameList = new AdAcoBodyDisplayNameList(); displayNameList.setAppName("Sample App"); AdAcoBodyDeeplinkList deeplinkList = new AdAcoBodyDeeplinkList(); deeplinkList.setDeeplinkType("NORMAL"); deeplinkList.setDeeplink("https://www.example.com"); body.setAdgroupId(adgroupId); body.setAdvertiserId(advertiserId); body.setCommonMaterial(commonMaterial); body.setMediaInfoList(Arrays.asList(mediaInfoList)); body.setTitleList(Arrays.asList(titleList)); body.setDisplayNameList(Arrays.asList(displayNameList)); body.setDeeplinkList(Arrays.asList(deeplinkList)); try { Response result = adAcoInstance.adAcoCreate(accessToken, body); System.out.println("Ad ACO Created Successfully: " + result); } catch (Exception e) { System.err.println("Exception when calling AdAcoApi#adAcoCreate"); e.printStackTrace(); } ``` -------------------------------- ### Get Unpaid Invoices using TikTok Business API SDK (JavaScript) Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/js_sdk/docs/BCApi.md This example shows how to retrieve the total unpaid invoice amount for a Business Center account. It requires the business center ID, invoice type, and an access token. The code includes error handling and logs the successful API response. ```javascript import {js_sdk} from 'business_api_client'; let apiInstance = new js_sdk.BCApi(); let bc_id = "bc_id_example"; // String | let invoice_type = "invoice_type_example"; // String | let Access_Token = "Access_Token_example"; // String | Authorized access token. For details, see [Authentication](https://ads.tiktok.com/marketing_api/docs?id=1738373164380162). apiInstance.bcInvoiceUnpaidGet(bc_id, invoice_type, Access_Token, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } }); ``` -------------------------------- ### Get Ads using TikTok Business API SDK (JavaScript) Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/js_sdk/docs/AdApi.md This code example shows how to retrieve a list of ads using the AdApi's adGet method. It requires an advertiser ID and an access token. Optional parameters include filtering, pagination (page, page_size), and fields to include or exclude in the response. ```javascript import {js_sdk} from 'business_api_client'; let apiInstance = new js_sdk.AdApi(); let advertiser_id = "advertiser_id_example"; // String | let Access_Token = "Access_Token_example"; // String | Authorized access token. For details, see [Authentication](https://ads.tiktok.com/marketing_api/docs?id=1738373164380162). let opts = { 'filtering': new js_sdk.FilteringAdGet(), // FilteringAdGet | 'page': 1, // Number | 'page_size': 10, // Number | 'fields': ["fields_example"], // [String] | 'exclude_field_types_in_response': ["exclude_field_types_in_response_example"] // [String] | }; apiInstance.adGet(advertiser_id, Access_Token, opts, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } }); ``` -------------------------------- ### Initialize TikTok Business API Tool Client Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/js_sdk/docs/ToolApi.md This snippet demonstrates how to instantiate the ToolApi client and prepare the configuration object for campaign settings. It highlights the dependencies between objective types, promotion types, and tracking identifiers required for successful API requests. ```javascript import {js_sdk} from 'business_api_client'; let apiInstance = new js_sdk.ToolApi(); let advertiser_id = "advertiser_id_example"; let objective_type = "objective_type_example"; let promotion_type = "promotion_type_example"; let placements = ["placements_example"]; let Access_Token = "Access_Token_example"; let opts = { 'pixel_id': "pixel_id_example", 'app_id': "app_id_example", 'optimization_event': "optimization_event_example", 'ios14_quota_type': "ios14_quota_type_example", 'app_promotion_type': "app_promotion_type_example", 'store_id': "store_id_example", 'campaign_app_profile_page_state': "campaign_app_profile_page_state_example", 'is_smart_performance_campaign': true, 'budget_optimize_on': false, 'campaign_type': "campaign_type_example" }; ``` -------------------------------- ### Python: Get Business Center Balance using BCApi Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/python_sdk/docs/BCApi.md This code example shows how to retrieve the balance of a TikTok Business Center using the bc_balance_get method. It requires the Business Center ID and an authorized access token, with an optional parameter for child Business Center ID. Includes error handling for API calls. ```python from __future__ import print_function import time import business_api_client from business_api_client.rest import ApiException from pprint import pprint # create an instance of the API class api_instance = business_api_client.BCApi() bc_id = 'bc_id_example' # str | access_token = 'access_token_example' # str | Authorized access token. For details, see [Authentication](https://ads.tiktok.com/marketing_api/docs?id=1738373164380162). child_bc_id = 'child_bc_id_example' # str | (optional) try: # Get the balance of a Business Center. [BC Balance Get](https://business-api.tiktok.com/portal/docs?id=1739939128198145) api_response = api_instance.bc_balance_get(bc_id, access_token, child_bc_id=child_bc_id) pprint(api_response) except ApiException as e: print("Exception when calling BCApi->bc_balance_get: %s\n" % e) ``` -------------------------------- ### Create an Ad Account with BcApi Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/java_sdk/docs/BcApi.md Demonstrates how to initialize the BcApi client and invoke the bcAdvertiserCreate method. It requires a valid access token and an AdvertiserCreateBody object to define the new ad account parameters. ```java BcApi apiInstance = new BcApi(); String accessToken = "accessToken_example"; AdvertiserCreateBody body = new AdvertiserCreateBody(); try { Response result = apiInstance.bcAdvertiserCreate(accessToken, body); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling BcApi#bcAdvertiserCreate"); e.printStackTrace(); } ``` -------------------------------- ### Create a Creative Portfolio using Java Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/java_sdk/docs/CreativeAssetApi.md Demonstrates how to instantiate the CreativeAssetApi and call the creativePortfolioCreate method. It requires an access token and a PortfolioCreateBody object to successfully create a new portfolio. ```java CreativeAssetApi apiInstance = new CreativeAssetApi(); String accessToken = "accessToken_example"; PortfolioCreateBody body = new PortfolioCreateBody(); try { Response result = apiInstance.creativePortfolioCreate(accessToken, body); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling CreativeAssetApi#creativePortfolioCreate"); e.printStackTrace(); } ``` -------------------------------- ### Get Catalog Video Details using JavaScript SDK Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/js_sdk/docs/CatalogApi.md This example demonstrates how to retrieve details for videos within a TikTok catalog using the JavaScript SDK. It requires business center ID, catalog ID, and an access token. Optional parameters include video IDs, page number, and page size for pagination. ```javascript import {js_sdk} from 'business_api_client'; let apiInstance = new js_sdk.CatalogApi(); let bc_id = "bc_id_example"; // String | let catalog_id = "catalog_id_example"; // String | let Access_Token = "Access_Token_example"; // String | Authorized access token. For details, see [Authentication](https://ads.tiktok.com/marketing_api/docs?id=1738373164380162). let opts = { 'catalog_video_ids': ["catalog_video_ids_example"], // [String] | 'page': 1, // Number | 'page_size': 10 // Number | }; apiInstance.catalogVideoGet(bc_id, catalog_id, Access_Token, opts, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } }); ``` -------------------------------- ### GET /catalogSetGet Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/java_sdk/docs/CatalogApi.md Get product sets. [Catalog Set Get](https://business-api.tiktok.com/portal/docs?id=1740570556295169) ```APIDOC ## GET /catalogSetGet ### Description Get product sets. [Catalog Set Get](https://business-api.tiktok.com/portal/docs?id=1740570556295169) ### Method GET ### Endpoint /catalogSetGet ### Parameters #### Query Parameters - **catalogId** (String) - Required - - **bcId** (String) - Required - - **accessToken** (String) - Required - Authorized access token. For details, see [Authentication](https://ads.tiktok.com/marketing_api/docs?id=1738373164380162). - **productSetId** (String) - Optional - - **returnProductCount** (Boolean) - Optional - ### Response #### Success Response (200) - **Response** (Response) - #### Response Example { "example": "response body" } ``` -------------------------------- ### Create Lookalike Audience via Java SDK Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/java_sdk/docs/AudienceApi.md Shows how to initiate the creation of a lookalike audience by passing an access token and a request body containing the configuration parameters. ```java AudienceApi apiInstance = new AudienceApi(); String accessToken = "accessToken_example"; LookalikeCreateBody body = new LookalikeCreateBody(); try { Response result = apiInstance.dmpCustomAudienceLookalikeCreate(accessToken, body); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling AudienceApi#dmpCustomAudienceLookalikeCreate"); e.printStackTrace(); } ``` -------------------------------- ### Get Offline Event Sets using TikTok Business API SDK Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/python_sdk/docs/MeasurementApi.md This code example shows how to retrieve offline event sets using the MeasurementApi's offline_get method. It requires an access token and supports optional parameters like advertiser_id, event_set_ids, and name for filtering. The snippet includes error handling for API calls. ```python from __future__ import print_function import time import business_api_client from business_api_client.rest import ApiException from pprint import pprint # create an instance of the API class api_instance = business_api_client.MeasurementApi() access_token = 'access_token_example' # str | Authorized access token. For details, see [Authentication](https://ads.tiktok.com/marketing_api/docs?id=1738373164380162). advertiser_id = 'advertiser_id_example' # str | (optional) event_set_ids = ['event_set_ids_example'] # list[str] | (optional) name = 'name_example' # str | (optional) try: # Get Offline Event sets. [Offline Get](https://business-api.tiktok.com/portal/docs?id=1765596808589313) api_response = api_instance.offline_get(access_token, advertiser_id=advertiser_id, event_set_ids=event_set_ids, name=name) pprint(api_response) except ApiException as e: print("Exception when calling MeasurementApi->offline_get: %s\n" % e) ``` -------------------------------- ### Create App using TikTok Business API SDK (Javascript) Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/js_sdk/README.md Example Javascript code demonstrating how to initialize the APPManagementApi client and call the appCreate method with an access token and options. It includes error handling and success logging. ```javascript var js_sdk = require('business_api_client'); var api = new js_sdk.APPManagementApi() var Access_Token = "Access_Token_example"; // {String} Authorized access token. For details, see [Authentication](https://ads.tiktok.com/marketing_api/docs?id=1738373164380162). var opts = { 'body': new js_sdk.AppCreateBody() // {AppCreateBody} }; var callback = function(error, data, response) { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } }; api.appCreate(Access_Token, opts, callback); ``` -------------------------------- ### Get Catalog Event Source Bindings using TikTok Business API SDK Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/js_sdk/docs/CatalogApi.md This code example shows how to retrieve event source binding information for a catalog using the TikTok Business API SDK. It requires the catalog ID, business center ID, and an access token. The function makes the API call and logs the returned data or any errors. ```javascript import {js_sdk} from 'business_api_client'; let apiInstance = new js_sdk.CatalogApi(); let catalog_id = "catalog_id_example"; // String | let bc_id = "bc_id_example"; // String | let Access_Token = "Access_Token_example"; // String | Authorized access token. For details, see [Authentication](https://ads.tiktok.com/marketing_api/docs?id=1738373164380162). apiInstance.catalogEventsourceBindGet(catalog_id, bc_id, Access_Token, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } }); ``` -------------------------------- ### POST /open_api/v1.3/bc/partner/add/ Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/java_sdk/docs/BcApi.md Adds a partner to a Business Center. ```APIDOC ## POST /open_api/v1.3/bc/partner/add/ ### Description Add partner to Business Center. ### Method POST ### Endpoint /open_api/v1.3/bc/partner/add/ ### Parameters #### Request Body - **bc_id** (string) - Required - The ID of the Business Center. - **access_token** (string) - Required - The access token for authentication. - **partner_bc_id** (string) - Required - The ID of the partner Business Center. ### Request Example ```json { "bc_id": "12345", "access_token": "YOUR_ACCESS_TOKEN", "partner_bc_id": "partner_abc789" } ``` ### Response #### Success Response (200) - **code** (integer) - The status code of the response. - **message** (string) - The message describing the response status. #### Response Example ```json { "code": 0, "message": "OK" } ``` ``` -------------------------------- ### Get Identity Video Information using JavaScript SDK Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/js_sdk/docs/IdentityApi.md This code example shows how to fetch information about a TikTok post using the js_sdk.IdentityApi. It requires an access token, advertiser ID, identity type, identity ID, and item ID. An optional parameter for `identity_authorized_bc_id` is available when the identity type is BC_AUTH_TT. The function includes error handling and logs the API response. ```javascript import {js_sdk} from 'business_api_client'; let apiInstance = new js_sdk.IdentityApi(); let Access_Token = "Access_Token_example"; // String | Authorized access token. For details, see [Authentication](https://ads.tiktok.com/marketing_api/docs?id=1738373164380162). let advertiser_id = "advertiser_id_example"; // String | Advertiser ID let identity_type = "identity_type_example"; // String | Identity type. Enum: `AUTH_CODE`, `TT_USER`, `BC_AUTH_TT`. See [Identities](https://ads.tiktok.com/marketing_api/docs?id=1738958351620097) for details. let identity_id = "identity_id_example"; // String | Identity ID let item_id = "item_id_example"; // String | TikTok post ID let opts = { 'identity_authorized_bc_id': "identity_authorized_bc_id_example" // String | The identity ID of a TikTok account that a Business Center is authorized to access. Required when` identity_type` is `BC_AUTH_TT`. }; apiInstance.identityVideoInfo(Access_Token, advertiser_id, identity_type, identity_id, item_id, opts, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } }); ``` -------------------------------- ### Get Business Center Assets with TikTok Business API SDK Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/java_sdk/docs/BcApi.md This code example shows how to retrieve assets associated with a Business Center using the TikTok Business API SDK. It requires parameters such as bcId, assetType, and accessToken, with optional parameters for filtering and pagination. The function returns a Response object containing the requested assets. Proper authentication and parameter validation are crucial. ```java import business_api.ApiException; import io.swagger.client.api.BcApi; import io.swagger.client.model.FilteringBcAssetGet; import io.swagger.client.model.Response; BcApi apiInstance = new BcApi(); String bcId = "bcId_example"; // String | String assetType = "assetType_example"; // String | String accessToken = "accessToken_example"; // String | Authorized access token. For details, see [Authentication](https://ads.tiktok.com/marketing_api/docs?id=1738373164380162). String childBcId = "childBcId_example"; // String | FilteringBcAssetGet filtering = new FilteringBcAssetGet(); // FilteringBcAssetGet | Long page = 1L; // Long | Long pageSize = 10L; // Long | try { Response result = apiInstance.bcAssetGet(bcId, assetType, accessToken, childBcId, filtering, page, pageSize); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling BcApi#bcAssetGet"); e.printStackTrace(); } ``` -------------------------------- ### GET advertiser_balance_get Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/python_sdk/docs/BCApi.md Get ad account balance and budget. ```APIDOC ## GET advertiser_balance_get ### Description Get ad account balance and budget. ### Method GET ### Endpoint /open_api/v1.3/advertiser/balance/get/ ### Parameters #### Query Parameters - **bc_id** (string) - Required - The ID of the Business Center. - **access_token** (string) - Required - The access token for authentication. - **child_bc_id** (string) - Optional - The ID of a child Business Center. - **filtering** (string) - Optional - Filters to apply to the results. - **page** (integer) - Optional - The page number for pagination. - **page_size** (integer) - Optional - The number of items per page. ### Response #### Success Response (200) - **balance** (string) - The current balance of the ad account. - **budget** (string) - The budget set for the ad account. #### Response Example ```json { "code": 0, "message": "OK", "data": { "balance": "500.00", "budget": "1000.00" } } ``` ``` -------------------------------- ### POST /open_api/v1.3/catalog/capitalize/ Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/java_sdk/docs/CatalogApi.md Migrates catalogs currently under an ad account to a Business Center. ```APIDOC ## POST /open_api/v1.3/catalog/capitalize/ ### Description Migrate catalogs under your ad account to your Business Center. ### Method POST ### Endpoint /open_api/v1.3/catalog/capitalize/ ### Parameters #### Query Parameters - **accessToken** (string) - Required - Authorized access token. #### Request Body - **catalog_id** (string) - Required - The ID of the catalog to migrate. - **bc_id** (string) - Required - The destination Business Center ID. ### Request Example { "catalog_id": "123456789", "bc_id": "987654321" } ### Response #### Success Response (200) - **message** (string) - Status message of the migration request. #### Response Example { "code": 0, "message": "OK" } ``` -------------------------------- ### GET /catalog/overview Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/java_sdk/docs/CatalogApi.md Get the number of products in different audit statuses in a catalog. ```APIDOC ## GET /catalog/overview ### Description Retrieves the count of products categorized by their current audit status within a catalog. ### Method GET ### Endpoint /catalog/overview ### Parameters #### Query Parameters - **catalogId** (String) - Required - The ID of the catalog. - **bcId** (String) - Required - The Business Center ID. - **accessToken** (String) - Required - Authorized access token. ### Response #### Success Response (200) - **Response** (Object) - Audit status counts. ``` -------------------------------- ### GET /open_api/v1.3/term/get/ Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/java_sdk/docs/AccountManagementApi.md Gets Terms. This endpoint retrieves the details of the terms and conditions. ```APIDOC ## GET /open_api/v1.3/term/get/ ### Description Get Terms. ### Method GET ### Endpoint /open_api/v1.3/term/get/ ### Parameters #### Query Parameters - **advertiser_id** (String) - Required - The ID of the advertiser. - **term_id** (String) - Optional - The ID of the specific term to retrieve. #### Header Parameters - **Access-Token** (String) - Required - Authorized access token. ### Request Example ```json { "advertiser_id": "123456789", "term_id": "term_123" } ``` ### Response #### Success Response (200) - **term_id** (String) - The unique identifier for the term. - **title** (String) - The title of the term. - **content** (String) - The full content of the term. - **version** (String) - The version number of the term. #### Response Example ```json { "code": 0, "message": "OK", "data": { "terms": [ { "term_id": "term_123", "title": "TikTok Business API Terms of Service", "content": "By using this API, you agree to the following terms...", "version": "1.0" } ] } } ``` ``` -------------------------------- ### POST /open_api/v1.3/creative/portfolio/create/ Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/java_sdk/docs/CreativeManagementApi.md Creates a new portfolio for organizing creatives. ```APIDOC ## POST /open_api/v1.3/creative/portfolio/create/ ### Description Create a portfolio. ### Method POST ### Endpoint /open_api/v1.3/creative/portfolio/create/ ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **access_token** (string) - Required - Authorized access token. - **name** (string) - Required - The name of the portfolio. - **description** (string) - Optional - A description for the portfolio. - **creative_ids** (array) - Optional - A list of creative IDs to include in the portfolio upon creation. ### Request Example ```json { "access_token": "YOUR_ACCESS_TOKEN", "name": "Summer Campaign Creatives", "description": "Creatives for the summer campaign.", "creative_ids": ["id1", "id2"] } ``` ### Response #### Success Response (200) - **code** (integer) - The status code. - **message** (string) - The message returned by the API. - **data** (object) - The response data. - **portfolio_id** (string) - The ID of the newly created portfolio. #### Response Example ```json { "code": 0, "message": "Success", "data": { "portfolio_id": "portfolio_abc123" } } ``` ``` -------------------------------- ### GET /open_api/v1.3/pangle_audience_package/get/ Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/java_sdk/docs/AccountManagementApi.md Retrieves Pangle audience packages. This endpoint is used to get available audience packages for Pangle campaigns. ```APIDOC ## GET /open_api/v1.3/pangle_audience_package/get/ ### Description Get the Pangle audience packages. ### Method GET ### Endpoint /open_api/v1.3/pangle_audience_package/get/ ### Parameters #### Query Parameters - **advertiser_id** (String) - Required - The ID of the advertiser. - **page** (Integer) - Optional - The page number for pagination. - **page_size** (Integer) - Optional - The number of items per page. #### Header Parameters - **Access-Token** (String) - Required - Authorized access token. ### Request Example ```json { "advertiser_id": "123456789", "page": 1, "page_size": 10 } ``` ### Response #### Success Response (200) - **audience_package_id** (String) - The unique identifier for the audience package. - **name** (String) - The name of the audience package. - **description** (String) - A description of the audience package. #### Response Example ```json { "code": 0, "message": "OK", "data": { "audience_packages": [ { "audience_package_id": "pkg_abc123", "name": "Default Audience", "description": "Standard audience package." } ], "page_info": { "page": 1, "page_size": 10, "total_number": 1, "total_page": 1 } } } ``` ``` -------------------------------- ### POST /catalog/create/ Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/java_sdk/README.md Creates a new catalog by specifying details such as name, targeted locations, and currency. ```APIDOC ## POST /catalog/create/ ### Description Create a catalog by specifying information such as name, targeted locations, and currency. ### Method POST ### Endpoint /catalog/create/ ### Request Body - **name** (string) - Required - Name of the catalog. - **currency** (string) - Required - Currency code. - **region** (string) - Required - Targeted location region. ### Response #### Success Response (200) - **catalog_id** (string) - The unique ID of the created catalog. ``` -------------------------------- ### GET /open_api/v1.3/gmv_max/video/get/ Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/js_sdk/docs/VideoApi.md Retrieves GMV Max video information. This endpoint is used to get details about videos associated with GMV Max campaigns. ```APIDOC ## GET /open_api/v1.3/gmv_max/video/get/ ### Description Retrieves GMV Max video information. This endpoint is used to get details about videos associated with GMV Max campaigns. ### Method GET ### Endpoint /open_api/v1.3/gmv_max/video/get/ ### Parameters #### Query Parameters - **advertiser_id** (String) - Required - The ID of the advertiser. - **store_id** (String) - Required - The ID of the store. - **store_authorized_bc_id** (String) - Required - The BC ID authorized by the store. - **Access_Token** (String) - Required - Authorized access token. For details, see [Authentication](https://ads.tiktok.com/marketing_api/docs?id=1738373164380162). - **spu_id_list** ([String]) - Optional - A list of SPU IDs. - **identity_list** ([IdentityList]) - Optional - A list of identity objects. - **need_auth_code_video** (Boolean) - Optional - Flag to indicate if auth code videos are needed. - **page** (Number) - Optional - The page number for pagination. Defaults to 1. - **page_size** (Number) - Optional - The number of items per page. Defaults to 10. - **custom_posts_eligible** (Boolean) - Optional - Flag to indicate if custom posts are eligible. - **sort_field** (String) - Optional - The field to sort the results by. - **sort_type** (String) - Optional - The type of sorting (e.g., ASC, DESC). Defaults to DESC. - **keyword** (String) - Optional - A keyword to filter videos. ### Request Example ```json { "advertiser_id": "advertiser_id_example", "store_id": "store_id_example", "store_authorized_bc_id": "store_authorized_bc_id_example", "Access_Token": "Access_Token_example", "spu_id_list": ["spu_id_list_example"], "identity_list": [{}], "need_auth_code_video": true, "page": 1, "page_size": 10, "custom_posts_eligible": true, "sort_field": "sort_field_example", "sort_type": "DESC", "keyword": "keyword_example" } ``` ### Response #### Success Response (200) - **data** (InlineResponse200) - The response data containing video information. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Create a Creative Portfolio using Python Source: https://github.com/tiktok/tiktok-business-api-sdk/blob/main/python_sdk/docs/CreativeAssetApi.md This snippet demonstrates how to instantiate the CreativeAssetApi and call the creative_portfolio_create method. It requires a valid access token and an optional PortfolioCreateBody object to define the portfolio parameters. ```python from __future__ import print_function import time import business_api_client from business_api_client.rest import ApiException from pprint import pprint # create an instance of the API class api_instance = business_api_client.CreativeAssetApi() access_token = 'access_token_example' # str | Authorized access token. body = business_api_client.PortfolioCreateBody() # PortfolioCreateBody | Creative portfolio create body parameters (optional) try: # Create a portfolio api_response = api_instance.creative_portfolio_create(access_token, body=body) pprint(api_response) except ApiException as e: print("Exception when calling CreativeAssetApi->creative_portfolio_create: %s\n" % e) ```