Skip to main content

Task Management API

This page documents all available API endpoints for managing tasks in TikMatrix.

Create Task

Create a new task for one or more devices or usernames.

  • Endpoint: POST /api/v1/task
  • Content-Type: application/json

Request Parameters

The API supports two modes for creating tasks:

Mode 1: Device-based - Use serials to create tasks for devices Mode 2: Username-based - Use usernames to create tasks directly for specific accounts

ParameterTypeRequiredDescription
serialsstring[]ConditionalArray of device serial numbers (required if usernames is not provided)
usernamesstring[]ConditionalArray of usernames to create tasks for (required if serials is not provided). When provided, tasks are created directly for these accounts.
script_namestringYesName of the script to execute
script_configobjectYesConfiguration parameters for the script (see script-specific documentation)
enable_multi_accountbooleanNoEnable multi-account mode (default: false). Only applicable in device-based mode.
min_intervalintegerNoMinimum interval between tasks in minutes (default: 0)
max_intervalintegerNoMaximum interval between tasks in minutes (default: 0)
start_timestringNoScheduled start time in "HH:MM" format

Supported Scripts

Script NameDescriptionDocumentation
postPublish videos or images to TikTok/InstagramPost Script Configuration

Example

curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "post",
"script_config": {
"content_type": 0,
"captions": "Check out my new video! #viral #fyp",
"material_list": ["C:/Videos/video1.mp4"],
"upload_wait_time": 60
}
}'

For detailed script_config parameters and more examples, see Post Script Configuration.

Response

{
"code": 0,
"message": "success",
"data": {
"task_ids": [101, 102],
"created_count": 2
}
}

List Tasks

Query tasks with optional filters.

  • Endpoint: GET /api/v1/task
ParameterTypeRequiredDescription
statusintegerNoFilter by status (0=pending, 1=running, 2=completed, 3=failed)
serialstringNoFilter by device serial
script_namestringNoFilter by script name
sourcestringNoFilter by source ("ui" or "api")
pageintegerNoPage number (default: 1)
page_sizeintegerNoItems per page (default: 20, max: 100)

Get Task Details

Get detailed information about a specific task.

  • Endpoint: GET /api/v1/task/{task_id}

Delete Task

Delete a task. If the task is running, it will be stopped first.

  • Endpoint: DELETE /api/v1/task/{task_id}

Batch Delete Tasks

Delete multiple tasks at once. Running tasks will be stopped first.

  • Endpoint: DELETE /api/v1/task/batch
  • Body: { "task_ids": [1, 2, 3] }

Stop Task

Stop a running task.

  • Endpoint: POST /api/v1/task/{task_id}/stop

Retry Failed Task

Retry a failed task.

  • Endpoint: POST /api/v1/task/{task_id}/retry

Retry All Failed Tasks

Retry all failed tasks at once.

  • Endpoint: POST /api/v1/task/retry-all

Get Task Statistics

Get statistics about all tasks.

  • Endpoint: GET /api/v1/task/stats
  • Response: Returns total, pending, running, completed, and failed counts.

Check API License

Check if your license supports API access.

  • Endpoint: GET /api/v1/license/check
  • Note: Starter plan returns error code 40301. Pro, Team, and Business plans have API access.