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

# Get link analytics

> Human clicks, bots, devices, geo, referrers, and UTM for one link. `days` cannot exceed the plan retention window.



## OpenAPI

````yaml /openapi.json get /api/v1/links/{id}/analytics
openapi: 3.1.0
info:
  title: TrimYourl API
  version: 1.0.0
  description: >-
    Create branded short links, update them, download QR codes, read analytics,
    and credit conversions. Authenticate with a workspace API key from Settings
    → API.
servers:
  - url: https://trimyourl.com
    description: Production
security: []
tags:
  - name: Links
    description: >-
      Create, list, update, and delete short links in the workspace that owns
      the API key.
  - name: Analytics
    description: >-
      Human clicks, bots, devices, geo, and referrers for a workspace or a
      single link.
  - name: Domains
    description: Active short-link hostnames in the workspace.
  - name: QR codes
    description: Download a PNG for an existing link using the workspace QR kit.
  - name: Conversions
    description: >-
      Credit a purchase or sign-up to the short-link click that brought the
      visitor.
paths:
  /api/v1/links/{id}/analytics:
    get:
      tags:
        - Analytics
      summary: Get link analytics
      description: >-
        Human clicks, bots, devices, geo, referrers, and UTM for one link.
        `days` cannot exceed the plan retention window.
      operationId: getLinkAnalytics
      parameters:
        - $ref: '#/components/parameters/LinkId'
        - $ref: '#/components/parameters/Days'
      responses:
        '200':
          description: Breakdown for the link.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LinkAnalytics'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - bearerAuth: []
components:
  parameters:
    LinkId:
      name: id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    Days:
      name: days
      in: query
      required: false
      schema:
        type: integer
        minimum: 1
      description: >-
        Lookback window. Capped at the plan retention (30 / 90 / 365 / 1095
        days).
  schemas:
    LinkAnalytics:
      type: object
      properties:
        linkId:
          type: string
          format: uuid
        days:
          type: integer
        humans:
          type: integer
        bots:
          type: integer
        uniques:
          type: integer
        countries:
          type: array
          items:
            $ref: '#/components/schemas/Count'
        devices:
          type: array
          items:
            $ref: '#/components/schemas/Count'
        browsers:
          type: array
          items:
            $ref: '#/components/schemas/Count'
        systems:
          type: array
          items:
            $ref: '#/components/schemas/Count'
        channels:
          type: array
          items:
            $ref: '#/components/schemas/Count'
        referrers:
          type: array
          items:
            $ref: '#/components/schemas/Count'
        ai:
          type: array
          items:
            $ref: '#/components/schemas/Count'
        utmSources:
          type: array
          items:
            $ref: '#/components/schemas/Count'
        utmMediums:
          type: array
          items:
            $ref: '#/components/schemas/Count'
        utmCampaigns:
          type: array
          items:
            $ref: '#/components/schemas/Count'
        daysSeries:
          type: array
          items:
            $ref: '#/components/schemas/Count'
    Count:
      type: object
      properties:
        label:
          type: string
        'n':
          type: integer
    Error:
      type: object
      properties:
        error:
          type: string
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: No link with that id in this workspace.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Workspace API key from Settings → API. Starts with `tyl_`.

````

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