Platform Guides

Bulk TikTok Bundle Creation API

Use TokPortal's bulk endpoint correctly: one country per request, multiple platforms, account-only and account-with-video bundles, credit calculation, and CSV/video configuration.

Bulk TikTok Bundle Creation API

POST /bundles/bulk creates multiple bundles in one request. The current public contract supports:

  • one country per request
  • one or more platforms
  • up to 100 accounts per platform per request
  • optional video slots on a subset of accounts
  • one atomic credit debit for the whole batch

For multiple countries, loop over country codes and send one request per country.

Reference: Create Bulk

Request shape

curl -X POST https://app.tokportal.com/api/ext/bundles/bulk \
  -H "X-API-Key: sk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "platforms": ["tiktok"],
    "country": "US",
    "accounts_count": 10,
    "upload_accounts_count": 4,
    "videos_per_account": 8,
    "wants_niche_warming": true,
    "niche_warming_instructions": "Consumer tech and product demo content.",
    "external_ref": "bulk-us-q2"
  }'

This creates 10 TikTok bundles in the US target country:

ResultCount
account_and_videos bundles4
account_only bundles6
Video slots per upload bundle8
Total video slots32

Credits are returned by the API. Do not calculate costs client-side except for previews; the server is the source of truth.

Multi-platform bulk

accounts_count is per platform.

curl -X POST https://app.tokportal.com/api/ext/bundles/bulk \
  -H "X-API-Key: sk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "platforms": ["tiktok", "instagram"],
    "country": "US",
    "accounts_count": 5,
    "upload_accounts_count": 2,
    "videos_per_account": 6,
    "external_ref": "bulk-us-multi-platform"
  }'

This creates 10 bundles total: 5 TikTok and 5 Instagram. For each platform, 2 bundles include video slots and 3 are account-only.

Multi-country rollout

The endpoint does not accept a countries array. Loop from your application or automation tool:

for country in US UK FR DE; do
  curl -X POST https://app.tokportal.com/api/ext/bundles/bulk \
    -H "X-API-Key: $TOKPORTAL_API_KEY" \
    -H "Content-Type: application/json" \
    -d "{
      \"platforms\": [\"tiktok\"],
      \"country\": \"$country\",
      \"accounts_count\": 5,
      \"upload_accounts_count\": 2,
      \"videos_per_account\": 8,
      \"external_ref\": \"bulk-q2-$country\"
    }"
done

Validate supported countries before running a loop:

curl -X GET https://app.tokportal.com/api/ext/countries \
  -H "X-API-Key: sk_your_key_here"

Configure videos after creation

Each returned bundle has an id. Configure slots individually:

curl -X PUT https://app.tokportal.com/api/ext/bundles/bnd_abc123/videos/1 \
  -H "X-API-Key: sk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "video_type": "video",
    "description": "Launch clip #1",
    "target_publish_date": "2026-06-05",
    "video_url": "https://cdn.example.com/videos/launch-01.mp4"
  }'

Or configure several positions in one request:

curl -X PUT https://app.tokportal.com/api/ext/bundles/bnd_abc123/videos/batch \
  -H "X-API-Key: sk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "videos": [
      {
        "position": 1,
        "video_type": "video",
        "description": "Launch clip #1",
        "target_publish_date": "2026-06-05",
        "video_url": "https://cdn.example.com/videos/launch-01.mp4"
      },
      {
        "position": 2,
        "video_type": "video",
        "description": "Launch clip #2",
        "target_publish_date": "2026-06-07",
        "video_url": "https://cdn.example.com/videos/launch-02.mp4"
      }
    ]
  }'

Reference: Configure Videos

CSV import

CSV import is multipart file upload, not a csv_url JSON field:

curl -X POST https://app.tokportal.com/api/ext/bundles/bnd_abc123/videos/import-csv \
  -H "X-API-Key: sk_your_key_here" \
  -F "file=@videos.csv" \
  -F "auto_publish=true"

Reference: CSV Import

Production notes

  • Split batches larger than the documented request limits.
  • Use external_ref to connect TokPortal bundles to your internal campaign IDs.
  • Store every returned bundle.id; later video configuration and publish calls are per bundle.
  • Use Webhooks instead of polling for high-volume workflows.
  • Use Analytics after accounts and posts are live; analytics availability depends on account/post state and plan.

Related guides: DTC Multi-Market Launch, Agency Management, n8n.