Local API Overview
TikMatrix provides a local RESTful API that allows you to manage tasks programmatically. This is useful for integrating TikMatrix with your own automation systems, building custom workflows, or creating batch operations.
Requirements
The Local API is only available for Pro, Team, and Business plan subscribers. Starter plan does not have access to the API.
Base URL
The API runs on your local machine at:
http://localhost:50809/api/v1/
The port 50809 is the default port. Make sure TikMatrix is running before making API requests.
Response Format
All API responses follow this format:
{
"code": 0,
"message": "success",
"data": { ... }
}
Response Codes
| Code | Description |
|---|---|
| 0 | Success |
| 40001 | Bad Request - Invalid parameters, including a script_config that fails validation |
| 40002 | Bad Request - Missing script_name |
| 40003 | Bad Request - Script not supported on this build or platform, has no implementation, or invalid task state for the action |
| 40004 | Bad Request - Only running tasks can be stopped |
| 40005 | Bad Request - task_ids cannot be empty |
| 40301 | Forbidden - API access requires Pro+ plan |
| 40401 | Not Found - Resource not found |
| 50001 | Internal Server Error |
Quick Start
1. Check API Access
First, verify your license supports API access:
curl http://localhost:50809/api/v1/license/check
Response:
{
"code": 0,
"message": "success",
"data": {
"plan_name": "Pro",
"api_enabled": true,
"device_limit": 20,
"message": "API access enabled"
}
}
2. Discover the Scripts and Their Parameters
GET /api/v1/schema describes every script this build can run and the exact
script_config fields each one takes — names, types, defaults, allowed values
and which fields are required. It is generated from the same catalog the server
validates against, so it cannot drift from what task creation accepts.
curl http://localhost:50809/api/v1/schema
Two optional query parameters:
| Parameter | Effect |
|---|---|
platform | Restrict the listing to tiktok or instagram. A platform this build does not ship is rejected with 40001. Defaults to everything the build ships. |
include_unavailable | Set to true to also list script names the API accepts but that have no working implementation. Each carries an unavailable_reason. |
Response (abridged):
{
"code": 0,
"message": "success",
"data": {
"build": { "platforms": ["tiktok"] },
"scripts": [
{
"name": "follow",
"internal_name": "follow",
"summary": "Follow the given users. One task per target.",
"platforms": ["tiktok", "instagram"],
"available": true,
"fan_out": { "kind": "per_item", "key": "target_users", "alt_key": "target_user" },
"any_of": [["target_users", "target_user"]],
"fields": [
{
"key": "access_method",
"type": "string",
"required": false,
"default": "direct",
"choices": ["direct", "search"],
"description": "How to reach the profile: direct (via URL) or search."
}
]
}
]
}
}
fan_out tells you how many tasks a request will produce: per_device creates
one task per device (or per account in multi-account mode), per_item creates
one per entry of the named field, per device.
3. Create a Task
curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1", "device_serial_2"],
"script_name": "post",
"script_config": {
"content_type": 1,
"captions": "Check out my new video! #viral"
},
"enable_multi_account": false,
"start_time": "14:30"
}'
4. List Tasks
curl "http://localhost:50809/api/v1/task?status=0&page=1&page_size=20"
Available Scripts
The script_name parameter accepts the following values:
| Script Name | Description | API Support |
|---|---|---|
post | Publish content | ✅ Supported |
follow | Follow users | ✅ Supported |
unfollow | Unfollow users | ✅ Supported |
account_warmup | Warm up accounts | ✅ Supported |
comment | Post a new comment on posts | ✅ Supported |
boost_comment | Like / reply to existing comments | ✅ Supported |
login | Login to account | ✅ Supported |
profile | Update profile | ✅ Supported |
match_account | Match accounts on device | ✅ Supported |
like | Like posts | ✅ Supported |
view | Watch a post for a duration | ✅ Supported |
favorite | Save a post to Favorites | ✅ Supported |
repost | Repost videos | ✅ Supported — TikTok only |
message | Send direct messages | ❌ Not available § |
follow_suggested | Follow suggested accounts | ✅ Supported — TikTok only |
custom_script | Run a program you registered yourself | ✅ Supported ‡ |
super_marketing | Super marketing campaign | ✅ Supported † |
scrape_user | Scrape user data | 🔜 Coming Soon |
The super marketing campaign is not created through POST /api/v1/task. It runs off a reusable target dataset and has its own endpoints — see the Super Marketing Script Configuration.
message has no implementationmessage was accepted by task creation but the script binary has no handler for
it on either platform, so every such task failed on the device with
"Unknown script". It is now rejected at creation with that reason instead. To
send direct messages today, use super_marketing, which drives DMs through a
target dataset.
repost and follow_suggested are implemented for TikTok only. Creating one
against an Instagram target is rejected rather than queued — previously the task
was created and then failed on the device.
custom_script runs a program you registered under Devices → Custom Scripts. Pass its id in script_config.custom_script_id — see Custom Scripts.
script_config Validation
Task creation validates script_config against the schema above before writing
anything, so a bad parameter comes back as a 400 naming the field instead of a
task that fails on the phone later. Three things are rejected:
- a required field that is missing or empty,
- an either-or group where none of the members is set (for example
followneeds one oftarget_users/target_user), - a value outside a field's documented
choices.
Keys the schema does not list are ignored, not rejected — the desktop app threads its own keys through the same object, and rejecting unknown keys would break existing integrations. They are logged server-side so you can spot a typo in the app log.
Numbers may be sent as strings ("20" as well as 20), matching what the
scripts already accept.
Task Status
| Status Code | Status Text | Description |
|---|---|---|
| 0 | pending | Task is waiting to be executed |
| 1 | running | Task is currently running |
| 2 | completed | Task completed successfully |
| 3 | failed | Task failed |
Next Steps
- Task Management API - Create, query, and manage tasks
- Custom Scripts - Write your own automation in any language and drive devices directly
- Activity Log API - Track and manage activity logs
- Post Script Configuration - Configure post script parameters
- Follow Script Configuration - Configure follow script parameters
- Follow Suggested Script Configuration - Configure follow suggested script parameters
- Unfollow Script Configuration - Configure unfollow script parameters
- Account Warmup Script Configuration - Configure account warmup script parameters
- Comment Script Configuration - Post a new comment on posts
- Boost Comment (Reply) Script Configuration - Like / reply to existing comments
- Like Script Configuration - Configure like script parameters
- View Script Configuration - Watch posts for a configurable duration
- Favorite Script Configuration - Save posts to Favorites
- Message Script Configuration - Configure message script parameters
- Login Script Configuration - Configure login script parameters
- Profile Script Configuration - Configure profile script parameters
- Match Account Script Configuration - Configure match account script parameters
- Super Marketing Script Configuration - Import target datasets and launch super marketing campaigns
- TCP Scan API - Scan and connect Android devices over TCP/IP
- Accounts Status API - Query account status, device connectivity, and login state
- API Examples - Code examples in different languages