Custom Scripts
The built-in scripts cover the common flows. When you need something they do not — a step in a different order, a screen they never touch, or an app that is not TikTok or Instagram — you can write it yourself in any language and let TikMatrix hand you the phone.
Requirements
Custom scripts require a Pro, Team, or Business plan. Starter plan does not have access.
Your plan's device count is also the concurrency limit: a Pro plan (20 devices) can drive 20 phones at once, whether through built-in tasks, custom scripts, or a mix of both.
Two ways to run a script
Standalone
You run your program yourself. TikMatrix just lends you devices.
from tikmatrix import TikMatrix
client = TikMatrix()
for device in client.devices():
if device["busy"]:
continue
with client.device(device["serial"], label="my crawler") as d:
d.press("home")
print(d.info())
Good for one-off jobs, data collection, and anything you want to run from your own scheduler.
Managed
You register the program in TikMatrix and it becomes a task like any other. It gets the task queue, per-plan concurrency, automatic retries, the task log, and schedule templates. TikMatrix leases the device before starting your program and passes the lease id in its environment.
from tikmatrix import TikMatrix
with TikMatrix.from_env() as d: # device already leased
d.click(text="Log in")
print("done") # this line lands in the task log
Good for anything you want to run repeatedly, on a schedule, or across many devices.
Getting started
1. Install the client library
pip install requests
Then copy tikmatrix.py from the SDK directory next to your script. The library is a single file with no other dependencies.
You do not have to use it — the API is plain JSON over HTTP, and the raw endpoints are documented below.