> ## 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.

# Sign URL

> Sign any TikTok webcast URL with the required X-Bogus and X-Gnarly anti-bot parameters. This is the foundation of the API - TikTok rejects unsigned requests, so this endpoint adds the cryptographic si

## `POST` `/webcast/sign_url`

Sign any TikTok webcast URL with the required `X-Bogus` and `X-Gnarly` anti-bot parameters. This is the foundation of the API - TikTok rejects unsigned requests, so this endpoint adds the cryptographic signatures needed for valid requests.

**How it works:** Send any raw TikTok webcast URL in the request body. The API returns the signed URL with all required parameters appended, plus the `User-Agent` and cookies you must use when fetching.

**Use cases:** Building custom TikTok integrations, signing WebSocket URLs for direct connections, or signing any TikTok API endpoint that requires X-Bogus validation.

**Response data:** Returns `signed_url` (the URL with signatures), `x_bogus`, `x_gnarly`, `user_agent`, and `cookies` fields. Always use the returned User-Agent when making the final request to TikTok.

### Parameters

| Parameter | Type   | Required | Description            |
| --------- | ------ | -------- | ---------------------- |
| `url`     | string | Yes      | The TikTok URL to sign |

### Response

```json theme={null}
{ "status_code": 0, "data": { "signed_url": "...", "x_bogus": "...", "x_gnarly": "...", "user_agent": "...", "cookies": "..." } }
```

### Examples

<CodeGroup>
  ```javascript Node.js theme={null}
  const res = await fetch('https://api.tik.tools/webcast/sign_url?apiKey=YOUR_KEY', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ url: 'https://webcast.tiktok.com/...' })
  });
  const data = await res.json();
  console.log(data.data.signed_url);
  ```

  ```python Python theme={null}
  import requests
  res = requests.post('https://api.tik.tools/webcast/sign_url',
      params={'apiKey': 'YOUR_KEY'},
      json={'url': 'https://webcast.tiktok.com/...'})
  print(res.json()['data']['signed_url'])
  ```

  ```bash cURL theme={null}
  curl -X POST "https://api.tik.tools/webcast/sign_url?apiKey=YOUR_KEY" \
    -H "Content-Type: application/json" \
    -d '{"url": "https://webcast.tiktok.com/..."}'
  ```

  ```java Java theme={null}
  HttpClient client = HttpClient.newHttpClient();
  String json = "{\"url\": \"https://webcast.tiktok.com/...\"}";
  HttpRequest req = HttpRequest.newBuilder()
      .uri(URI.create("https://api.tik.tools/webcast/sign_url?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(`{"url":"https://webcast.tiktok.com/..."}`)
  resp, err := http.Post(
      "https://api.tik.tools/webcast/sign_url?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(
      @"{""url"":""https://webcast.tiktok.com/...""}",
      Encoding.UTF8, "application/json");
  var res = await client.PostAsync(
      "https://api.tik.tools/webcast/sign_url?apiKey=YOUR_KEY", json);
  Console.WriteLine(await res.Content.ReadAsStringAsync());
  ```
</CodeGroup>
