KosmoKrator

productivity

TikTok CLI for AI Agents

Use the TikTok CLI from KosmoKrator to call TikTok tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

TikTok CLI Setup

TikTok can be configured headlessly with `kosmokrator integrations:configure tiktok`.

Install, configure, and verify
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure tiktok --set access_token="$TIKTOK_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor tiktok --json
kosmokrator integrations:status --json

Credentials

Authentication type: Bearer token bearer_token. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

KeyEnv varTypeRequiredLabel
access_token TIKTOK_ACCESS_TOKEN Secret secret yes Access Token
base_url TIKTOK_BASE_URL URL url no API Base URL

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

Generic CLI call
kosmo integrations:call tiktok.tiktok_list_videos '{"advertiser_id":"example_advertiser_id","page":1,"page_size":1}' --json
Provider shortcut
kosmo integrations:tiktok tiktok_list_videos '{"advertiser_id":"example_advertiser_id","page":1,"page_size":1}' --json

Discovery

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

Discovery commands
kosmo integrations:docs tiktok --json
kosmo integrations:docs tiktok.tiktok_list_videos --json
kosmo integrations:schema tiktok.tiktok_list_videos --json
kosmo integrations:search "TikTok" --json
kosmo integrations:list --json

Automation Contexts

The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.

CLI Functions

Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.

tiktok.tiktok_list_videos

List videos available for an advertiser in TikTok Business. Returns video IDs, names, and metadata.

Read read
Parameters
advertiser_id, page, page_size
Generic call
kosmo integrations:call tiktok.tiktok_list_videos '{"advertiser_id":"example_advertiser_id","page":1,"page_size":1}' --json
Shortcut
kosmo integrations:tiktok tiktok_list_videos '{"advertiser_id":"example_advertiser_id","page":1,"page_size":1}' --json

tiktok.tiktok_get_video

Get details for a specific TikTok video, including preview URL, duration, and status.

Read read
Parameters
advertiser_id, video_id
Generic call
kosmo integrations:call tiktok.tiktok_get_video '{"advertiser_id":"example_advertiser_id","video_id":"example_video_id"}' --json
Shortcut
kosmo integrations:tiktok tiktok_get_video '{"advertiser_id":"example_advertiser_id","video_id":"example_video_id"}' --json

tiktok.tiktok_upload_video

Upload a video to TikTok via URL for use in advertising campaigns.

Write write
Parameters
advertiser_id, video_url, file_name
Generic call
kosmo integrations:call tiktok.tiktok_upload_video '{"advertiser_id":"example_advertiser_id","video_url":"example_video_url","file_name":"example_file_name"}' --json
Shortcut
kosmo integrations:tiktok tiktok_upload_video '{"advertiser_id":"example_advertiser_id","video_url":"example_video_url","file_name":"example_file_name"}' --json

tiktok.tiktok_list_campaigns

List advertising campaigns for a TikTok advertiser. Returns campaign IDs, names, status, and budgets.

Read read
Parameters
advertiser_id, page, page_size
Generic call
kosmo integrations:call tiktok.tiktok_list_campaigns '{"advertiser_id":"example_advertiser_id","page":1,"page_size":1}' --json
Shortcut
kosmo integrations:tiktok tiktok_list_campaigns '{"advertiser_id":"example_advertiser_id","page":1,"page_size":1}' --json

tiktok.tiktok_get_campaign

Get details for a specific TikTok advertising campaign, including budget, schedule, and performance.

Read read
Parameters
advertiser_id, campaign_id
Generic call
kosmo integrations:call tiktok.tiktok_get_campaign '{"advertiser_id":"example_advertiser_id","campaign_id":"example_campaign_id"}' --json
Shortcut
kosmo integrations:tiktok tiktok_get_campaign '{"advertiser_id":"example_advertiser_id","campaign_id":"example_campaign_id"}' --json

tiktok.tiktok_list_advertisers

List advertisers accessible to the authenticated TikTok Business user. Returns advertiser IDs, names, and company details.

Read read
Parameters
app_id, secret
Generic call
kosmo integrations:call tiktok.tiktok_list_advertisers '{"app_id":"example_app_id","secret":"example_secret"}' --json
Shortcut
kosmo integrations:tiktok tiktok_list_advertisers '{"app_id":"example_app_id","secret":"example_secret"}' --json

tiktok.tiktok_get_current_user

Get the authenticated user's TikTok Business account information, including display name, email, and status.

Read read
Parameters
none
Generic call
kosmo integrations:call tiktok.tiktok_get_current_user '{}' --json
Shortcut
kosmo integrations:tiktok tiktok_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

tiktok.tiktok_list_videos 3 parameters
Schema command
kosmo integrations:schema tiktok.tiktok_list_videos --json
ParameterTypeRequiredDescription
advertiser_id string yes The TikTok advertiser ID.
page integer no Page number for pagination. Defaults to 1.
page_size integer no Number of videos per page. Defaults to 10.
tiktok.tiktok_get_video 2 parameters
Schema command
kosmo integrations:schema tiktok.tiktok_get_video --json
ParameterTypeRequiredDescription
advertiser_id string yes The TikTok advertiser ID.
video_id string yes The TikTok video ID.
tiktok.tiktok_upload_video 3 parameters
Schema command
kosmo integrations:schema tiktok.tiktok_upload_video --json
ParameterTypeRequiredDescription
advertiser_id string yes The TikTok advertiser ID.
video_url string yes The URL of the video to upload (must be publicly accessible).
file_name string no A custom name for the uploaded video file.
tiktok.tiktok_list_campaigns 3 parameters
Schema command
kosmo integrations:schema tiktok.tiktok_list_campaigns --json
ParameterTypeRequiredDescription
advertiser_id string yes The TikTok advertiser ID.
page integer no Page number for pagination. Defaults to 1.
page_size integer no Number of campaigns per page. Defaults to 10.
tiktok.tiktok_get_campaign 2 parameters
Schema command
kosmo integrations:schema tiktok.tiktok_get_campaign --json
ParameterTypeRequiredDescription
advertiser_id string yes The TikTok advertiser ID.
campaign_id string yes The TikTok campaign ID.
tiktok.tiktok_list_advertisers 2 parameters
Schema command
kosmo integrations:schema tiktok.tiktok_list_advertisers --json
ParameterTypeRequiredDescription
app_id string no The TikTok app ID to filter advertisers by.
secret string no The TikTok app secret to filter advertisers by.
tiktok.tiktok_get_current_user 0 parameters
Schema command
kosmo integrations:schema tiktok.tiktok_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.