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

# Update a link

> Update a link. Omitted fields are left unchanged.



## OpenAPI

````yaml PATCH /links/{id}
openapi: 3.0.3
info:
  title: linkutm API
  version: 1.0.0
  description: >-
    REST API for linkutm — short links, UTM tagging, custom domains, folders,
    tags and click analytics.


    Every endpoint documented here is served under
    `https://api.linkutm.com/api/v1`.
servers:
  - url: https://api.linkutm.com/api/v1
    description: Local development
security:
  - ApiKeyAuth: []
  - BearerAuth: []
tags:
  - name: Links
    description: Create, read, update and delete short links, individually or in bulk.
  - name: Domains
    description: Register and verify the custom domains short links are served from.
  - name: Folders
    description: Group links into folders.
  - name: Tags
    description: Label links and manage which links carry which tag.
  - name: Analytics
    description: Click analytics for the workspace and for individual links.
  - name: Imports
    description: Migrate links in from Short.io, Bitly and Rebrandly.
paths:
  /links/{id}:
    patch:
      tags:
        - Links
      summary: Update a link
      description: Update a link. Omitted fields are left unchanged.
      operationId: updateLink
      parameters:
        - name: id
          in: path
          required: true
          description: Link ID.
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: >-
                Every field is optional. Sending `null` for a nullable field
                clears it; omitting a field leaves it unchanged.
              properties:
                url:
                  type: string
                  maxLength: 2048
                  description: New destination URL. Re-runs the destination safety scan.
                archived:
                  type: boolean
                  description: Archive or restore the link.
                title:
                  type: string
                  description: Internal name for the link.
                  maxLength: 255
                  example: Spring campaign
                  nullable: true
                description:
                  type: string
                  description: Internal description.
                  maxLength: 2000
                  nullable: true
                customSlug:
                  type: string
                  description: >-
                    Short code to use instead of a generated one. Letters,
                    numbers, hyphens and underscores only. Short codes are
                    globally unique across every workspace, so a code taken
                    elsewhere returns `409`.
                  maxLength: 50
                  pattern: ^[a-zA-Z0-9_-]+$
                  example: spring-sale
                utmSource:
                  type: string
                  description: '`utm_source` appended to the destination URL.'
                  maxLength: 255
                  example: newsletter
                  nullable: true
                utmMedium:
                  type: string
                  description: '`utm_medium` appended to the destination URL.'
                  maxLength: 255
                  example: email
                  nullable: true
                utmCampaign:
                  type: string
                  description: '`utm_campaign` appended to the destination URL.'
                  maxLength: 255
                  example: spring-2026
                  nullable: true
                utmTerm:
                  type: string
                  description: '`utm_term` appended to the destination URL.'
                  maxLength: 255
                  nullable: true
                utmContent:
                  type: string
                  description: '`utm_content` appended to the destination URL.'
                  maxLength: 255
                  nullable: true
                customUtmParams:
                  type: object
                  description: >-
                    Workspace-defined UTM parameters, keyed by the parameter
                    code configured under **Parameters**. Validated against the
                    workspace's UTM rules.
                  additionalProperties:
                    type: string
                  example:
                    partner: acme
                  nullable: true
                password:
                  type: string
                  description: >-
                    Plain-text password the visitor must enter. Stored as a
                    bcrypt hash and never returned — responses expose
                    `hasPassword` instead. Counts against the
                    `passwordProtectedLinks` plan quota.
                  maxLength: 200
                  nullable: true
                expiresAt:
                  type: string
                  description: >-
                    ISO 8601 instant after which the link stops redirecting.
                    Requires the `linkScheduling` plan feature.
                  format: date-time
                  example: '2026-12-31T00:00:00.000Z'
                  nullable: true
                scheduledAt:
                  type: string
                  description: >-
                    ISO 8601 instant before which the link does not redirect
                    yet. Requires the `linkScheduling` plan feature.
                  format: date-time
                  nullable: true
                schedulingTimezone:
                  type: string
                  description: IANA timezone used to interpret the schedule in the UI.
                  maxLength: 64
                  example: Asia/Kolkata
                  nullable: true
                fallbackUrl:
                  type: string
                  description: >-
                    Where to send visitors once the link is expired, not yet
                    live, or over its click limit.
                  maxLength: 2048
                  nullable: true
                clickLimit:
                  type: integer
                  description: Stop redirecting after this many clicks.
                  minimum: 1
                  maximum: 2147483647
                  example: 1000
                  nullable: true
                iosUrl:
                  type: string
                  description: >-
                    Destination for iOS visitors. Requires the `deviceTargeting`
                    plan feature.
                  maxLength: 2048
                  nullable: true
                androidUrl:
                  type: string
                  description: >-
                    Destination for Android visitors. Requires the
                    `deviceTargeting` plan feature.
                  maxLength: 2048
                  nullable: true
                geoTargets:
                  type: array
                  description: >-
                    Country-specific destinations. Pick a country and enter the
                    URL visitors from that country are sent to. Requires the
                    `geoTargeting` plan feature. Every target URL runs through
                    the same safety scan as `url`. A map of country code to URL
                    (`{"US": "https://acme.com/us"}`) is also accepted.
                  maxItems: 100
                  items:
                    type: object
                    required:
                      - country
                      - url
                    properties:
                      country:
                        type: string
                        description: >-
                          ISO 3166-1 alpha-2 country code. The flag prefix is
                          optional — `US` and `🇺🇸 US` are both accepted.
                        enum:
                          - 🇦🇩 AD
                          - 🇦🇪 AE
                          - 🇦🇫 AF
                          - 🇦🇬 AG
                          - 🇦🇮 AI
                          - 🇦🇱 AL
                          - 🇦🇲 AM
                          - 🇦🇴 AO
                          - 🇦🇶 AQ
                          - 🇦🇷 AR
                          - 🇦🇸 AS
                          - 🇦🇹 AT
                          - 🇦🇺 AU
                          - 🇦🇼 AW
                          - 🇦🇽 AX
                          - 🇦🇿 AZ
                          - 🇧🇦 BA
                          - 🇧🇧 BB
                          - 🇧🇩 BD
                          - 🇧🇪 BE
                          - 🇧🇫 BF
                          - 🇧🇬 BG
                          - 🇧🇭 BH
                          - 🇧🇮 BI
                          - 🇧🇯 BJ
                          - 🇧🇱 BL
                          - 🇧🇲 BM
                          - 🇧🇳 BN
                          - 🇧🇴 BO
                          - 🇧🇶 BQ
                          - 🇧🇷 BR
                          - 🇧🇸 BS
                          - 🇧🇹 BT
                          - 🇧🇻 BV
                          - 🇧🇼 BW
                          - 🇧🇾 BY
                          - 🇧🇿 BZ
                          - 🇨🇦 CA
                          - 🇨🇨 CC
                          - 🇨🇩 CD
                          - 🇨🇫 CF
                          - 🇨🇬 CG
                          - 🇨🇭 CH
                          - 🇨🇮 CI
                          - 🇨🇰 CK
                          - 🇨🇱 CL
                          - 🇨🇲 CM
                          - 🇨🇳 CN
                          - 🇨🇴 CO
                          - 🇨🇷 CR
                          - 🇨🇺 CU
                          - 🇨🇻 CV
                          - 🇨🇼 CW
                          - 🇨🇽 CX
                          - 🇨🇾 CY
                          - 🇨🇿 CZ
                          - 🇩🇪 DE
                          - 🇩🇯 DJ
                          - 🇩🇰 DK
                          - 🇩🇲 DM
                          - 🇩🇴 DO
                          - 🇩🇿 DZ
                          - 🇪🇨 EC
                          - 🇪🇪 EE
                          - 🇪🇬 EG
                          - 🇪🇭 EH
                          - 🇪🇷 ER
                          - 🇪🇸 ES
                          - 🇪🇹 ET
                          - 🇫🇮 FI
                          - 🇫🇯 FJ
                          - 🇫🇰 FK
                          - 🇫🇲 FM
                          - 🇫🇴 FO
                          - 🇫🇷 FR
                          - 🇬🇦 GA
                          - 🇬🇧 GB
                          - 🇬🇩 GD
                          - 🇬🇪 GE
                          - 🇬🇫 GF
                          - 🇬🇬 GG
                          - 🇬🇭 GH
                          - 🇬🇮 GI
                          - 🇬🇱 GL
                          - 🇬🇲 GM
                          - 🇬🇳 GN
                          - 🇬🇵 GP
                          - 🇬🇶 GQ
                          - 🇬🇷 GR
                          - 🇬🇸 GS
                          - 🇬🇹 GT
                          - 🇬🇺 GU
                          - 🇬🇼 GW
                          - 🇬🇾 GY
                          - 🇭🇰 HK
                          - 🇭🇲 HM
                          - 🇭🇳 HN
                          - 🇭🇷 HR
                          - 🇭🇹 HT
                          - 🇭🇺 HU
                          - 🇮🇩 ID
                          - 🇮🇪 IE
                          - 🇮🇱 IL
                          - 🇮🇲 IM
                          - 🇮🇳 IN
                          - 🇮🇴 IO
                          - 🇮🇶 IQ
                          - 🇮🇷 IR
                          - 🇮🇸 IS
                          - 🇮🇹 IT
                          - 🇯🇪 JE
                          - 🇯🇲 JM
                          - 🇯🇴 JO
                          - 🇯🇵 JP
                          - 🇰🇪 KE
                          - 🇰🇬 KG
                          - 🇰🇭 KH
                          - 🇰🇮 KI
                          - 🇰🇲 KM
                          - 🇰🇳 KN
                          - 🇰🇵 KP
                          - 🇰🇷 KR
                          - 🇰🇼 KW
                          - 🇰🇾 KY
                          - 🇰🇿 KZ
                          - 🇱🇦 LA
                          - 🇱🇧 LB
                          - 🇱🇨 LC
                          - 🇱🇮 LI
                          - 🇱🇰 LK
                          - 🇱🇷 LR
                          - 🇱🇸 LS
                          - 🇱🇹 LT
                          - 🇱🇺 LU
                          - 🇱🇻 LV
                          - 🇱🇾 LY
                          - 🇲🇦 MA
                          - 🇲🇨 MC
                          - 🇲🇩 MD
                          - 🇲🇪 ME
                          - 🇲🇫 MF
                          - 🇲🇬 MG
                          - 🇲🇭 MH
                          - 🇲🇰 MK
                          - 🇲🇱 ML
                          - 🇲🇲 MM
                          - 🇲🇳 MN
                          - 🇲🇴 MO
                          - 🇲🇵 MP
                          - 🇲🇶 MQ
                          - 🇲🇷 MR
                          - 🇲🇸 MS
                          - 🇲🇹 MT
                          - 🇲🇺 MU
                          - 🇲🇻 MV
                          - 🇲🇼 MW
                          - 🇲🇽 MX
                          - 🇲🇾 MY
                          - 🇲🇿 MZ
                          - 🇳🇦 NA
                          - 🇳🇨 NC
                          - 🇳🇪 NE
                          - 🇳🇫 NF
                          - 🇳🇬 NG
                          - 🇳🇮 NI
                          - 🇳🇱 NL
                          - 🇳🇴 NO
                          - 🇳🇵 NP
                          - 🇳🇷 NR
                          - 🇳🇺 NU
                          - 🇳🇿 NZ
                          - 🇴🇲 OM
                          - 🇵🇦 PA
                          - 🇵🇪 PE
                          - 🇵🇫 PF
                          - 🇵🇬 PG
                          - 🇵🇭 PH
                          - 🇵🇰 PK
                          - 🇵🇱 PL
                          - 🇵🇲 PM
                          - 🇵🇳 PN
                          - 🇵🇷 PR
                          - 🇵🇸 PS
                          - 🇵🇹 PT
                          - 🇵🇼 PW
                          - 🇵🇾 PY
                          - 🇶🇦 QA
                          - 🇷🇪 RE
                          - 🇷🇴 RO
                          - 🇷🇸 RS
                          - 🇷🇺 RU
                          - 🇷🇼 RW
                          - 🇸🇦 SA
                          - 🇸🇧 SB
                          - 🇸🇨 SC
                          - 🇸🇩 SD
                          - 🇸🇪 SE
                          - 🇸🇬 SG
                          - 🇸🇭 SH
                          - 🇸🇮 SI
                          - 🇸🇯 SJ
                          - 🇸🇰 SK
                          - 🇸🇱 SL
                          - 🇸🇲 SM
                          - 🇸🇳 SN
                          - 🇸🇴 SO
                          - 🇸🇷 SR
                          - 🇸🇸 SS
                          - 🇸🇹 ST
                          - 🇸🇻 SV
                          - 🇸🇽 SX
                          - 🇸🇾 SY
                          - 🇸🇿 SZ
                          - 🇹🇨 TC
                          - 🇹🇩 TD
                          - 🇹🇫 TF
                          - 🇹🇬 TG
                          - 🇹🇭 TH
                          - 🇹🇯 TJ
                          - 🇹🇰 TK
                          - 🇹🇱 TL
                          - 🇹🇲 TM
                          - 🇹🇳 TN
                          - 🇹🇴 TO
                          - 🇹🇷 TR
                          - 🇹🇹 TT
                          - 🇹🇻 TV
                          - 🇹🇼 TW
                          - 🇹🇿 TZ
                          - 🇺🇦 UA
                          - 🇺🇬 UG
                          - 🇺🇲 UM
                          - 🇺🇸 US
                          - 🇺🇾 UY
                          - 🇺🇿 UZ
                          - 🇻🇦 VA
                          - 🇻🇨 VC
                          - 🇻🇪 VE
                          - 🇻🇬 VG
                          - 🇻🇮 VI
                          - 🇻🇳 VN
                          - 🇻🇺 VU
                          - 🇼🇫 WF
                          - 🇼🇸 WS
                          - 🇾🇪 YE
                          - 🇾🇹 YT
                          - 🇿🇦 ZA
                          - 🇿🇲 ZM
                          - 🇿🇼 ZW
                      url:
                        type: string
                        format: uri
                        description: Destination for visitors from this country.
                        maxLength: 2048
                  example:
                    - country: 🇺🇸 US
                      url: https://acme.com/us
                    - country: 🇮🇳 IN
                      url: https://acme.com/in
                  nullable: true
                geoTargetingEnabled:
                  type: boolean
                  description: >-
                    Turns geo targeting on. Set automatically when `geoTargets`
                    is supplied unless explicitly `false`.
                ogTitle:
                  type: string
                  description: Open Graph title used in link previews.
                  maxLength: 255
                  nullable: true
                ogDescription:
                  type: string
                  description: Open Graph description used in link previews.
                  maxLength: 2000
                  nullable: true
                ogImage:
                  type: string
                  description: >-
                    Preview image for the link. Send an absolute URL, or upload
                    the file inline by posting `multipart/form-data` with the
                    JSON body in a `payload` part and the image in an
                    `ogImageFile` part (PNG/JPEG/WebP, 5 MB max).
                  maxLength: 2048
                  nullable: true
                comments:
                  type: string
                  description: Internal note. Never shown to visitors.
                  maxLength: 2000
                folderId:
                  type: string
                  format: uuid
                  nullable: true
                  description: >-
                    Folder to file the link under. Requires the `tagsAndFolders`
                    plan feature.
                tagIds:
                  type: array
                  items:
                    type: string
                    format: uuid
                  description: >-
                    Tags to attach. Every ID must belong to the same workspace.
                    Requires the `tagsAndFolders` plan feature.
                pixelIds:
                  type: array
                  items:
                    type: string
                    format: uuid
                  description: >-
                    Tracking pixels to fire on click. Every ID must belong to
                    the same workspace.
                domainId:
                  type: string
                  format: uuid
                  description: >-
                    Custom domain to build the short URL from. Defaults to the
                    workspace's default domain, then to the system domain.
                templateId:
                  type: string
                  format: uuid
                  nullable: true
                  description: UTM template to apply to this link.
                cloakingEnabled:
                  type: boolean
                  description: >-
                    Serve the destination inside a frame instead of redirecting.
                    Requires the `linkCloaking` plan feature.
            example:
              url: https://acme.com/pricing
              title: Spring campaign
              customSlug: spring-sale
              utmSource: newsletter
              utmMedium: email
              utmCampaign: spring-2026
          multipart/form-data:
            schema:
              type: object
              properties:
                payload:
                  type: string
                  description: The JSON body above, serialised as a string.
                ogImageFile:
                  type: string
                  format: binary
                  description: Preview image to upload (5 MB max).
      responses:
        '200':
          description: The updated link.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Link'
        '400':
          description: >-
            The link ID in the path is missing, blank, or is not a valid UUID,
            or the request body failed validation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                statusCode: 400
                message: Link ID must be a valid UUID
                error: Bad Request
        '401':
          description: Missing, malformed, expired or revoked credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                statusCode: 401
                message: Invalid or expired API key
                error: Unauthorized
        '403':
          description: >-
            Authenticated, but the role, plan or workspace membership does not
            allow this call.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                statusCode: 403
                message: Please upgrade your plan to create more links.
                error: Forbidden
        '404':
          description: The resource does not exist, or belongs to another workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                statusCode: 404
                message: Link not found
                error: Not Found
        '409':
          description: Conflicts with a resource that already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                statusCode: 409
                message: Short code already exists
                error: Conflict
        '500':
          description: Unexpected server error. Safe to retry with backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                statusCode: 500
                message: Internal server error
