본문으로 건너뛰기

로그인 스크립트 설정

This page documents the configuration parameters for the login script used in task creation.

Overview​

The login script is used to automatically log in to a TikTok, Instagram or Threads account on a device. It navigates to the login page and enters the credentials stored in TikMatrix for the given account.

Account Credentials Required

Before using this script via API, make sure the account's username and password are stored in TikMatrix's account management.

Threads

On Threads the script reaches the login form whichever way the device offers it: the account switcher's Add profile row, the logged-out landing page, or a form that is already on screen. If the account is already on the device it is simply made the active one, and the profile page is read back to confirm it.

A logged-out device is supported. When its landing page offers to resume the very account you asked for, the script takes that route — no password is typed and no two-factor code is needed. Otherwise it opens the form and signs in normally.

What is still unsupported is an Instagram account that has never had a Threads profile. Threads shows such an account a profile-creation flow, and the script will not click through those choices on your behalf. Add that account by hand once; afterwards login treats it like any other.

Script Configuration (script_config)​

The script_config object contains the parameters for the login script. Below are the available parameters:

Parameters​

ParameterTypeRequiredDefaultDescription
usernamestringYes""The username of the account to log in. Must match an account stored in TikMatrix.

Examples​

Login by Device Serial​

curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "login",
"script_config": {
"username": "@my_tiktok_account"
}
}'

Login by Username​

Use username mode to create a login task for a specific account:

curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"usernames": ["@my_tiktok_account"],
"script_name": "login",
"script_config": {
"username": "@my_tiktok_account"
}
}'

Login with Scheduled Start Time​

curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "login",
"script_config": {
"username": "@my_tiktok_account"
},
"start_time": "09:00"
}'

Login Multiple Accounts on Multiple Devices​

curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"usernames": ["@account1", "@account2", "@account3"],
"script_name": "login",
"script_config": {}
}'
노트

In username mode, the system automatically looks up each account and its associated device. The username in script_config is optional when using username mode, as the system uses the username from the usernames list.

Every login task needs an account

login signs one stored account in, so a task that names no account cannot run. In device mode, name the account in script_config.username, or set enable_multi_account to expand the request over the accounts bound to each device. A device with no account bound to it and no username supplied is rejected with 40007 — no task is created for any device in that request.

Response​

{
"code": 0,
"message": "success",
"data": {
"task_ids": [201],
"created_count": 1
}
}

Error Codes​

CodeDescription
40001Missing required parameters
40003Script not supported via API
40007No account is bound to the device, and none was named
40301API access requires Pro+ plan

See Also​