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

> Links — Update. `POST /links/{link_id}`

Interactive playground for `POST /links/{link_id}`.

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

<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: application/x-www-form-urlencoded' \
    --data 'example=value'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.kloo.li/v1/links/{link_id}', {
    method: 'POST',
    headers: {
      Authorization: 'Bearer {api_key}',
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    body: 'example=value'
  });
  const data = await response.json();
  console.log(data);
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.kloo.li/v1/links/{link_id}', {
    method: 'POST',
    headers: {
      Authorization: 'Bearer {api_key}',
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    body: 'example=value'
  });
  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 = {'example': 'value'}
  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 => http_build_query(['example' => 'value']),
  ]);
  echo curl_exec($ch);
  curl_close($ch);
  ```

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

  import (
    "fmt"
    "io"
    "net/http"
    "strings"
  )

  func main() {
    body := strings.NewReader("example=value")
    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", "application/x-www-form-urlencoded")
    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}")
    .method("POST", HttpRequest.BodyPublishers.ofString("example=value"))
    .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> { { "example", "value" } });
  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('example' => 'value')
  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>


## OpenAPI

````yaml openapi.yaml POST /links/{link_id}
openapi: 3.0.3
info:
  title: Kloo Public API
  version: 1.0.0
  description: User API for Kloo — short links, QR codes, domains, teams, analytics.
servers:
  - url: https://api.kloo.li/v1
security:
  - bearerAuth: []
paths:
  /links/{link_id}:
    post:
      tags:
        - Links
      summary: Update (links)
      operationId: links_update_post_links_link_id_
      parameters:
        - name: link_id
          in: path
          required: true
          schema:
            type: integer
          description: Link id
      requestBody:
        required: false
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                type:
                  type: string
                  enum:
                    - email
                    - webhook
                    - slack
                    - discord
                    - telegram
                    - microsoft_teams
                    - twilio
                    - twilio_call
                    - whatsapp
                    - x
                    - google_chat
                    - push_subscriber_id
                  description: 'Resource type (Default `link`; create: `link`|`static`)'
                location_url:
                  type: string
                  description: Destination URL (Valid URL w/ scheme)
                url:
                  type: string
                  description: Custom alias (empty = random) (Unique slug; ignored in bulk)
                domain_id:
                  type: integer
                  description: Domain id (Available domain; `0` = main)
                project_id:
                  type: integer
                  description: Project id (Owned by user)
                pixels_ids:
                  type: array
                  items:
                    type: integer
                  description: Tracking pixels (Owned pixels)
                email_reports:
                  type: array
                  items:
                    type: integer
                  description: Report handlers (Handler ids)
                is_enabled:
                  type: boolean
                  description: Enable link (Default `1`)
                schedule:
                  type: boolean
                  description: Enable schedule (Presence = true)
                start_date:
                  type: string
                  description: Start (`Y-m-d H:i:s`)
                end_date:
                  type: string
                  description: End (`Y-m-d H:i:s`)
                clicks_limit:
                  type: integer
                  description: Max clicks
                expiration_url:
                  type: string
                  description: After expiry redirect (URL or empty)
                sensitive_content:
                  type: boolean
                  description: Sensitive flag (Presence = true)
                http_status_code:
                  type: integer
                  enum:
                    - 301
                    - 302
                    - 307
                    - 308
                  description: >-
                    Redirect status (Default `301`; `301`|`302`|`307`|`308`).
                    Allowed values: `301`, `302`, `307`, `308`.
                app_linking_is_enabled:
                  type: boolean
                  description: App deep links (Presence = true)
                cloaking_is_enabled:
                  type: boolean
                  description: Cloaking (Presence = true)
                cloaking_title:
                  type: string
                  description: Cloaking title (Max 70)
                cloaking_meta_description:
                  type: string
                  description: Cloaking description (Max 160)
                cloaking_custom_js:
                  type: string
                  description: Custom JS (Max 10000)
                cloaking_favicon:
                  type: string
                  format: binary
                  description: Favicon file (Size limited)
                cloaking_opengraph:
                  type: string
                  format: binary
                  description: OG image (Size limited)
                password:
                  type: string
                  description: Visitor password (Max 64, hashed)
                forward_query_parameters_is_enabled:
                  type: boolean
                  description: Forward query string (Presence = true)
                seo_block:
                  type: boolean
                  description: noindex (Presence = true)
                utm_source:
                  type: string
                  description: UTM source (Max 128)
                utm_medium:
                  type: string
                  description: UTM medium (Max 128)
                utm_campaign:
                  type: string
                  description: UTM campaign (Max 128)
                targeting_type:
                  type: string
                  enum:
                    - continent_code
                    - country_code
                    - device_type
                    - browser_language
                    - rotation
                    - os_name
                    - browser_name
                  description: >-
                    Targeting mode (`false` or
                    `continent_code`|`country_code`|`city_name`|`device_type`|`browser_language`|`rotation`|`os_name`|`browser_name`).
                    Allowed values: `false`, `continent_code`, `country_code`,
                    `device_type`, `browser_language`, `rotation`, `os_name`,
                    `browser_name`, `city_name`.
                targeting_{type}_key[index]:
                  type: string
                  description: Rule key (When targeting on)
                targeting_{type}_value[index]:
                  type: string
                  description: Rule destination (Must be URL)
      responses:
        '200':
          description: Success
        '201':
          description: Created
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '429':
          description: Rate limit
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: '{api_key}'
      x-default: '{api_key}'
      description: >-
        Get your API key at https://kloo.li/account-api. Use `Authorization:
        Bearer {api_key}`.

````