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

# Update short link details

> Updates details of a shortened link (e.g., destination URL, alias, expiration) using its alias.



## OpenAPI

````yaml PATCH /links/{alias}
openapi: 3.0.1
info:
  title: iShortn API
  description: >-
    This is the API documentation for the iShortn API. This API is used to
    shorten URLs.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://ishortn.ink/api/v1
    description: Production server
security: []
paths:
  /links/{alias}:
    patch:
      summary: Update link details
      description: >-
        Updates details of a shortened link (e.g., destination URL, alias,
        expiration) using its alias.
      operationId: updateLinkDetails
      parameters:
        - $ref: '#/components/parameters/AliasPath'
        - $ref: '#/components/parameters/DomainQuery'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                url:
                  type: string
                  format: url
                  description: The new destination URL.
                alias:
                  type: string
                  description: The new custom alias for the shortened link.
                expiresAt:
                  type: string
                  format: date-time
                  nullable: true
                  description: >-
                    The new date and time when the link expires. Use null to
                    remove expiration date.
                expiresAfter:
                  type: integer
                  nullable: true
                  description: >-
                    The new number of clicks after which the link expires. Use
                    null to remove click limit.
              minProperties: 1
            example:
              url: https://new-destination.com
              expiresAfter: null
      responses:
        '200':
          description: Link updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LinkDetails'
              example:
                shortLink: https://ishortn.ink/newAlias
                url: https://new-destination.com
                alias: newAlias
                expiresAt: '2024-12-31T23:59:59Z'
                expiresAfter: null
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - apiKeyAuth: []
components:
  parameters:
    AliasPath:
      name: alias
      in: path
      required: true
      schema:
        type: string
      description: The alias of the shortened link.
    DomainQuery:
      name: domain
      in: query
      required: false
      schema:
        type: string
      description: >-
        The domain of the shortened link. If not provided, the default domain
        will be used.
  schemas:
    LinkDetails:
      type: object
      properties:
        shortLink:
          type: string
          description: The shortened link.
        url:
          type: string
          description: The original URL.
        alias:
          type: string
          description: The alias of the shortened link.
        expiresAt:
          type: string
          format: date-time
          nullable: true
          description: The expiration date and time of the link.
        expiresAfter:
          type: integer
          nullable: true
          description: The number of clicks after which the link expires.
        isProtected:
          type: boolean
          description: >-
            Indicates if the link is password protected (relevant for creation
            response).
  responses:
    BadRequest:
      description: Bad Request (e.g., invalid input, missing parameter, alias collision)
      content:
        application/json:
          schema:
            type: string
    Unauthorized:
      description: Unauthorized (e.g., invalid or missing API key)
      content:
        application/json:
          schema:
            type: string
          example: Invalid or missing API key
    NotFound:
      description: Not Found (e.g., link with the given alias/domain does not exist)
      content:
        application/json:
          schema:
            type: string
          example: Link not found
    InternalServerError:
      description: Internal Server Error (e.g., failed to update link)
      content:
        application/json:
          schema:
            type: string
          example: Failed to update link
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````