TikTok for Developers

Developer Docs

Last updated October 1, 2026

Network Request

Provides HTTPS request and file download APIs for communicating with developer servers, enabling real-time data exchange and asset fetching.

TTMinis.game.request(opts)

Sends an HTTPS network request.

Parameters

Field

Type

Description

Required

url

string

The developer server endpoint URL

Yes

data

string | object

The request parameters

No

header

object

The request headers. The Referer header cannot be set. The default content-type is application/json.

No

timeout

int32

The timeout duration in milliseconds

No

method

string

The HTTP request method. Default is GET.

No

dataType

string

The response data format. Default is json.

No

responseType

string

The response data type. Default is text.

No

success

function

The callback function called when the API call succeeds

No

fail

function

The callback function called when the API call fails

No

complete

function

The callback function called when the API call ends, regardless of success or failure

No

Example

TTMinis.game.request({
  url: 'https://EXAMPLE_ENDPOINT',
  data: {
    x: '',
    y: ''
  },
  header: {
    'content-type': 'application/json'
  },
  success(res) {
    console.log(res.data)
  }
})

TTMinis.game.RequestTask.abort()

Aborts the request task.

Example

const requestTask = TTMinis.game.request({
  url: 'https://EXAMPLE_ENDPOINT'
})

requestTask.abort()

TTMinis.game.downloadFile(opts)

Downloads a file resource to a local temporary path. The client initiates an HTTPS GET request and returns the local temporary file path.

Parameters

Field

Type

Description

Required

url

string

The URL of the resource to download

Yes

header

object

The HTTP request headers. The Referer header cannot be set.

No

timeout

int32

The timeout duration in milliseconds. Default is 60000 (one minute).

No

success

function

The callback function called when the API call succeeds

No

fail

function

The callback function called when the API call fails

No

complete

function

The callback function called when the API call ends, regardless of success or failure

No

Success callback parameters

Field

Type

Description

tempFilePath

string

The temporary file path. Returned when no filePath storage path is specified. The downloaded file is stored in a temporary location.

statusCode

int32

The HTTP status code returned by the developer server

Returns

A DownloadTask object that can be used to monitor and control the download.

Example

TTMinis.game.downloadFile({
  url: 'https://example.com/audio/123',
  success(res) {
    if (res.statusCode === 200) {
      TTMinis.game.playVoice({
        filePath: res.tempFilePath
      })
    }
  }
})

TTMinis.game.DownloadTask.abort()

Aborts the download task.

Example

const downloadTask = TTMinis.game.downloadFile({
  url: 'https://example.com/audio/123'
})

downloadTask.abort()
TikTok for Developers