> ## 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.

# Retrieve analytics for a link

> Retrieves aggregated visit statistics for a shortened link using its alias.



## OpenAPI

````yaml GET /analytics/{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:
  /analytics/{alias}:
    get:
      summary: Retrieve aggregated visit statistics
      description: >-
        Retrieves aggregated visit statistics for a shortened link using its
        alias.
      operationId: getAggregatedVisitStatistics
      parameters:
        - $ref: '#/components/parameters/AliasPath'
      responses:
        '200':
          description: Aggregated visit statistics retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsData'
              example:
                clicksPerDate:
                  '2024-07-01': 150
                  '2024-07-02': 200
                clicksPerCountry:
                  US: 300
                  CA: 50
                clicksPerCity:
                  New York: 100
                  Los Angeles: 150
                clicksPerDevice:
                  Desktop: 250
                  Mobile: 100
                clicksPerOS:
                  Windows: 200
                  iOS: 100
                  Android: 50
                clicksPerBrowser:
                  Chrome: 150
                  Firefox: 100
                  Safari: 50
                clicksPerModel:
                  iPhone 12: 50
                  Galaxy S21: 30
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - apiKeyAuth: []
components:
  parameters:
    AliasPath:
      name: alias
      in: path
      required: true
      schema:
        type: string
      description: The alias of the shortened link.
  schemas:
    AnalyticsData:
      type: object
      properties:
        clicksPerDate:
          type: object
          additionalProperties:
            type: integer
          description: Number of clicks per date.
        clicksPerCountry:
          type: object
          additionalProperties:
            type: integer
          description: Number of clicks per country.
        clicksPerCity:
          type: object
          additionalProperties:
            type: integer
          description: Number of clicks per city.
        clicksPerDevice:
          type: object
          additionalProperties:
            type: integer
          description: Number of clicks per device.
        clicksPerOS:
          type: object
          additionalProperties:
            type: integer
          description: Number of clicks per operating system.
        clicksPerBrowser:
          type: object
          additionalProperties:
            type: integer
          description: Number of clicks per browser.
        clicksPerModel:
          type: object
          additionalProperties:
            type: integer
          description: Number of clicks per device model.
  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
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````