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

# Update static site

> Links and pages — Update static site. `POST /links/{link_id}`

Update an existing static site (`type=static`). Omit `file` to change metadata only.

<Tip>
  Paste your API key in the Authorization field as `Bearer {api_key}`.
</Tip>

<ParamField path="link_id" type="string" required>
  Link id of the static site.
</ParamField>

<ParamField body="name" type="string">
  Display name of the static site (max 128 characters).
</ParamField>

<ParamField body="file" type="file">
  Optional replacement `.html` or `.zip` package. Same validation as create.
</ParamField>

<ParamField body="url" type="string">
  Custom alias.
</ParamField>

<ParamField body="domain_id" type="integer">
  Domain id. Use `0` for the main domain.
</ParamField>

<ParamField body="project_id" type="integer">
  Project id owned by the authenticated user.
</ParamField>

<ParamField body="is_enabled" type="boolean">
  Enable or disable the site (`0` or `1`).
</ParamField>

<ParamField body="password" type="string">
  Optional visitor password (max 64 characters).
</ParamField>

<RequestExample dropdown>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.kloo.li/v1/links/{link_id}' \
    --header 'Authorization: Bearer {api_key}' \
    --header 'Content-Type: multipart/form-data' \
    --form 'name=Updated landing' \
    --form 'is_enabled=1'
  ```

  ```javascript JavaScript theme={null}
  const formData = new FormData();
  formData.append('name', 'Updated landing');
  formData.append('is_enabled', '1');

  const response = await fetch('https://api.kloo.li/v1/links/{link_id}', {
    method: 'POST',
    headers: { Authorization: 'Bearer {api_key}' },
    body: formData
  });
  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  url = 'https://api.kloo.li/v1/links/{link_id}'
  headers = {'Authorization': 'Bearer {api_key}'}
  data = {
      'name': 'Updated landing',
      'is_enabled': '1'
  }
  response = requests.request('POST', url, headers=headers, data=data)
  print(response.json())
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://api.kloo.li/v1/links/{link_id}');
  curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['Authorization: Bearer {api_key}'],
    CURLOPT_POSTFIELDS => [
      'name' => 'Updated landing',
      'is_enabled' => '1'
    ],
  ]);
  echo curl_exec($ch);
  curl_close($ch);
  ```

  ```go Go theme={null}
  package main

  import (
    "bytes"
    "fmt"
    "io"
    "mime/multipart"
    "net/http"
  )

  func main() {
    var body bytes.Buffer
    writer := multipart.NewWriter(&body)
    _ = writer.WriteField("name", "Updated landing")
    _ = writer.WriteField("is_enabled", "1")
    _ = writer.Close()
    req, _ := http.NewRequest("POST", "https://api.kloo.li/v1/links/{link_id}", &body)
    req.Header.Set("Authorization", "Bearer {api_key}")
    req.Header.Set("Content-Type", writer.FormDataContentType())
    res, _ := http.DefaultClient.Do(req)
    defer res.Body.Close()
    data, _ := io.ReadAll(res.Body)
    fmt.Println(string(data))
  }
  ```

  ```java Java theme={null}
  HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.kloo.li/v1/links/{link_id}"))
    .header("Authorization", "Bearer {api_key}")
    .header("Content-Type", "application/x-www-form-urlencoded")
    .method("POST", HttpRequest.BodyPublishers.ofString("name=Updated landing&is_enabled=1"))
    .build();
  HttpResponse<String> response = HttpClient.newHttpClient()
    .send(request, HttpResponse.BodyHandlers.ofString());
  System.out.println(response.body());
  ```

  ```csharp C# theme={null}
  using var client = new HttpClient();
  client.DefaultRequestHeaders.Add("Authorization", "Bearer {api_key}");
  var content = new FormUrlEncodedContent(new Dictionary<string, string> { { "name", "Updated landing" }, { "is_enabled", "1" } });
  var request = new HttpRequestMessage(HttpMethod.Post, "https://api.kloo.li/v1/links/{link_id}") { Content = content };
  var response = await client.SendAsync(request);
  Console.WriteLine(await response.Content.ReadAsStringAsync());
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'uri'

  uri = URI('https://api.kloo.li/v1/links/{link_id}')
  req = Net::HTTP::Post.new(uri)
  req['Authorization'] = 'Bearer {api_key}'
  req.set_form_data('name' => 'Updated landing', 'is_enabled' => '1')
  res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
  puts res.body
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "data": {
      "id": 1
    }
  }
  ```
</ResponseExample>
