Configuration du Script de Connexion
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.
Before using this script via API, make sure the account's username and password are stored in TikMatrix's account management.
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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| username | string | Yes | "" | 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.
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
| Code | Description |
|---|---|
| 40001 | Missing required parameters |
| 40003 | Script not supported via API |
| 40007 | No account is bound to the device, and none was named |
| 40301 | API access requires Pro+ plan |
See Also
- Task Management API - Create, list, and manage tasks
- Configuration du Script de Correspondance de Compte - Associer les comptes sur l'appareil
- Configuration du Script de Profil - Mettre à jour le profil
- Local API Overview - API overview and quick start