Last updated on Jan 1

4 min read

Dashboard API

Enhance your contact center operations and access valuable insights with the Reports API. This user-friendly API allows you to gather data quickly and efficiently, streamlining your processes.

Note For the Dashboard API to work, an API key with type “Analytics” is required. Only users with "Admin" access can create the same in the settings section.

API to get Dashboards

Retrieve valuable insights from our Dashboard API for accessing data and metrics

GraphQL Endpoint & Header Details

Endpoint https://clusterid.samespace.com/analytics/api
x-api-key XoaFDQ34c@NIs!AvGgCYe2jmCppr43FR

Query

query GetDashboard($id: String) {
  dashboard(id: $id) {
    id
    isOwner
    owner {
      name
      __typename
    }
    permission {
      accessLevel
      permissionLevel
      userPermission
      __typename
    }
    timeRange
    startTime
    endTime
    timezone
    layouts {
      lg {
        i
        h
        w
        x
        y
        maxH
        maxW
        minH
        minW
        __typename
      }
      md {
        i
        h
        w
        x
        y
        maxH
        maxW
        minH
        minW
        __typename
      }
      sm {
        i
        h
        w
        x
        y
        maxH
        maxW
        minH
        minW
        __typename
      }
      xs {
        i
        h
        w
        x
        y
        maxH
        maxW
        minH
        minW
        __typename
      }
      xxs {
        i
        h
        w
        x
        y
        maxH
        maxW
        minH
        minW
        __typename
      }
      __typename
    }
    insights {
      id
      title
      timeRange
      timezone
      template {
        id
        type
        datasetId
        beta
        preferences {
          colors {
            theme
            values
            __typename
          }
          ... on StatTemplatePreference {
            valueFormat
            trendType
            __typename
          }
          ... on TableTemplatePreference {
            columns
            rowLinkTo
            sortId
            sortOrder
            __typename
          }
          ... on LineAreaBarTemplatePreference {
            viewByType
            viewBySubType
            __typename
          }
          ... on PieDonutTemplatePreference {
            pieTooltipFormat
            pieDatalabelFormat
            drillUpText
            aggregationSubType
            showAbsoluteValues
            __typename
          }
          ... on HorizontalBarTemplatePreference {
            columns
            barMaxValue
            barValueField
            __typename
          }
          __typename
        }
        __typename
      }
      bounds {
        x
        y
        w
        h
        __typename
      }
      filters {
        metricId
        title
        type
        operation
        ... on AttributeFilter {
          values
          __typename
        }
        ... on MeasureFilter {
          value
          __typename
        }
        __typename
      }
      __typename
    }
    __typename
  }
}

Payload

Please include the Dashboard ID in the payload for accurate data retrieval from our Dashboard API.

{
  "id": "64708408b289a50051bd6781"
}

Response

{
    "data": {
        "dashboard": {
            "id": "64708408b289a50051bd6781",
            "isOwner": false,
            "owner": null,
            "permission": {
                "accessLevel": "Public",
                "permissionLevel": "Read",
                "userPermission": "Read",
                "__typename": "PermissionAndSharing"
            },
            "timeRange": "PAST_30_DAYS",
            "startTime": null,
            "endTime": null,
            "timezone": "Asia/Calcutta",
            "layouts": {
                "lg": [],
                "md": [
                    {
                        "i": "64708411b289a50051bd6802",
                        "h": 1,
                        "w": 1,
                        "x": 2,
                        "y": 0,
                        "maxH": 1,
                        "maxW": 1,
                        "minH": 1,
                        "minW": 1,
                        "__typename": "Layout"
                    }
                ],
                "sm": [
                    {
                        "i": "64708411b289a50051bd6802",
                        "h": 1,
                        "w": 1,
                        "x": 2,
                        "y": 0,
                        "maxH": 1,
                        "maxW": 1,
                        "minH": 1,
                        "minW": 1,
                        "__typename": "Layout"
                    }
                ]
                "xxs": [],
                "__typename": "Layouts"
            },
            "insights": [
                {
                    "id": "6470840db289a50051bd67e6",
                    "title": "Answered (Inbound)",
                    "timeRange": "PAST_HOUR",
                    "timezone": "Asia/Calcutta",
                    "template": {
                        "id": "5ea6951db00b8f55e69bc8be",
                        "type": "STAT",
                        "datasetId": "5ea1861e465b4d80736a76e2",
                        "beta": null,
                        "preferences": {
                            "colors": null,
                            "valueFormat": "NUMBER",
                            "trendType": "POSITIVE",
                            "__typename": "StatTemplatePreference"
                        },
                        "__typename": "Template"
                    },
                    "filters": [
                        {
                            "metricId": "5ea18a55465b4d80736a76e8",
                            "title": "Channel",
                            "type": "ATTRIBUTE",
                            "operation": "nin",
                            "values": [],
                            "__typename": "AttributeFilter"
                        },
                        {
                            "metricId": "5ea18e7f465b4d80736a76ee",
                            "title": "Team",
                            "type": "ATTRIBUTE",
                            "operation": "nin",
                            "values": [],
                            "__typename": "AttributeFilter"
                        },
                        {
                            "metricId": "5ea18e11465b4d80736a76eb",
                            "title": "Agent",
                            "type": "ATTRIBUTE",
                            "operation": "nin",
                            "values": [],
                            "__typename": "AttributeFilter"
                        },
                        {
                            "metricId": "5ec384fb5c4345a0eb45ed32",
                            "title": "Flow",
                            "type": "ATTRIBUTE",
                            "operation": "nin",
                            "values": [],
                            "__typename": "AttributeFilter"
                        },
                    ],
                    "__typename": "Insight"
                },
                {
                    "id": "64708411b289a50051bd6802",
                    "title": "Answered (Outbound)",
                    "timeRange": "PAST_HOUR",
                    "timezone": "Asia/Calcutta",
                    "template": {
                        "id": "5ea2d173cd041a5367738253",
                        "type": "STAT",
                        "datasetId": "5ea1861e465b4d80736a76e2",
                        "beta": null,
                        "preferences": {
                            "colors": null,
                            "valueFormat": "NUMBER",
                            "trendType": "POSITIVE",
                            "__typename": "StatTemplatePreference"
                        },
                        "__typename": "Template"
                    },
                    "bounds": {
                        "x": 2,
                        "y": 0,
                        "w": 1,
                        "h": 1,
                        "__typename": "InsightBounds"
                    },
                    "filters": [
                        {
                            "metricId": "5ea18e7f465b4d80736a76ee",
                            "title": "Team",
                            "type": "ATTRIBUTE",
                            "operation": "nin",
                            "values": [],
                            "__typename": "AttributeFilter"
                        },
                        {
                            "metricId": "5ea18e11465b4d80736a76eb",
                            "title": "Agent",
                            "type": "ATTRIBUTE",
                            "operation": "nin",
                            "values": [],
                            "__typename": "AttributeFilter"
                        }
                    ],
                    "__typename": "Insight"
                }
            ],
            "__typename": "Dashboard"
        }
    }
}

