Skip to main content
Glama
tokportal

tokportal-mcp

Official
by tokportal

tokportal

PyPI Python license

TokPortal은 관리형 소셜 인프라 API입니다. 16개 이상 국가의 인간 계정 관리자가 생성, 워밍 및 운영하는 실제 TikTok, Instagram 및 YouTube 계정을 REST API 및 MCP 서버로 제공합니다. 계정별 OAuth, 하루 25개 게시물 제한, 앱 리뷰가 필요 없습니다.

문서 https://developers.tokportal.com · API 베이스 https://app.tokportal.com/api/ext · OpenAPI https://developers.tokportal.com/openapi.json · MCP 원격 https://app.tokportal.com/api/ext/mcp · API 키 받기 https://app.tokportal.com/developer/api-keys · llms.txt https://developers.tokportal.com/llms.txt


tokportal은 TokPortal API의 공식 Python SDK입니다(Python 3.9+, 타입 힌트 지원, 표준 라이브러리만 사용). 모든 공개 작업은 리소스 메서드 또는 생성된 request_operation 맵을 통해 사용할 수 있습니다.

설치

pip install tokportal

Related MCP server: tiktok-mcp

30초 퀵스타트

import os
from tokportal import TokPortal

client = TokPortal(api_key=os.environ["TOKPORTAL_API_KEY"])

# 1. Create a bundle: a fresh managed TikTok account in the USA + 1 video slot.
#    Credits are debited now; the account manager is assigned at publish time.
bundle = client.bundles.create({
    "bundle_type": "account_and_videos",
    "platform": "tiktok",
    "country": "USA",
    "title": "US launch",
    "videos_quantity": 1,
})
bundle_id = bundle["data"]["id"]

# 2. Upload the video straight from disk -> public_url
upload = client.uploads.video_direct("./launch.mp4", bundle_id, content_type="video/mp4")

# 3. Configure the account profile and video slot 1, then publish
client.bundles.configure_account(bundle_id, {
    "username": "mybrand.us",
    "visible_name": "My Brand",
    "biography": "Official account",
})
client.bundles.configure_video(bundle_id, 1, {
    "video_type": "video",
    "video_url": upload["data"]["public_url"],
    "description": "Day 1 - launching in the US #launch",
    "target_publish_date": "2026-09-01",
})
client.bundles.publish(bundle_id)

# 4. Later (webhook `account.in_review` / `account.finalized`, or polling):
#    saved_account_id is the real delivered account -> read it back
current = client.bundles.get(bundle_id)["data"]
if current.get("saved_account_id"):
    account = client.accounts.get(current["saved_account_id"])["data"]
    print(account["username"], account["profile_url"])

메서드 이름은 생성된 리소스 맵(bundles, uploads, accounts, analytics, webhooks)을 따릅니다. 작업에 대한 헬퍼가 없는 경우 client.request_operation("<operationId>", path=..., query=..., body=...)를 사용하세요.

전체 예제

import os
from tokportal import TokPortal, TokPortalApiError

client = TokPortal(api_key=os.environ["TOKPORTAL_API_KEY"])

me = client.me()

bundle = client.bundles.create({
    "bundle_type": "account_and_videos",
    "country": "USA",
    "videos_quantity": 5,
})

csv = client.analytics.export_videos(account=["saved-account-id"])
image = client.uploads.image_from_url({
    "url": "https://cdn.example.com/photo.jpg",
    "bundle_id": bundle["data"]["id"],
})

print(me["data"]["email"], bundle["data"], csv, image["data"])

직접 멀티파트 업로드는 동일한 구조화된 오류와 멱등성 지원을 사용합니다:

uploaded = client.uploads.video_direct(
    "./video.mp4",
    bundle["data"]["id"],
    content_type="video/mp4",
    idempotency_key="video-upload-123",
)

최신 원자 견적에서 TokPortal Coverage를 관리하세요. 크레딧이 0인 견적도 유효하며 명시적인 재활성화 호출이 필요합니다:

coverage = client.accounts.coverage("saved-account-id")
quote = coverage["data"]["reactivation_quote"]

if quote:
    client.accounts.reactivate_coverage(
        "saved-account-id",
        {
            "expected_credits": quote["credits"],
            "expected_current_period_end": quote["current_period_end"],
            "expected_lock_version": quote["lock_version"],
        },
        idempotency_key="coverage-reactivate-saved-account-id-v4",
    )

client.accounts.pause_coverage(
    "saved-account-id",
    idempotency_key="coverage-pause-saved-account-id-v4",
)

자격 증명 공개 및 인증 코드 접근은 동일한 되돌릴 수 없는 2단계 정책 흐름을 사용합니다. 수락 없이 첫 번째 호출 시 HTTP 428과 error.details.policy_version을 수신합니다. 그런 다음 해당 약관을 계정 소유자에게 보여주고 정확한 버전으로 재시도하세요. 수락된 요청은 크레딧을 차감하고 계정을 영구적으로 분리할 수 있습니다. 이러한 비밀을 포함하는 응답은 재생을 위해 저장되지 않으므로, 이 헬퍼들은 의도적으로 idempotency_key를 허용하지 않습니다. 불확실한 전송 결과 후에는 키 없이 엔드포인트를 다시 호출할지 결정하기 전에 안전한 계정 상태를 확인하세요:

