> ## Documentation Index
> Fetch the complete documentation index at: https://tiktools.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Resolve User IDs

> Resolve numeric TikTok user IDs to their corresponding usernames (unique_id/display_id). Accepts up to 20 user IDs per request with server-side caching for fast lookups.

## `POST` `/webcast/resolve_user_ids`

Resolve numeric TikTok user IDs to their corresponding usernames (`unique_id`/`display_id`). Accepts up to 20 user IDs per request with server-side caching for fast lookups.

**When you need this:** TikTok's internal APIs and WebSocket events often send numeric user IDs (like `6892636847263982593`) instead of readable usernames. This endpoint converts them back to `@username` format.

**Caching:** Results are cached server-side for 24 hours. Repeated lookups for the same user IDs are instant and don't count toward rate limits.

**Response data:** Returns an array of `{ user_id, unique_id, nickname, avatar_url }` objects. Users whose IDs can't be resolved (deleted accounts, banned users) are returned with `unique_id: null`.

### Parameters

| Parameter  | Type      | Required | Description                        |
| ---------- | --------- | -------- | ---------------------------------- |
| `user_ids` | string\[] | Yes      | Array of numeric user IDs (max 20) |

### Response

```json theme={null}
{ "status_code": 0, "data": { "123456": { "userId": "123456", "username": "john_doe", "cached": false } } }
```

### Examples

<CodeGroup>
  ```javascript Node.js theme={null}
  const res = await fetch('https://api.tik.tools/webcast/resolve_user_ids?apiKey=YOUR_KEY', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ user_ids: ['107955', '6789012345'] })
  });
  const { data } = await res.json();
  Object.values(data).forEach(u => console.log(`${u.userId} → @${u.username}`));
  ```

  ```python Python theme={null}
  import requests
  res = requests.post('https://api.tik.tools/webcast/resolve_user_ids',
      params={'apiKey': 'YOUR_KEY'},
      json={'user_ids': ['107955', '6789012345']})
  for uid, info in res.json()['data'].items():
      print(f"{uid} → @{info['username']}")
  ```

  ```bash cURL theme={null}
  curl -X POST "https://api.tik.tools/webcast/resolve_user_ids?apiKey=YOUR_KEY" \
    -H "Content-Type: application/json" \
    -d '{"user_ids": ["107955", "6789012345"]}'
  ```

  ```java Java theme={null}
  HttpClient client = HttpClient.newHttpClient();
  String json = "{\"user_ids\": [\"107955\", \"6789012345\"]}";
  HttpRequest req = HttpRequest.newBuilder()
      .uri(URI.create("https://api.tik.tools/webcast/resolve_user_ids?apiKey=YOUR_KEY"))
      .header("Content-Type", "application/json")
      .POST(HttpRequest.BodyPublishers.ofString(json))
      .build();
  HttpResponse<String> res = client.send(req, HttpResponse.BodyHandlers.ofString());
  System.out.println(res.body());
  ```

  ```go Go theme={null}
  payload := bytes.NewBufferString(`{"user_ids":["107955","6789012345"]}`)
  resp, err := http.Post(
      "https://api.tik.tools/webcast/resolve_user_ids?apiKey=YOUR_KEY",
      "application/json", payload)
  if err != nil { log.Fatal(err) }
  defer resp.Body.Close()
  body, _ := io.ReadAll(resp.Body)
  fmt.Println(string(body))
  ```

  ```csharp C# theme={null}
  using var client = new HttpClient();
  var json = new StringContent(
      @"{""user_ids"":[""107955"",""6789012345""]}",
      Encoding.UTF8, "application/json");
  var res = await client.PostAsync(
      "https://api.tik.tools/webcast/resolve_user_ids?apiKey=YOUR_KEY", json);
  Console.WriteLine(await res.Content.ReadAsStringAsync());
  ```
</CodeGroup>