Get Insight Data

Gain valuable insights with our powerful API for accessing data.

POST URL https://clusterid.samespace.com/analytics/api

Query

query GetInsightData($dashboardId: ID!, $insightId: ID!, $timeRange: TimeRange, $timezone: String, $startTime: Date, $endTime: Date, $skip: Int, $sortId: String, $sortOrder: Int, $limit: Int, $filters: [FilterInput!]) {
  getInsightData(dashboardId: $dashboardId, insightId: $insightId, timeRange: $timeRange, timezone: $timezone, startTime: $startTime, endTime: $endTime, skip: $skip, sortId: $sortId, sortOrder: $sortOrder, limit: $limit, filters: $filters)
}

Payload

{
  "dashboardId": "64708408b289a50051bd6781",
  "insightId": "6470840db289a50051bd67e6",
  "timeRange": "PAST_30_DAYS",
  "timezone": "Asia/Kolkata"
}

Response

{
    "data": {
        "getInsightData": {
            "data": [
                {
                    "value": 2824,
                    "title": "Answered",
                    "previousValue": 3189
                }
            ]
        }
    }
}

Get Report Data

The API returns comprehensive report data for analysis and insights.

POST URL https://clusterid.samespace.com/analytics/api

Query

query GetReportData($reportId: ID!, $startTime: Date, $endTime: Date, $timeRange: TimeRange, $timezone: String, $filters: [FilterInput!], $sortId: String, $sortOrder: Int, $skip: Int, $limit: Int) {
  getReportData(reportId: $reportId, startTime: $startTime, endTime: $endTime, timeRange: $timeRange, timezone: $timezone, filters: $filters, sortId: $sortId, sortOrder: $sortOrder, skip: $skip, limit: $limit)
}

Payload

{
  "reportId": "6007d54273902f0069dc68dc",
  "timeRange": "PAST_3_MONTHS",
  "startTime": null,
  "endTime": null,
  "timezone": "Asia/Calcutta",
  "limit": 50,
  "filters": [
    {
      "metricId": "5ea18a6b465b4d80736a76e9",
      "operation": "nin",
      "type": "ATTRIBUTE",
      "values": []
    },
  ]
}

Response

{
    "data": {
        "getReportData": {
            "data": [
                {
                    "5ef594e0eba06ff9adbcfc07": "64a4c799e8c16456e7c23a49",
                    "5e6f5fc04767c68072ee031c": "2023-07-04T22:39:23.260Z",
                    "60af7ebc2c1f3d2b8e5faf7e": "2023-07-04T22:39:23.260Z",
                    "602a0daa27200ad38393241c": "2023-07-04T22:39:54.224Z",
                    "60af7fa12c1f3d2b8e5faf7f": "2023-07-04T22:39:54.224Z",
                    "5e6f5fc04767c68072ee031d": "in",
                    "5eafce52965aff16547f2816": "+14077016752",
                    "5eafcfde965aff16547f2817": "+16932411213",
                    "5e6f5fc04767c68072ee0320": 31,
                    "5ec3ab9dc17f3c7ee1471a7a": "Web"
                },
            ]
        }
    }
}