수락된 호출이 CREDENTIAL_REVEAL_QUOTE_CHANGED와 함께 HTTP 409를 반환하면 요금 청구나 공개가 발생하지 않았습니다. error.details에서 현재 정책과 expected_credit_cost를 읽고, 소유자에게 새 약관을 보여주고, 새로운 동의를 얻은 후 새 버전으로 재시도하세요. 409를 자동으로 재시도하지 마세요.

try:
    client.accounts.reveal_credentials("saved-account-id")
except TokPortalApiError as error:
    if error.status_code != 428:
        raise

    policy_version = str(error.details["policy_version"])
    credentials = client.accounts.reveal_credentials(
        "saved-account-id",
        acceptance={
            "acknowledge_support_forfeit": True,
            "policy_version": policy_version,
        },
    )

동일한 재생 금지 규칙이 webhooks.create, uploads.image, uploads.video, analytics.create_report에도 적용됩니다. 이들은 서명 비밀, 서명된 업로드 기능 또는 보고서 액세스 토큰을 반환하기 때문입니다. 이 헬퍼들은 idempotency_key를 허용하지 않으며, request_operation은 6개의 민감한 작업 ID 모두에 대해 로컬에서 이를 거부합니다.

원시 HTTP로 내려가지 않고 웹훅을 발견하고 운영하세요:

catalog = client.webhooks.events()
endpoints = client.webhooks.list(event="bundle.published")
retry = client.webhooks.retry_delivery(endpoints["data"][0]["id"], "delivery-id")

모든 OpenAPI 작업은 생성된 작업 맵을 통해서도 접근 가능합니다:

same_retry = client.request_operation(
    "retryWebhookDelivery",
    path={"id": endpoints["data"][0]["id"], "delivery_id": "delivery-id"},
)

csv_again = client.request_operation(
    "exportAnalyticsVideos",
    query={"account": ["saved-account-id"]},
)

SDK는 관찰 가능성 및 지원 진단을 위해 API 요청에 X-TokPortal-Client: tokportal-python/0.1.0을 전송합니다.

정확한 원시 요청 본문으로 서명된 웹훅 전달을 확인하세요:

from tokportal import verify_webhook_signature

valid = verify_webhook_signature(
    raw_body,
    request.headers["TokPortal-Signature"],
    os.environ["TOKPORTAL_WEBHOOK_SECRET"],
)
from tokportal import TokPortalApiError

try:
    client.bundles.create({
        "bundle_type": "account_and_videos",
        "country": "USA",
        "videos_quantity": 5,
    })
except TokPortalApiError as error:
    print(error.status_code, error.code, error.details, error.request_id)
    if error.retryable:
        wait_seconds = error.retry_after_seconds or 1
        # Retry with backoff.
        pass
    print(error.rate_limit)

API 키는 sk_ 다음에 64개의 소문자 16진수 문자 형식을 사용합니다. TokPortal은 키의 SHA-256 해시만 저장하며 생성 시 원시 키를 한 번 표시합니다.

진실의 원천

이 패키지는 비공개 TokPortal 모노레포의 TokPortal 공개 OpenAPI 스키마(https://developers.tokportal.com/openapi.json)에서 생성됩니다. 생성된 파일(tokportal/_generated.py)은 모든 릴리스에서 덮어쓰여집니다. 수동으로 편집하지 마세요. PR로 허용되는 내용은 CONTRIBUTING.md를, 취약점 보고는 SECURITY.md를 참조하세요.

링크

MIT © TokPortal

Install Server
A
license - permissive license
B
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    B
    quality
    -
    maintenance
    A comprehensive MCP server that enables AI assistants to search, download, and analyze TikTok content while also performing active tasks like publishing videos and interacting with posts. It provides full automation capabilities for TikTok through browser session management and anti-detection features.
    12
    2
  • F
    license
    B
    quality
    C
    maintenance
    MCP server for TikTok that enables searching videos, users, hashtags, and fetching trending content, user profiles, and video details via official API or public scraping.
    8
  • A
    license
    A
    quality
    B
    maintenance
    MCP server for TikTok that publishes videos to your own TikTok account and retrieves video performance metrics through TikTok's official Content Posting and Display APIs.
    6
    MIT
  • A
    license
    B
    quality
    B
    maintenance
    MCP server for TikTok that lets AI agents connect accounts, post and schedule videos, follow users, manage profiles, and analyze performance—all via QR login with no API keys.
    16
    1
    MIT

View all related MCP servers

Related MCP Connectors

  • Managed LinkedIn MCP server for AI agents: search, connect, message and enrich on accounts you own.

  • MCP server for Wan AI video generation

  • MCP server for ByteDance Seedance AI video generation

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tokportal/tokportal-python'

If you have feedback or need assistance with the MCP directory API, please join our Discord server