# List background tasks — `GET /v1/account/tasks`

> List or inspect staged background tasks for account import, registration, and warming.

- **Endpoint:** `GET https://api.tikultra.com/v1/account/tasks`
- **Auth Header:** `x-api-key: $TIKULTRA_KEY`
- **Pool:** Your Account (Runs on a connected account you own)
- **Plan Access:** Starter and up
- **Quota Weight:** Free (0 req) (`0` req on any failed call)
- **Upstream Mobile Path(s):** `gateway · task tracker`

## Parameters

No endpoint-specific parameters required.

## What it returns

Returns JSON decoded from `gateway · task tracker`. Identifier fields (`aweme_id`, `uid`, `sec_uid`, `room_id`, `product_id`) match input names on follow-up endpoints.

### Billing & telemetry headers on every response

- `x-request-id`: Unique gateway trace ID for support and debugging.
- `x-ratelimit-remaining`: Remaining requests in your current rate-limit window.
- `x-quota-weight`: Request weight for this call (0 reqs on 200 OK; always 0 on failed calls).

### Key decoded response fields

| Field | Type | Description |
| --- | --- | --- |
| `tasks` | `object[]` | Decoded list of `tasks` records (1 shown in sample). |
| `count` | `number` | Decoded `count` value returned from gateway · task tracker. |

## How to use it: Account Sign-In, Session Import & Health Lifecycle

Bind an existing TikTok account you own onto a dedicated 1:1 mobile hardware context, verify session health, and keep passport tokens fresh.

1. **Import session cookies OR start email OTP** — [`POST /v1/account/import`](https://tikultra.com/docs/api/import-session) (10 reqs): Import an exported sessionid via POST /v1/account/import, or trigger passwordless OTP via /v1/account/login/otp/send.
2. **Complete OTP verification (if using email sign-in)** *(optional)* — [`POST /v1/account/login/otp/verify`](https://tikultra.com/docs/api/otp-verify) (10 reqs): Submit the 6-digit code to /v1/account/login/otp/verify to persist your Connected Workspace account_id.
3. **Verify session health & warm tier** — [`GET /v1/account/health`](https://tikultra.com/docs/api/account-health) (1 req): Call GET /v1/account/health?account_id=... before running publishing, DM, or Studio workflows.
4. **List background tasks** **(THIS ENDPOINT)** — [`GET /v1/account/tasks`](https://tikultra.com/docs/api/account-tasks) (Free): List or inspect staged background tasks for account import, registration, and warming. (GET /v1/account/tasks).
5. **Refresh passport & MSSDK session state** *(optional)* — [`POST /v1/account/session`](https://tikultra.com/docs/api/session-state) (3 reqs): Periodically run POST /v1/account/session to refresh passport account info and token heartbeat.

> **Agent Tip:** Store the returned account_id in your database. One account_id stays bound to one dedicated device_id and city egress across restarts.

## Code examples (cURL, TypeScript SDK, Python SDK)

### TypeScript SDK
```ts
import { TikUltra } from 'tikultra'

const client = new TikUltra({ apiKey: process.env.TIKULTRA_KEY })

const res = await client.request('GET', '/v1/account/tasks')
console.log(res.data)
```

### Python SDK
```python
import os
from tikultra import TikUltra

with TikUltra(api_key=os.environ["TIKULTRA_KEY"]) as client:
    res = client.request("GET", "/v1/account/tasks")
    print(res.data)
```

### cURL
```bash
curl -G https://api.tikultra.com/v1/account/tasks \
  -H "x-api-key: $TIKULTRA_KEY"
```

### Python (HTTP)
```python
import os, requests

r = requests.get(
    "https://api.tikultra.com/v1/account/tasks",
    params={},
    headers={"x-api-key": os.environ["TIKULTRA_KEY"]},
)
print(r.json())
```

### JavaScript
```bash
const url = new URL('https://api.tikultra.com/v1/account/tasks')
url.search = new URLSearchParams({  }).toString()

const res = await fetch(url, { headers: { 'x-api-key': process.env.TIKULTRA_KEY } })
console.log(await res.json())
```

## Sample 200 JSON response

```json
{
  "tasks": [
    {
      "task_id": "tsk_4a7f902bc1e",
      "kind": "import_account",
      "status": "succeeded",
      "progress": 100,
      "stage_key": "persist_bind",
      "stage_label": "Persisted internal account ID",
      "result": {
        "account_id": "acc_7Hq2",
        "uid": "107955"
      }
    }
  ],
  "count": 1
}
```