components:
  schemas:
    Link:
      type: object
      description: >-
        Full link record as returned by `GET /links/{id}`, `PATCH /links/{id}`,
        `DELETE /links/{id}` and `POST /links/upsert`.


        The stored `password` is a bcrypt hash and is **never** serialised — the
        boolean `hasPassword` is returned in its place.
      properties:
        id:
          type: string
          format: uuid
        url:
          type: string
          description: Destination URL.
          example: https://acme.com/pricing
        shortCode:
          type: string
          description: Path segment of the short link.
          example: spring-sale
        title:
          type: string
          nullable: true
          example: Spring campaign
        description:
          type: string
          nullable: true
        utmSource:
          type: string
          nullable: true
          example: newsletter
        utmMedium:
          type: string
          nullable: true
          example: email
        utmCampaign:
          type: string
          nullable: true
          example: spring-2026
        utmTerm:
          type: string
          nullable: true
        utmContent:
          type: string
          nullable: true
        customUtmParams:
          type: object
          nullable: true
          description: Workspace-defined UTM parameters, keyed by parameter code.
          additionalProperties:
            type: string
        hasPassword:
          type: boolean
          description: '`true` when a password gate is set on the link.'
        expiresAt:
          type: string
          description: After this instant the link stops redirecting.
          format: date-time
          nullable: true
        scheduledAt:
          type: string
          description: Before this instant the link does not redirect yet.
          format: date-time
          nullable: true
        schedulingTimezone:
          type: string
          nullable: true
          example: Asia/Kolkata
        fallbackUrl:
          type: string
          description: Used when the link is expired, not yet live, or click-limited.
          nullable: true
        clickLimit:
          type: integer
          nullable: true
          example: 1000
        clicks:
          type: integer
          example: 42
        lastClickAt:
          type: string
          format: date-time
          nullable: true
        iosUrl:
          type: string
          description: Deep link opened for iOS visitors.
          nullable: true
        androidUrl:
          type: string
          description: Deep link opened for Android visitors.
          nullable: true
        geoTargets:
          type: object
          nullable: true
          description: ISO 3166-1 alpha-2 country code to destination URL.
          additionalProperties:
            type: string
          example:
            US: https://acme.com/us
            IN: https://acme.com/in
        geoTargetingEnabled:
          type: boolean
        ogTitle:
          type: string
          nullable: true
        ogDescription:
          type: string
          nullable: true
        ogImage:
          type: string
          description: S3 key or absolute URL of the preview image.
          nullable: true
        favicon:
          type: string
          nullable: true
        comments:
          type: string
          description: Internal note. Never shown to visitors.
          nullable: true
        qrCodeEnabled:
          type: boolean
        qrFgColor:
          type: string
          nullable: true
          example: '#000000'
        qrBgColor:
          type: string
          nullable: true
          example: '#ffffff'
        qrSize:
          type: integer
          nullable: true
          example: 512
        qrDesign:
          type: object
          nullable: true
          additionalProperties: true
        cloakingEnabled:
          type: boolean
          description: Serve the destination inside a frame instead of redirecting.
        archived:
          type: boolean
        isActive:
          type: boolean
        deletedAt:
          type: string
          description: >-
            Set by `DELETE /links/{id}`. Deleted links are never returned by
            list endpoints.
          format: date-time
          nullable: true
        safetyStatus:
          type: string
          description: Result of the destination safety scan.
          example: safe
        safetyCheckedAt:
          type: string
          format: date-time
          nullable: true
        safetyReason:
          type: string
          nullable: true
        folderId:
          type: string
          format: uuid
          nullable: true
        domainId:
          type: string
          format: uuid
          nullable: true
        templateId:
          type: string
          format: uuid
          nullable: true
        workspaceId:
          type: string
          format: uuid
        createdById:
          type: string
          format: uuid
          nullable: true
        updatedById:
          type: string
          format: uuid
          nullable: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        tags:
          type: array
          items:
            type: object
            description: Join row between a link and a tag.
            properties:
              id:
                type: string
                description: ID of the join row, not of the tag.
              tag:
                type: object
                properties:
                  id:
                    type: string
                  name:
                    type: string
                    example: paid-social
                  color:
                    type: string
                    example: '#f97316'
        pixels:
          type: array
          items:
            type: object
            properties:
              pixelId:
                type: string
        domain:
          type: object
          nullable: true
          properties:
            id:
              type: string
            domain:
              type: string
              example: go.acme.com
            verified:
              type: boolean
    Error:
      type: object
      description: >-
        Standard NestJS error envelope. `message` is a string for exceptions
        thrown by a service, and an array of strings when the global
        ValidationPipe rejects the body.
      properties:
        statusCode:
          type: integer
          example: 400
        message:
          description: Human-readable reason, or a list of field-level validation errors.
          oneOf:
            - type: string
            - type: array
              items:
                type: string
          example: Link not found
        error:
          type: string
          example: Bad Request
      required:
        - statusCode
        - message
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: 'Workspace API key, sent as `Authorization: Bearer lk_live_…`.'
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Dashboard session token from `POST /auth/login`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.