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

# Update a Link

> Updates the `destination_url` and/or `title` of an existing short link. At least one field is required.



## OpenAPI

````yaml PUT /v1/links/{short_url}
openapi: 3.0.3
info:
  title: KlipLink API
  description: A RESTful API for managing short links and QR codes.
  version: 1.0.0
servers:
  - url: https://api.klipl.ink
security:
  - bearerAuth: []
paths:
  /v1/links/{short_url}:
    put:
      summary: Update an existing link
      description: >-
        Updates the `destination_url` and/or `title` of an existing short link.
        At least one field is required.
      parameters:
        - name: short_url
          in: path
          required: true
          description: >-
            The short URL identifier of the link to update (e.g.
            `klipl.ink/your-link`).
          schema:
            type: string
          example: klipl.ink/your-link
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                destination_url:
                  type: string
                  description: The new destination URL for the short link.
                  example: https://www.example.com/new-destination
                title:
                  type: string
                  description: The new title for the short link.
                  example: Updated KlipLink API Guide
      responses:
        '200':
          description: Link updated successfully
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessResponse'
                  - $ref: '#/components/schemas/Link'
              example:
                success: true
                short_url: https://klipl.ink/your-link
                destination_url: https://www.example.com/new-destination
                clicks: 255
                created_at: '2025-11-06T14:30:00.000Z'
                title: Updated KlipLink API Guide
        '400':
          description: Bad Request
        '401':
          description: Unauthorized
        '404':
          description: Not Found
        '500':
          description: Internal Server Error
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: bash
          label: cURL
          source: |
            curl -X PUT "https://api.klipl.ink/v1/links/klipl.ink/your-link" \
              -H "Authorization: Bearer YOUR_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "destination_url": "https://www.example.com/new-destination",
                "title": "Updated KlipLink API Guide"
              }'
        - lang: python
          label: Python
          source: |
            import requests

            short_url = "klipl.ink/your-link"
            response = requests.put(
                f"https://api.klipl.ink/v1/links/{short_url}",
                headers={"Authorization": "Bearer YOUR_API_KEY"},
                json={
                    "destination_url": "https://www.example.com/new-destination",
                    "title": "Updated KlipLink API Guide"
                }
            )
            print(response.json())
        - lang: javascript
          label: JavaScript
          source: >
            const shortUrl = "klipl.ink/your-link";

            const response = await
            fetch(`https://api.klipl.ink/v1/links/${shortUrl}`, {
              method: "PUT",
              headers: {
                "Authorization": "Bearer YOUR_API_KEY",
                "Content-Type": "application/json"
              },
              body: JSON.stringify({
                destination_url: "https://www.example.com/new-destination",
                title: "Updated KlipLink API Guide"
              })
            });

            const data = await response.json();

            console.log(data);
        - lang: php
          label: PHP
          source: |
            <?php
            $shortUrl = "klipl.ink/your-link";
            $ch = curl_init("https://api.klipl.ink/v1/links/{$shortUrl}");
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
            curl_setopt($ch, CURLOPT_HTTPHEADER, [
                "Authorization: Bearer YOUR_API_KEY",
                "Content-Type: application/json"
            ]);
            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
                "destination_url" => "https://www.example.com/new-destination",
                "title" => "Updated KlipLink API Guide"
            ]));
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            $response = json_decode(curl_exec($ch), true);
            print_r($response);
components:
  schemas:
    SuccessResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
    Link:
      type: object
      properties:
        short_url:
          type: string
          example: https://klipl.ink/your-link
        destination_url:
          type: string
          example: https://example.com/
        clicks:
          type: integer
          example: 255
        created_at:
          type: string
          format: date-time
          example: '2025-11-06T14:30:00.000Z'
        title:
          type: string
          example: Example Link
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````