Skip to main content

Endpoint

POST https://api.ugc.inc/comment/create

Overview

Create a comment on a TikTok video using one of your accounts. Use the returned commentId to check the status of the comment.

Request Body

accountId
string
required
Account ID to use for commenting The account must: - Be in setup status - Belong to your organization
postUrl
string
required
Full URL to the TikTok post to comment on Format: https://www.tiktok.com/@username/video/{video_id} Example: https://www.tiktok.com/@creator/video/7234567890123456789
commentText
string
required
The text content of the comment - Can include emojis - Maximum length: 150 characters (TikTok limit) - Cannot be empty

Response

data
object
Comment creation response
curl -X POST https://api.ugc.inc/comment/create \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "accountId": "acc_123456",
    "postUrl": "https://www.tiktok.com/@creator/video/7234567890123456789",
    "commentText": "Great video! 🔥"
  }'
import requests

response = requests.post(
    'https://api.ugc.inc/comment/create',
    headers={
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
    },
    json={
        'accountId': 'acc_123456',
        'postUrl': 'https://www.tiktok.com/@creator/video/7234567890123456789',
        'commentText': 'Great video! 🔥'
    }
)

data = response.json()

if data['ok']:
    print('Comment created:', data['data']['commentId'])
    # Use this commentId to check status later
const response = await fetch("https://api.ugc.inc/comment/create", {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    accountId: "acc_123456",
    postUrl: "https://www.tiktok.com/@creator/video/7234567890123456789",
    commentText: "Great video! 🔥",
  }),
});

const data = await response.json();

if (data.ok) {
  console.log("Comment created:", data.data.commentId);
  // Use this commentId to check status later
}
import { UGCClient } from "ugcinc";

const client = new UGCClient({
  apiKey: "YOUR_API_KEY",
});

const response = await client.comments.createComment({
  accountId: "acc_123456",
  postUrl: "https://www.tiktok.com/@creator/video/7234567890123456789",
  commentText: "Great video! 🔥",
});

if (response.ok) {
  console.log(`Comment created: ${response.data.commentId}`);

  // Poll for status
  const checkStatus = async (commentId: string) => {
    const statusResponse = await client.comments.getComments({
      commentIds: [commentId],
    });

    if (statusResponse.ok && statusResponse.data.length > 0) {
      const comment = statusResponse.data[0];
      if (comment.status === "completed") {
        console.log("Comment posted!", comment.commentUrl);
      } else if (comment.status === "failed") {
        console.log("Comment failed:", comment.error);
      } else {
        // Still processing - check again later
        setTimeout(() => checkStatus(commentId), 5000);
      }
    }
  };

  checkStatus(response.data.commentId);
}
{
  "ok": true,
  "code": 200,
  "message": "Success",
  "data": {
    "commentId": "550e8400-e29b-41d4-a716-446655440000"
  }
}
{
  "ok": false,
  "code": 404,
  "message": "Account not found"
}
{
  "ok": false,
  "code": 400,
  "message": "Account is not fully configured"
}
{
  "ok": false,
  "code": 403,
  "message": "Account does not belong to this organization"
}