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

> Roll-up for the authenticated workspace. Optional `campaignId` limits the window to that campaign.



## OpenAPI

````yaml /openapi.json get /api/v1/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/analytics:
    get:
      tags:
        - Analytics
      summary: Get workspace analytics
      description: >-
        Roll-up for the authenticated workspace. Optional `campaignId` limits
        the window to that campaign.
      operationId: getWorkspaceAnalytics
      parameters:
        - $ref: '#/components/parameters/Days'
        - name: campaignId
          in: query
          required: false
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Breakdown for the workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceAnalytics'
        '401':
          $ref: '#/components/responses/Unauthorized'
      security:
        - bearerAuth: []
components:
  parameters:
    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:
    WorkspaceAnalytics:
      type: object
      properties:
        workspace:
          type: string
        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'
        campaigns:
          type: array
          items:
            $ref: '#/components/schemas/Count'
        daysSeries:
          type: array
          items:
            $ref: '#/components/schemas/Count'
        topLinks:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                format: uuid
              slug:
                type: string
              title:
                type: string
                nullable: true
              destination:
                type: string
              health:
                type: string
              humanClicks:
                type: integer
    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'
  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.