# TikTok Account Validation (`dwi_wahyu/tiktok-account-validation`) Actor

Validates TikTok accounts and checks their status (active, private, not_found, banned, unknown) with follower counts, verification, and profile metadata.

- **URL**: https://apify.com/dwi_wahyu/tiktok-account-validation.md
- **Developed by:** [Dwi Wahyu](https://apify.com/dwi_wahyu) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## TikTok Account Validation

An Apify Actor built in TypeScript with the Apify SDK and Crawlee that validates TikTok accounts and returns their status (`active`, `private`, `not_found`, `banned`, or `unknown`) along with profile metrics.

### Features & Scope

Given one or more TikTok usernames, the Actor determines whether each account exists and extracts basic profile data:

- **`username`** — Normalized TikTok username (lowercase, stripped of leading `@`)
- **`exists`** — `true` if the account exists, `false` if not found, or `null` if status cannot be determined
- **`accountStatus`** — Account classification:
  - **`"active"`** — The profile exists, is publicly accessible, and profile metadata is available.
  - **`"private"`** — The profile exists and is set to private (`isPrivate: true`). Basic header counts (followers, following, likes, videos) are included when public.
  - **`"not_found"`** — The account does not exist or has been deleted (`exists: false`).
  - **`"banned"`** — The account has been suspended or is unavailable due to policy/legal restrictions.
  - **`"unknown"`** — The account status could not be classified (e.g. invalid input format or unexpected page structure).
- **`isPrivate`** — `true` if private, `false` if public, `null` if not found or unknown
- **`isVerified`** — `true` if verified with blue checkmark, `false` otherwise, `null` if not found or unknown
- **`isBusinessAccount`** — `true` if registered as a TikTok business/commerce/seller account
- **`nickname`** — Profile display name
- **`followersCount`** — Number of followers (`null` if not found or unknown)
- **`followingCount`** — Number of accounts followed (`null` if not found or unknown)
- **`likesCount`** — Total likes (hearts) received across all videos
- **`videosCount`** — Total number of published videos
- **`profileUrl`** — Canonical profile URL (`https://www.tiktok.com/@<username>`)
- **`checkedAt`** — ISO 8601 timestamp of validation
- **`error`** — Error description if validation failed or input was invalid, otherwise `null`

#### Strict Scope Guarantees

- **Usernames only**: URLs are not accepted in this version.
- **No fabricated numbers**: Any metric that cannot be read publicly returns `null` — values are never guessed.
- **Every input accounted for**: Invalid usernames or missing accounts produce a structured dataset item with a descriptive `error` field without crashing the run.

***

### Input

The Actor input is defined in [`.actor/input_schema.json`](./.actor/input_schema.json) and [`INPUT_SCHEMA.json`](./INPUT_SCHEMA.json):

| Field | Type | Required | Default | Description |
| :--- | :--- | :---: | :---: | :--- |
| `usernames` | `string[]` | Yes | — | One or more TikTok usernames (e.g. `"tiktok"`, `"@tiktok"`). |
| `proxyConfiguration` | `object` | No | `{ "useApifyProxy": true }` | Apify Proxy configuration. Residential proxies recommended if plain requests are blocked. |
| `maxConcurrency` | `integer` | No | `4` | Number of accounts processed in parallel (`1`–`10`). |
| `sessionCookie` | `string` (secret) | No | — | Optional TikTok `sessionid` cookie value if authenticated access is needed. |

#### Example Input

```json
{
    "usernames": [
        "tiktok",
        "private",
        "user_nonexistent_9988776655443322",
        "bad username!"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    },
    "maxConcurrency": 4
}
```

***

### Output

The Actor pushes one dataset item per input username in the default Apify Dataset, rendered as a table in the Apify Console.

#### Output Schema

```json
{
    "username": "string",
    "exists": "boolean | null",
    "accountStatus": "active | private | not_found | banned | unknown",
    "isPrivate": "boolean | null",
    "isVerified": "boolean | null",
    "isBusinessAccount": "boolean | null",
    "nickname": "string | null",
    "followersCount": "number | null",
    "followingCount": "number | null",
    "likesCount": "number | null",
    "videosCount": "number | null",
    "profileUrl": "string",
    "checkedAt": "ISO 8601 string",
    "error": "string | null"
}
```

#### Example Output

```json
[
    {
        "username": "tiktok",
        "exists": true,
        "accountStatus": "active",
        "isPrivate": false,
        "isVerified": true,
        "isBusinessAccount": true,
        "nickname": "TikTok",
        "followersCount": 96300000,
        "followingCount": 1,
        "likesCount": 465800000,
        "videosCount": 1512,
        "profileUrl": "https://www.tiktok.com/@tiktok",
        "checkedAt": "2026-10-19T06:00:00.000Z",
        "error": null
    },
    {
        "username": "private",
        "exists": true,
        "accountStatus": "private",
        "isPrivate": true,
        "isVerified": false,
        "isBusinessAccount": false,
        "nickname": "private",
        "followersCount": 2,
        "followingCount": 3,
        "likesCount": 0,
        "videosCount": 0,
        "profileUrl": "https://www.tiktok.com/@private",
        "checkedAt": "2026-10-19T06:00:01.000Z",
        "error": null
    },
    {
        "username": "user_nonexistent_9988776655443322",
        "exists": false,
        "accountStatus": "not_found",
        "isPrivate": null,
        "isVerified": null,
        "isBusinessAccount": null,
        "nickname": null,
        "followersCount": null,
        "followingCount": null,
        "likesCount": null,
        "videosCount": null,
        "profileUrl": "https://www.tiktok.com/@user_nonexistent_9988776655443322",
        "checkedAt": "2026-10-19T06:00:02.000Z",
        "error": null
    },
    {
        "username": "bad username!",
        "exists": null,
        "accountStatus": "unknown",
        "isPrivate": null,
        "isVerified": null,
        "isBusinessAccount": null,
        "nickname": null,
        "followersCount": null,
        "followingCount": null,
        "likesCount": null,
        "videosCount": null,
        "profileUrl": "https://www.tiktok.com/@bad username!",
        "checkedAt": "2026-10-19T06:00:00.000Z",
        "error": "Invalid TikTok username: usernames may only contain letters, numbers, underscores, and periods."
    }
]
```

***

### Status Meanings

| Status | Meaning | `exists` | Metrics Available |
| :--- | :--- | :---: | :---: |
| **`active`** | Public, active TikTok account | `true` | Yes (followers, following, likes, videos, verified, business, nickname) |
| **`private`** | Private TikTok account | `true` | Header metrics available from public page |
| **`not_found`** | Account does not exist or was deleted | `false` | `null` |
| **`banned`** | Account suspended or banned for policy/legal reasons | `true` | `null` |
| **`unknown`** | Unclassified page or invalid input format | `null` | `null` |

***

### Local Development & Testing

```bash
## Install dependencies
npm install

## Run unit tests
npm test

## Build TypeScript
npm run build

## Run Actor locally using Apify CLI
apify run
```

***

### Deployment to Apify Platform

```bash
## 1. Authenticate with your Apify account
apify login

## 2. Deploy the Actor to the Apify platform
apify push
```

***

### Summary of Testing

- **`active`**: Confirmed on public accounts (e.g. `@tiktok`, `@john`), extracting complete metrics (`followersCount`, `followingCount`, `likesCount`, `videosCount`, `isVerified`, `isBusinessAccount`).
- **`private`**: Confirmed on private accounts (e.g. `@private`, `@secret`), detecting `isPrivate: true` and extracting public header metrics.
- **`not_found`**: Confirmed on non-existent usernames (e.g. `@user_nonexistent_9988776655443322`), returning `exists: false` with `null` metrics.
- **`banned`**: Confirmed on suspended/banned status codes (`209002`, `10223`) and page messages.
- **`unknown`**: Used when requests fail after all retries or when input usernames are invalid (e.g. spaces, special characters, length > 24, or URLs).

# Actor input Schema

## `usernames` (type: `array`):

List of TikTok usernames to validate. Plain usernames only (e.g. 'tiktok' or '@tiktok'). URLs are not accepted.

## `proxyConfiguration` (type: `object`):

Apify Proxy settings. Residential proxies are recommended if plain requests are blocked by TikTok.

## `onlyExisting` (type: `boolean`):

If enabled, only accounts that exist (status active, private, or banned) are saved to the dataset. Non-existent, invalid, or failed accounts are excluded, keeping the dataset clean and empty if no valid accounts are found.

## `maxConcurrency` (type: `integer`):

Maximum number of TikTok accounts to validate in parallel (conservative default between 3 and 5).

## `sessionCookie` (type: `string`):

Optional TikTok 'sessionid' cookie value if authenticated access is needed. Stored encrypted and never logged.

## Actor input object example

```json
{
  "usernames": [
    "tiktok",
    "private",
    "nonexistent_user_9999"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "onlyExisting": true,
  "maxConcurrency": 4
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "usernames": [
        "tiktok",
        "private",
        "nonexistent_user_9999"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("dwi_wahyu/tiktok-account-validation").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "usernames": [
        "tiktok",
        "private",
        "nonexistent_user_9999",
    ],
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("dwi_wahyu/tiktok-account-validation").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "usernames": [
    "tiktok",
    "private",
    "nonexistent_user_9999"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call dwi_wahyu/tiktok-account-validation --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dwi_wahyu/tiktok-account-validation"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/awfm7C2xqjkZ6bzTI/builds/jpesuNc6YELqVSepj/openapi.json
