Source: https://developers.tokportal.com/use-cases/no-code/make-tiktok-automation/
Markdown: https://developers.tokportal.com/use-cases/no-code/make-tiktok-automation.md

# TokPortal + Make

TokPortal does not currently ship a native Make app. Use Make's **HTTP** module to call the REST API with `X-API-Key`.

The realistic flow is:

1. Trigger from a row, webhook, schedule, or Airtable record.
2. Create a TokPortal bundle.
3. Configure the required account fields.
4. Configure one or more video slots.
5. Publish the bundle.
6. Optionally monitor with webhooks or status polling.

## Prerequisites

- A [TokPortal account](https://app.tokportal.com/auth/signup) with credits
- A TokPortal API key from the [Developer Portal](https://app.tokportal.com/developer/api-keys)
- A Make account
- Public media URLs or files uploaded through [Media Upload](https://developers.tokportal.com/media-upload)

## 1. Create the scenario trigger

Common trigger data:

| Field                 | Example                                                                              |
| --------------------- | ------------------------------------------------------------------------------------ |
| `country`             | `USA`, `UK`, `FR` — codes from `GET /countries` (`US` and `GB` are accepted aliases) |
| `username`            | `mybrand_us`                                                                         |
| `visible_name`        | `My Brand`                                                                           |
| `biography`           | `Daily product videos.`                                                              |
| `profile_picture_url` | `https://cdn.example.com/profile.jpg`                                                |
| `video_url`           | `https://cdn.example.com/video.mp4`                                                  |
| `description`         | `New drop is live #newarrival`                                                       |
| `target_publish_date` | `2026-06-05`                                                                         |

Use `GET /countries` if you need to validate enabled countries before creating bundles. `country` must be one of the codes it returns: mostly ISO alpha-2, except the United States (`USA`) and the United Kingdom (`UK`); `US` and `GB` are accepted aliases. A country name is rejected with `INVALID_COUNTRY`.

`target_publish_date` also has a minimum lead time: today + 3 days while the account is still being created, today + 1 once it is delivered or when the bundle runs on an existing account. Compute it in the scenario instead of storing a fixed date in the sheet.

## 2. Create bundle

Add **HTTP > Make a request**:

| Setting      | Value                                       |
| ------------ | ------------------------------------------- |
| URL          | `https://app.tokportal.com/api/ext/bundles` |
| Method       | `POST`                                      |
| Body type    | Raw                                         |
| Content type | JSON                                        |

Headers:

| Name           | Value              |
| -------------- | ------------------ |
| `X-API-Key`    | `sk_your_key_here` |
| `Content-Type` | `application/json` |

Request body:

```json
{
  "bundle_type": "account_and_videos",
  "platform": "tiktok",
  "country": "{{1.country}}",
  "videos_quantity": 1,
  "title": "Make workflow {{1.row_id}}",
  "external_ref": "make-{{1.row_id}}"
}
```

Store `data.bundle_id` from the response for the next modules. TokPortal API keys are sent in `X-API-Key`, not in the bearer authorization header.

Reference: [Create Bundle](https://developers.tokportal.com/create-bundle)

## 3. Configure account

Add another HTTP module:

| Setting   | Value                                                                    |
| --------- | ------------------------------------------------------------------------ |
| URL       | `https://app.tokportal.com/api/ext/bundles/{{2.data.bundle_id}}/account` |
| Method    | `PUT`                                                                    |
| Body type | Raw JSON                                                                 |

```json
{
  "username": "{{1.username}}",
  "visible_name": "{{1.visible_name}}",
  "biography": "{{1.biography}}",
  "profile_picture_url": "{{1.profile_picture_url}}"
}
```

Reference: [Account Configuration](https://developers.tokportal.com/account-configuration)

## 4. Configure video

If the source app provides a public file URL, pass it directly:

```json
{
  "video_type": "video",
  "description": "{{1.description}}",
  "target_publish_date": "{{1.target_publish_date}}",
  "video_url": "{{1.video_url}}",
  "external_ref": "make-{{1.row_id}}-video-1"
}
```

Module URL:

```text
https://app.tokportal.com/api/ext/bundles/{{2.data.bundle_id}}/videos/1
```

Method: `PUT`

TokPortal can also ingest media uploaded through [Media Upload](https://developers.tokportal.com/media-upload). If Make's file handling becomes the bottleneck for large files, upload by public URL or presigned URL and pass the returned `public_url` as `video_url`.

Reference: [Configure Videos](https://developers.tokportal.com/configure-videos)

## 5. Publish

Add a final HTTP module:

| Setting | Value                                                                    |
| ------- | ------------------------------------------------------------------------ |
| URL     | `https://app.tokportal.com/api/ext/bundles/{{2.data.bundle_id}}/publish` |
| Method  | `POST`                                                                   |

No JSON body is required.

Reference: [Publish & Unpublish](https://developers.tokportal.com/publish-unpublish)

## Error handling

Add Make error routes for common responses:

| Status | Meaning                                         |
| ------ | ----------------------------------------------- |
| `400`  | Missing/invalid fields; inspect `error.details` |
| `401`  | Missing, invalid, or revoked API key            |
| `402`  | Not enough credits                              |
| `429`  | Rate limit; retry after the returned delay      |

For publish issues, call:

```text
GET https://app.tokportal.com/api/ext/bundles/{{bundle_id}}/publish-readiness
```

## Multi-country scenarios

The bulk endpoint accepts one `country` per request. For multiple countries, use an Iterator in Make:

```json
{
  "platforms": ["tiktok", "instagram"],
  "country": "{{iterator.country}}",
  "accounts_count": 3,
  "upload_accounts_count": 1,
  "videos_per_account": 5,
  "external_ref": "make-launch-{{iterator.country}}"
}
```

This creates 3 bundles per platform in the current country; 1 bundle per platform receives video slots.

Related docs: [Create Bulk](https://developers.tokportal.com/create-bulk), [Webhooks](https://developers.tokportal.com/webhooks), [Analytics](https://developers.tokportal.com/analytics), [SDKs & CLI](https://developers.tokportal.com/sdks-cli).
