# TikTok

> TikTok business accounts through your TikTok API for Business app ("TikTok Accounts").

The permissions each operation needs are in [App Review: TikTok](https://docs.koil.co/app-review#tiktok).

-   `video` and `photo` are publish variants of `tiktok.videos.posts`.
-   There is no `live` surface: TikTok publishes no LIVE API.
-   Koil registers your app's webhook callbacks with TikTok itself, per event family and only while an Event Destination is subscribed to a topic that family feeds, so there is no developer-console step.

Publishing is not yet usable

TikTok pulls post media only from a URL whose domain or prefix your app has verified as a URL property, and Koil currently serves staged media from an origin no customer can verify. A publish is rejected up front with that reason rather than failing minutes later. Reading, replying, moderating, and messaging are unaffected.

| Collection | Operations | Events | Backfill |
| --- | --- | --- | --- |
| [`tiktok.videos.posts`](https://docs.koil.co/platforms/tiktok#tiktok.videos.posts) | `list`, `get`, `publish` | `created`, `deleted` | yes |
| [`tiktok.videos.comments`](https://docs.koil.co/platforms/tiktok#tiktok.videos.comments) | `list`, `get`, `publish`, `perform_action`, `delete` | `created`, `updated`, `deleted`, `moderated` | yes |
| [`tiktok.videos.mentions`](https://docs.koil.co/platforms/tiktok#tiktok.videos.mentions) | `list`, `get` | `created`, `updated` | yes |
| [`tiktok.dm.conversations`](https://docs.koil.co/platforms/tiktok#tiktok.dm.conversations) | `list`, `perform_action` | `updated` | no |
| [`tiktok.dm.messages`](https://docs.koil.co/platforms/tiktok#tiktok.dm.messages) | `list`, `resolve_attachment`, `publish` | `created` | yes |

## `tiktok.videos.posts`

The account's public video and photo posts.

### `list`

List the TikTok account's public posts, newest first.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `profileId` | `string` | yes | Koil Profile associated with the operation. |
| `cursor` | `string` | no | Opaque cursor for fetching the next result page. |
| `limit` | `integer` | no | Maximum number of items to return. |
| `includePlatformRaw` | `boolean` | no | Whether to include transient platform-native payloads. |

JSON Schema

```json
{
  "type": "object",
  "required": [
    "profileId"
  ],
  "properties": {
    "profileId": {
      "type": "string",
      "description": "Koil Profile associated with the operation.",
      "minLength": 1
    },
    "cursor": {
      "type": "string",
      "description": "Opaque cursor for fetching the next result page.",
      "minLength": 1
    },
    "limit": {
      "type": "integer",
      "description": "Maximum number of items to return.",
      "minimum": 1,
      "maximum": 100
    },
    "includePlatformRaw": {
      "type": "boolean",
      "description": "Whether to include transient platform-native payloads."
    }
  },
  "additionalProperties": false
}
```

### `get`

Get one TikTok post by platform id.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `profileId` | `string` | yes | Koil Profile associated with the operation. |
| `externalId` | `string` | yes |  |
| `includePlatformRaw` | `boolean` | no | Whether to include transient platform-native payloads. |

JSON Schema

```json
{
  "type": "object",
  "required": [
    "profileId",
    "externalId"
  ],
  "properties": {
    "profileId": {
      "type": "string",
      "description": "Koil Profile associated with the operation.",
      "minLength": 1
    },
    "externalId": {
      "type": "string",
      "minLength": 1
    },
    "includePlatformRaw": {
      "type": "boolean",
      "description": "Whether to include transient platform-native payloads."
    }
  },
  "additionalProperties": false
}
```

### `publish`

Publish a TikTok video or photo post.

Submit through `POST /v1/publish-requests` with `collection: "tiktok.videos.posts"`. These fields go in the item's `args`; `profileId` and `variant` are item fields.

`variant: "video"`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `text` | `string` | no | Caption; hashtags and @mentions render as plain text. Up to 2,200 UTF-16 code units and 30 mentions. |
| `media` | `object \| object[]` | yes |  |
| `brandOrganic` | `boolean` | yes | Label the post as promotional content for the account's own business. |
| `paidPartnership` | `boolean` | yes | Label the post as a paid partnership with a brand. |
| `disableComment` | `boolean` | no |  |
| `disableDuet` | `boolean` | no |  |
| `disableStitch` | `boolean` | no |  |
| `thumbnailOffsetMs` | `integer` | no |  |
| `customThumbnailUrl` | `string` | no | Cover image for the video, as a URL on a URL property the app has verified — the same rule the staged video URL follows. JPG, JPEG, WebP or PNG, 360×360 to 1080×1920 (or 1920×1080), within 20 MB. Cannot be combined with thumbnailOffsetMs, which TikTok ignores when a cover URL is set. |
| `aiGenerated` | `boolean` | no | Label the post as AI-generated, with the platform's own AI label. |
| `draft` | `boolean` | no | Deliver to the creator's TikTok inbox as a draft instead of publishing; needs the video.upload scope and ignores every other post setting. |

JSON Schema

```json
{
  "type": "object",
  "required": [
    "media",
    "brandOrganic",
    "paidPartnership"
  ],
  "properties": {
    "text": {
      "type": "string",
      "description": "Caption; hashtags and @mentions render as plain text. Up to 2,200 UTF-16 code units and 30 mentions.",
      "maxLength": 2200
    },
    "media": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "object",
            "required": [
              "mediaId"
            ],
            "properties": {
              "mediaId": {
                "type": "string",
                "minLength": 1
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "pattern": "^video/"
              },
              "altText": {
                "type": "string",
                "minLength": 1
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": [
              "sourceUrl"
            ],
            "properties": {
              "sourceUrl": {
                "type": "string",
                "minLength": 1
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "pattern": "^video/"
              },
              "altText": {
                "type": "string",
                "minLength": 1
              }
            },
            "additionalProperties": false
          }
        ]
      },
      "minItems": 1,
      "maxItems": 1
    },
    "brandOrganic": {
      "type": "boolean",
      "description": "Label the post as promotional content for the account's own business."
    },
    "paidPartnership": {
      "type": "boolean",
      "description": "Label the post as a paid partnership with a brand."
    },
    "disableComment": {
      "type": "boolean"
    },
    "disableDuet": {
      "type": "boolean"
    },
    "disableStitch": {
      "type": "boolean"
    },
    "thumbnailOffsetMs": {
      "type": "integer",
      "minimum": 0
    },
    "customThumbnailUrl": {
      "type": "string",
      "description": "Cover image for the video, as a URL on a URL property the app has verified — the same rule the staged video URL follows. JPG, JPEG, WebP or PNG, 360×360 to 1080×1920 (or 1920×1080), within 20 MB. Cannot be combined with thumbnailOffsetMs, which TikTok ignores when a cover URL is set.",
      "minLength": 1
    },
    "aiGenerated": {
      "type": "boolean",
      "description": "Label the post as AI-generated, with the platform's own AI label."
    },
    "draft": {
      "type": "boolean",
      "description": "Deliver to the creator's TikTok inbox as a draft instead of publishing; needs the video.upload scope and ignores every other post setting."
    }
  },
  "additionalProperties": false
}
```

`variant: "photo"`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `title` | `string` | no |  |
| `text` | `string` | no | Caption; hashtags and @mentions render as plain text. Up to 4,000 UTF-16 code units and 30 mentions. |
| `media` | `object \| object[]` | yes |  |
| `privacyLevel` | `"public_to_everyone" \| "mutual_follow_friends" \| "follower_of_creator" \| "self_only"` | yes |  |
| `coverIndex` | `integer` | no | Which image is the cover; defaults to the first. |
| `autoAddMusic` | `boolean` | no |  |
| `brandOrganic` | `boolean` | yes | Label the post as promotional content for the account's own business. |
| `paidPartnership` | `boolean` | yes | Label the post as a paid partnership with a brand. |
| `disableComment` | `boolean` | no |  |
| `draft` | `boolean` | no | Deliver to the creator's TikTok inbox as a draft instead of publishing; needs the video.upload scope and keeps only the title and caption. |

JSON Schema

```json
{
  "type": "object",
  "required": [
    "media",
    "privacyLevel",
    "brandOrganic",
    "paidPartnership"
  ],
  "properties": {
    "title": {
      "type": "string",
      "maxLength": 90
    },
    "text": {
      "type": "string",
      "description": "Caption; hashtags and @mentions render as plain text. Up to 4,000 UTF-16 code units and 30 mentions.",
      "maxLength": 4000
    },
    "media": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "object",
            "required": [
              "mediaId"
            ],
            "properties": {
              "mediaId": {
                "type": "string",
                "minLength": 1
              },
              "contentType": {
                "type": "string",
                "minLength": 1
              },
              "altText": {
                "type": "string",
                "minLength": 1
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": [
              "sourceUrl"
            ],
            "properties": {
              "sourceUrl": {
                "type": "string",
                "minLength": 1
              },
              "contentType": {
                "type": "string",
                "minLength": 1
              },
              "altText": {
                "type": "string",
                "minLength": 1
              }
            },
            "additionalProperties": false
          }
        ]
      },
      "minItems": 1,
      "maxItems": 35
    },
    "privacyLevel": {
      "enum": [
        "public_to_everyone",
        "mutual_follow_friends",
        "follower_of_creator",
        "self_only"
      ]
    },
    "coverIndex": {
      "type": "integer",
      "minimum": 0,
      "description": "Which image is the cover; defaults to the first."
    },
    "autoAddMusic": {
      "type": "boolean"
    },
    "brandOrganic": {
      "type": "boolean",
      "description": "Label the post as promotional content for the account's own business."
    },
    "paidPartnership": {
      "type": "boolean",
      "description": "Label the post as a paid partnership with a brand."
    },
    "disableComment": {
      "type": "boolean"
    },
    "draft": {
      "type": "boolean",
      "description": "Deliver to the creator's TikTok inbox as a draft instead of publishing; needs the video.upload scope and keeps only the title and caption."
    }
  },
  "additionalProperties": false
}
```

#### Media requirements

An asset that meets everything under _Copied as is_ is published exactly as uploaded. Otherwise Koil converts only what misses, a billed media add-on that needs a paid plan. Anything under _Refused_ fails the publish request, since no conversion fixes it.

| Variant | Media | Copied as is | Otherwise converted | Refused |
| --- | --- | --- | --- | --- |
| `video` | Video | MP4/MOV, H.264, HEVC or VP9; at most 60 fps | re-encoded to H.264 in MP4; frame rate lowered | smaller than 360×360; shorter than 3 s; longer than 10 min (or the account's lower limit); under 23 fps; over 1 GB once staged |
| `photo` | Image | JPEG or WebP; long edge at most 1920 px; short edge at most 1080 px | re-encoded to JPEG; downscaled to fit | over 20 MB once staged |

### Not offered

-   `resolve_attachment`: not applicable
-   `update`: platform no endpoint
-   `perform_action`: platform not supported
-   `delete`: platform no endpoint

### Events

-   [`content.tiktok.videos.posts.created`](https://docs.koil.co/events#content.tiktok.videos.posts.created)
-   [`content.tiktok.videos.posts.deleted`](https://docs.koil.co/events#content.tiktok.videos.posts.deleted)

Backfill: supported (bounded coverage); see [Backfill history](https://docs.koil.co/guides/backfill).

Item schema

What `list` and `get` return and what events carry as `data`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `media` | `object[]` | no |  |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `variant` | `"video" \| "photo" \| "other"` | yes | TikTok's `media_type`. `other` is a type TikTok added that Koil does not model yet. |
| `embedUrl` | `string` | no |  |
| `durationSeconds` | `number` | no |  |
| `isAd` | `boolean` | no |  |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"tiktok.videos.posts"` | yes | The collection that delivered this item. |

## `tiktok.videos.comments`

Comments on the account's posts, and replies to them.

### `list`

List comments on one TikTok post, or the replies to one of its comments.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `profileId` | `string` | yes | Koil Profile associated with the operation. |
| `containerId` | `string` | yes | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `targetId` | `string` | no | A comment: lists its replies instead. |
| `includeReplies` | `boolean` | no | Include up to three replies inline under each top-level comment. |
| `includeHidden` | `boolean` | no | Include comments hidden from the public (`hidden: true`); defaults to true. |
| `sort` | `"likes" \| "replies" \| "newest"` | no | Most liked, most replied to, or newest first. |
| `cursor` | `string` | no | Opaque cursor for fetching the next result page. |
| `limit` | `integer` | no | Maximum number of items to return. |
| `includePlatformRaw` | `boolean` | no | Whether to include transient platform-native payloads. |

JSON Schema

```json
{
  "type": "object",
  "required": [
    "profileId",
    "containerId"
  ],
  "properties": {
    "profileId": {
      "type": "string",
      "description": "Koil Profile associated with the operation.",
      "minLength": 1
    },
    "containerId": {
      "type": "string",
      "minLength": 1,
      "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
    },
    "targetId": {
      "type": "string",
      "minLength": 1,
      "description": "A comment: lists its replies instead."
    },
    "includeReplies": {
      "type": "boolean",
      "description": "Include up to three replies inline under each top-level comment."
    },
    "includeHidden": {
      "type": "boolean",
      "description": "Include comments hidden from the public (`hidden: true`); defaults to true."
    },
    "sort": {
      "enum": [
        "likes",
        "replies",
        "newest"
      ],
      "description": "Most liked, most replied to, or newest first."
    },
    "cursor": {
      "type": "string",
      "description": "Opaque cursor for fetching the next result page.",
      "minLength": 1
    },
    "limit": {
      "type": "integer",
      "description": "Maximum number of items to return.",
      "minimum": 1,
      "maximum": 100
    },
    "includePlatformRaw": {
      "type": "boolean",
      "description": "Whether to include transient platform-native payloads."
    }
  },
  "additionalProperties": false
}
```

### `get`

Get one TikTok comment by platform id.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `profileId` | `string` | yes | Koil Profile associated with the operation. |
| `externalId` | `string` | yes |  |
| `containerId` | `string` | yes | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `includePlatformRaw` | `boolean` | no | Whether to include transient platform-native payloads. |

JSON Schema

```json
{
  "type": "object",
  "required": [
    "profileId",
    "externalId",
    "containerId"
  ],
  "properties": {
    "profileId": {
      "type": "string",
      "description": "Koil Profile associated with the operation.",
      "minLength": 1
    },
    "externalId": {
      "type": "string",
      "minLength": 1
    },
    "containerId": {
      "type": "string",
      "minLength": 1,
      "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
    },
    "includePlatformRaw": {
      "type": "boolean",
      "description": "Whether to include transient platform-native payloads."
    }
  },
  "additionalProperties": false
}
```

### `publish`

Publish a TikTok comment: a top-level comment on a post, or a reply to a comment or a comment mention. The body is text, one image, or both.

Submit through `POST /v1/publish-requests` with `collection: "tiktok.videos.comments"`. These fields go in the item's `args`; `profileId` and `variant` are item fields.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `target` | `object` | yes | One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL. |
| `containerId` | `string` | no | The post the targeted comment is on; required to reply to a comment or a comment mention. |
| `text` | `string` | no | Comment text, up to 1,200 UTF-8 characters. |
| `attachments` | `object \| object[]` | no | At most one image; a TikTok comment carries a single picture. |

JSON Schema

```json
{
  "type": "object",
  "required": [
    "target"
  ],
  "properties": {
    "target": {
      "type": "object",
      "required": [
        "kind",
        "externalId"
      ],
      "properties": {
        "kind": {
          "enum": [
            "tiktok.videos.comments",
            "tiktok.videos.posts",
            "tiktok.videos.mentions"
          ]
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        }
      },
      "additionalProperties": false,
      "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
    },
    "containerId": {
      "type": "string",
      "minLength": 1,
      "description": "The post the targeted comment is on; required to reply to a comment or a comment mention."
    },
    "text": {
      "type": "string",
      "description": "Comment text, up to 1,200 UTF-8 characters.",
      "minLength": 1,
      "maxLength": 1200
    },
    "attachments": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "object",
            "required": [
              "mediaId"
            ],
            "properties": {
              "mediaId": {
                "type": "string",
                "minLength": 1
              },
              "contentType": {
                "type": "string",
                "minLength": 1
              },
              "altText": {
                "type": "string",
                "minLength": 1
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255,
                "description": "The name the recipient sees on a document, where the destination shows one. Defaults to the uploaded file's name."
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": [
              "sourceUrl"
            ],
            "properties": {
              "sourceUrl": {
                "type": "string",
                "minLength": 1
              },
              "contentType": {
                "type": "string",
                "minLength": 1
              },
              "altText": {
                "type": "string",
                "minLength": 1
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255,
                "description": "The name the recipient sees on a document, where the destination shows one. Defaults to the uploaded file's name."
              }
            },
            "additionalProperties": false
          }
        ]
      },
      "minItems": 1,
      "maxItems": 1,
      "description": "At most one image; a TikTok comment carries a single picture."
    }
  },
  "additionalProperties": false,
  "anyOf": [
    {
      "required": [
        "text"
      ]
    },
    {
      "required": [
        "attachments"
      ]
    }
  ]
}
```

#### Media requirements

An asset that meets everything under _Copied as is_ is published exactly as uploaded. Otherwise Koil converts only what misses, a billed media add-on that needs a paid plan. Anything under _Refused_ fails the publish request, since no conversion fixes it.

| Media | Copied as is | Otherwise converted | Refused |
| --- | --- | --- | --- |
| Image | JPEG, WebP or PNG; long edge at most 1920 px; short edge at most 1080 px | re-encoded to JPEG; downscaled to fit | smaller than 360×360; over 5 MB once staged |

### `perform_action`

Hide, unhide, like, or unlike a TikTok comment. Answers with the action applied. TikTok says an unhide does not always take effect; the `moderated` event reports the outcome.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `profileId` | `string` | yes | Koil Profile associated with the operation. |
| `externalId` | `string` | yes |  |
| `containerId` | `string` | no | The post the comment is on. Required for hide and unhide; ignored by like and unlike, which TikTok addresses by comment id alone. |
| `action` | `"hide" \| "unhide" \| "like" \| "unlike"` | yes | What to do with the item: `hide` (hide it from public view), `unhide` (show a hidden item again), `like` (like it as the profile), `unlike` (remove the profile's like). |

JSON Schema

```json
{
  "type": "object",
  "required": [
    "profileId",
    "externalId",
    "action"
  ],
  "properties": {
    "profileId": {
      "type": "string",
      "description": "Koil Profile associated with the operation.",
      "minLength": 1
    },
    "externalId": {
      "type": "string",
      "minLength": 1
    },
    "containerId": {
      "type": "string",
      "minLength": 1,
      "description": "The post the comment is on. Required for hide and unhide; ignored by like and unlike, which TikTok addresses by comment id alone."
    },
    "action": {
      "enum": [
        "hide",
        "unhide",
        "like",
        "unlike"
      ],
      "description": "What to do with the item: `hide` (hide it from public view), `unhide` (show a hidden item again), `like` (like it as the profile), `unlike` (remove the profile's like).",
      "x-koil-narrows": "ContentAction"
    }
  },
  "additionalProperties": false
}
```

### `delete`

Delete a TikTok comment the account made.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `profileId` | `string` | yes | Koil Profile associated with the operation. |
| `externalId` | `string` | yes |  |

JSON Schema

```json
{
  "type": "object",
  "required": [
    "profileId",
    "externalId"
  ],
  "properties": {
    "profileId": {
      "type": "string",
      "description": "Koil Profile associated with the operation.",
      "minLength": 1
    },
    "externalId": {
      "type": "string",
      "minLength": 1
    }
  },
  "additionalProperties": false
}
```

### Not offered

-   `resolve_attachment`: not applicable
-   `update`: platform not supported

### Events

-   [`content.tiktok.videos.comments.created`](https://docs.koil.co/events#content.tiktok.videos.comments.created)
-   [`content.tiktok.videos.comments.updated`](https://docs.koil.co/events#content.tiktok.videos.comments.updated)
-   [`content.tiktok.videos.comments.deleted`](https://docs.koil.co/events#content.tiktok.videos.comments.deleted)
-   [`content.tiktok.videos.comments.moderated`](https://docs.koil.co/events#content.tiktok.videos.comments.moderated)

Backfill: supported (partial coverage); see [Backfill history](https://docs.koil.co/guides/backfill).

Item schema

What `list` and `get` return and what events carry as `data`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | yes | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `target` | `object` | yes | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `hidden` | `boolean` | no | Whether the account hid the comment from the public. Absent when the platform did not say. |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `updatedAt` | `string (date-time)` | no | When the platform last updated it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `pinned` | `boolean` | no |  |
| `liked` | `boolean` | no |  |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"tiktok.videos.comments"` | yes | The collection that delivered this item. |

## `tiktok.videos.mentions`

@-mentions of the account in other users' captions and comments.

### `list`

List the top mentions of the TikTok account in other users' captions or comments.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `profileId` | `string` | yes | Koil Profile associated with the operation. |
| `variant` | `"post" \| "comment"` | yes |  |
| `since` | `string (date-time)` | no | Oldest mention time to list; defaults to 90 days ago. TikTok looks back at most 90 days; an earlier `since` returns those 90 days. TikTok's window counts whole days, so mentions up to a day older can also appear. |
| `cursor` | `string` | no | Opaque cursor for fetching the next result page. |
| `limit` | `integer` | no | Maximum number of items to return. |
| `includePlatformRaw` | `boolean` | no | Whether to include transient platform-native payloads. |

JSON Schema

```json
{
  "type": "object",
  "required": [
    "profileId",
    "variant"
  ],
  "properties": {
    "profileId": {
      "type": "string",
      "description": "Koil Profile associated with the operation.",
      "minLength": 1
    },
    "variant": {
      "enum": [
        "post",
        "comment"
      ]
    },
    "since": {
      "type": "string",
      "format": "date-time",
      "description": "Oldest mention time to list; defaults to 90 days ago. TikTok looks back at most 90 days; an earlier `since` returns those 90 days. TikTok's window counts whole days, so mentions up to a day older can also appear."
    },
    "cursor": {
      "type": "string",
      "description": "Opaque cursor for fetching the next result page.",
      "minLength": 1
    },
    "limit": {
      "type": "integer",
      "description": "Maximum number of items to return.",
      "minimum": 1,
      "maximum": 100
    },
    "includePlatformRaw": {
      "type": "boolean",
      "description": "Whether to include transient platform-native payloads."
    }
  },
  "additionalProperties": false
}
```

### `get`

Get one mention in full, hydrating a mention event: TikTok's webhook payload carries no engagement counts or thumbnail, and no comment text or author handle for a comment mention. Details stay readable for 48 hours after the webhook.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `profileId` | `string` | yes | Koil Profile associated with the operation. |
| `externalId` | `string` | yes | The mention's id: the comment id for a comment mention, the post id for a post (caption) mention. |
| `containerId` | `string` | no | The post a comment mention is on; required for a comment mention. |
| `variant` | `"post" \| "comment"` | yes |  |
| `includePlatformRaw` | `boolean` | no | Whether to include transient platform-native payloads. |

JSON Schema

```json
{
  "type": "object",
  "required": [
    "profileId",
    "externalId",
    "variant"
  ],
  "properties": {
    "profileId": {
      "type": "string",
      "description": "Koil Profile associated with the operation.",
      "minLength": 1
    },
    "externalId": {
      "type": "string",
      "minLength": 1,
      "description": "The mention's id: the comment id for a comment mention, the post id for a post (caption) mention."
    },
    "containerId": {
      "type": "string",
      "minLength": 1,
      "description": "The post a comment mention is on; required for a comment mention."
    },
    "variant": {
      "enum": [
        "post",
        "comment"
      ]
    },
    "includePlatformRaw": {
      "type": "boolean",
      "description": "Whether to include transient platform-native payloads."
    }
  },
  "additionalProperties": false
}
```

### Not offered

-   `resolve_attachment`: not applicable
-   `publish`: not applicable
-   `update`: not applicable
-   `perform_action`: platform not supported
-   `delete`: not applicable

### Events

-   [`content.tiktok.videos.mentions.created`](https://docs.koil.co/events#content.tiktok.videos.mentions.created)
-   [`content.tiktok.videos.mentions.updated`](https://docs.koil.co/events#content.tiktok.videos.mentions.updated)

Backfill: supported (partial coverage); see [Backfill history](https://docs.koil.co/guides/backfill).

Item schema

What `list` and `get` return and what events carry as `data`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `variant` | `"post" \| "comment"` | yes | Whether the mentioning item is a post (identified by the post itself) or a comment (with the post it is on as `containerId`). |
| `containerId` | `string` | no | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `media` | `object[]` | no |  |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"tiktok.videos.mentions"` | yes | The collection that delivered this item. |

## `tiktok.dm.conversations`

The account's Business Messaging conversations.

### `list`

List the TikTok Business Account's direct-message conversations from the last 90 days.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `profileId` | `string` | yes | Koil Profile associated with the operation. |
| `messageRequest` | `boolean` | yes | true lists message requests the account has not replied to; false lists conversations it has replied in. TikTok keeps them under separate cursors. |
| `cursor` | `string` | no | Opaque cursor for fetching the next result page. |
| `limit` | `integer` | no | Maximum number of items to return. |
| `includePlatformRaw` | `boolean` | no | Whether to include transient platform-native payloads. |

JSON Schema

```json
{
  "type": "object",
  "required": [
    "profileId",
    "messageRequest"
  ],
  "properties": {
    "profileId": {
      "type": "string",
      "description": "Koil Profile associated with the operation.",
      "minLength": 1
    },
    "messageRequest": {
      "type": "boolean",
      "description": "true lists message requests the account has not replied to; false lists conversations it has replied in. TikTok keeps them under separate cursors."
    },
    "cursor": {
      "type": "string",
      "description": "Opaque cursor for fetching the next result page.",
      "minLength": 1
    },
    "limit": {
      "type": "integer",
      "description": "Maximum number of items to return.",
      "minimum": 1,
      "maximum": 100
    },
    "includePlatformRaw": {
      "type": "boolean",
      "description": "Whether to include transient platform-native payloads."
    }
  },
  "additionalProperties": false
}
```

### `perform_action`

Mark the person's messages in the account's TikTok conversation as seen, or show that the account is typing. TikTok clears a typing indicator after five seconds and has no action that clears it sooner.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `profileId` | `string` | yes | Koil Profile associated with the operation. |
| `externalId` | `string` | yes | The conversation, as its `externalId` names it: TikTok's `conversation_id`. |
| `action` | `"seen" \| "typing_on"` | yes | What to do with the item: `seen` (show the person a read receipt for their messages), `typing_on` (show the person that the profile is typing). |

JSON Schema

```json
{
  "type": "object",
  "required": [
    "profileId",
    "externalId",
    "action"
  ],
  "properties": {
    "profileId": {
      "type": "string",
      "description": "Koil Profile associated with the operation.",
      "minLength": 1
    },
    "externalId": {
      "type": "string",
      "minLength": 1,
      "description": "The conversation, as its `externalId` names it: TikTok's `conversation_id`."
    },
    "action": {
      "enum": [
        "seen",
        "typing_on"
      ],
      "description": "What to do with the item: `seen` (show the person a read receipt for their messages), `typing_on` (show the person that the profile is typing).",
      "x-koil-narrows": "ContentAction"
    }
  },
  "additionalProperties": false
}
```

### Not offered

-   `get`: platform no endpoint
-   `resolve_attachment`: not applicable
-   `publish`: not applicable
-   `update`: not applicable
-   `delete`: platform no endpoint
-   `perform_action` `typing_off`: platform no endpoint — TikTok's sender actions are TYPING and MARK\_READ only; the typing indicator clears itself after five seconds.

### Events

-   [`content.tiktok.dm.conversations.updated`](https://docs.koil.co/events#content.tiktok.dm.conversations.updated)

Backfill: not offered — not applicable — Conversations emit only updated, and backfill emits created; a new conversation arrives as its first message, which tiktok.dm.messages backfills..

Item schema

What `list` and `get` return and what events carry as `data`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `counterpart` | `object` | no | The person the account is talking to in a 1:1 conversation. A group chat has none. |
| `messageRequest` | `boolean` | no | Whether the conversation is still a message request: the person wrote and the account has not replied yet. Absent when the read or event did not say. |
| `updatedAt` | `string (date-time)` | no | When the conversation last changed, as the platform reports it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `referral` | `object` | no |  |
| `lastReadAt` | `string (date-time)` | no | When the platform last updated it. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"tiktok.dm.conversations"` | yes | The collection that delivered this item. |

## `tiktok.dm.messages`

Messages in one Business Messaging conversation.

### `list`

List the 20 most recent messages of one TikTok direct-message conversation.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `profileId` | `string` | yes | Koil Profile associated with the operation. |
| `containerId` | `string` | yes | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `includePlatformRaw` | `boolean` | no | Whether to include transient platform-native payloads. |

JSON Schema

```json
{
  "type": "object",
  "required": [
    "profileId",
    "containerId"
  ],
  "properties": {
    "profileId": {
      "type": "string",
      "description": "Koil Profile associated with the operation.",
      "minLength": 1
    },
    "containerId": {
      "type": "string",
      "minLength": 1,
      "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
    },
    "includePlatformRaw": {
      "type": "boolean",
      "description": "Whether to include transient platform-native payloads."
    }
  },
  "additionalProperties": false
}
```

### `resolve_attachment`

Get a URL for an image or video a TikTok direct message carries. TikTok mints one per call, valid for 24 hours.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `profileId` | `string` | yes | Koil Profile associated with the operation. |
| `externalId` | `string` | yes | The item that carries the file. |
| `attachmentExternalId` | `string` | yes | The attachment's `externalId`, as the read reported it. |
| `containerId` | `string` | yes | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `attachmentType` | `"image" \| "video"` | yes | The attachment's `type`, as the read reported it. |

JSON Schema

```json
{
  "type": "object",
  "required": [
    "profileId",
    "externalId",
    "attachmentExternalId",
    "containerId",
    "attachmentType"
  ],
  "properties": {
    "profileId": {
      "type": "string",
      "description": "Koil Profile associated with the operation.",
      "minLength": 1
    },
    "externalId": {
      "type": "string",
      "minLength": 1,
      "description": "The item that carries the file."
    },
    "attachmentExternalId": {
      "type": "string",
      "minLength": 1,
      "description": "The attachment's `externalId`, as the read reported it."
    },
    "containerId": {
      "type": "string",
      "minLength": 1,
      "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
    },
    "attachmentType": {
      "enum": [
        "image",
        "video"
      ],
      "description": "The attachment's `type`, as the read reported it."
    }
  },
  "additionalProperties": false
}
```

### `publish`

Send a message into a TikTok conversation the user opened: text, optionally quoting one of its messages, or one image.

Submit through `POST /v1/publish-requests` with `collection: "tiktok.dm.messages"`. These fields go in the item's `args`; `profileId` and `variant` are item fields.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | yes | The conversation to send into. |
| `text` | `string` | no | Message text, up to 6,000 characters. |
| `target` | `object` | no | One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL. |
| `attachments` | `object \| object[]` | no | One image, sent without `text`; TikTok sends a single picture per message. Staged, then uploaded to TikTok for a media\_id. |
| `conversationMessageRequest` | `boolean` | no |  |

JSON Schema

```json
{
  "type": "object",
  "required": [
    "containerId"
  ],
  "properties": {
    "containerId": {
      "type": "string",
      "minLength": 1,
      "description": "The conversation to send into."
    },
    "text": {
      "type": "string",
      "description": "Message text, up to 6,000 characters.",
      "minLength": 1,
      "maxLength": 6000
    },
    "target": {
      "type": "object",
      "required": [
        "kind",
        "externalId"
      ],
      "properties": {
        "kind": {
          "enum": [
            "tiktok.dm.messages"
          ]
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        }
      },
      "additionalProperties": false,
      "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
    },
    "attachments": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "object",
            "required": [
              "mediaId"
            ],
            "properties": {
              "mediaId": {
                "type": "string",
                "minLength": 1
              },
              "contentType": {
                "type": "string",
                "minLength": 1
              },
              "altText": {
                "type": "string",
                "minLength": 1
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255,
                "description": "The name the recipient sees on a document, where the destination shows one. Defaults to the uploaded file's name."
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": [
              "sourceUrl"
            ],
            "properties": {
              "sourceUrl": {
                "type": "string",
                "minLength": 1
              },
              "contentType": {
                "type": "string",
                "minLength": 1
              },
              "altText": {
                "type": "string",
                "minLength": 1
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255,
                "description": "The name the recipient sees on a document, where the destination shows one. Defaults to the uploaded file's name."
              }
            },
            "additionalProperties": false
          }
        ]
      },
      "minItems": 1,
      "maxItems": 1,
      "description": "One image, sent without `text`; TikTok sends a single picture per message. Staged, then uploaded to TikTok for a media_id."
    },
    "conversationMessageRequest": {
      "type": "boolean"
    }
  },
  "additionalProperties": false,
  "anyOf": [
    {
      "required": [
        "text"
      ]
    },
    {
      "required": [
        "attachments"
      ]
    }
  ],
  "dependentSchemas": {
    "attachments": {
      "properties": {
        "text": false,
        "target": false
      }
    },
    "text": {
      "properties": {
        "conversationMessageRequest": false
      }
    }
  }
}
```

#### Media requirements

An asset that meets everything under _Copied as is_ is published exactly as uploaded. Otherwise Koil converts only what misses, a billed media add-on that needs a paid plan. Anything under _Refused_ fails the publish request, since no conversion fixes it.

| Media | Copied as is | Otherwise converted | Refused |
| --- | --- | --- | --- |
| Image | JPEG or PNG; long edge at most 1920 px; short edge at most 1080 px | re-encoded to JPEG; downscaled to fit | over 3 MB once staged |

### Not offered

-   `get`: platform no endpoint
-   `update`: platform not supported
-   `perform_action`: not applicable — Read receipts and typing indicators act on the conversation, not on one message.
-   `delete`: platform not supported

### Events

-   [`content.tiktok.dm.messages.created`](https://docs.koil.co/events#content.tiktok.dm.messages.created)

Backfill: supported (partial coverage); see [Backfill history](https://docs.koil.co/guides/backfill).

Item schema

What `list` and `get` return and what events carry as `data`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | yes | The conversation: the same on every message in it, on reads and events alike, so an inbox groups by it. It is TikTok's conversation id, a WhatsApp group's id, and in a 1:1 chat on Instagram, Facebook or WhatsApp the counterpart's own id, since Meta's messaging webhooks carry no conversation id. |
| `target` | `object` | no | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `choice` | `object` | no | The option the person picked instead of typing: a quick reply, a button or a list row a message offered, or one of the account's ice breakers. Its label is the message's `text`, and the message that offered it is `target` where the platform names it. Present where the platform reports the tap, which on Instagram and Messenger is the message's event only: a read of the same message returns its `text` without `choice`. Absent too when the platform withholds the payload (Meta sends a postback's payload only to the app that sent the button), so such a tap reads as typed text. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `variant` | `"text" \| "image" \| "video" \| "share_post" \| "emoji" \| "sticker" \| "template" \| "other"` | yes | TikTok's message type. `other` is a type TikTok added that Koil does not model yet. |
| `recipient` | `object` | no | Platform actor reference for observed content. |
| `source` | `string` | no |  |
| `autoMessageType` | `"welcome_message" \| "suggested_question" \| "auto_reply" \| "other"` | no | Which automation sent it. `other` is one TikTok added that Koil does not model yet. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"tiktok.dm.messages"` | yes | The collection that delivered this item. |
