# Get metrics usable in histograms

- Operation ID: `analytics2-get-histogram-metrics`
- HTTP method: `GET`
- Path: `/analytics/analytics/v3/metrics/histogram-metrics`
- [Human-readable API reference](https://hub.synerise.com/api-reference/analytics-suite#tag/Analytics:-Metrics/operation/analytics2-get-histogram-metrics)

## Self-contained OpenAPI method

The fenced document below contains this method's documentation and all of its local references. It is self-contained; no category or master specification fetch is required.

```yaml
openapi: 3.0.0
info:
  title: Synerise Public API
  version: 1.9.1
paths:
  /analytics/analytics/v3/metrics/histogram-metrics:
    get:
      tags:
        - "Analytics: Metrics"
      summary: Get metrics usable in histograms
      description: |
        Retrieve a list of metrics that can be used in histograms.

        ---

        **API consumers:** <a href="/api-reference/authorization?tag=Authorization&amp;operationId=userLogin" target="_blank" rel="noopener">Synerise User</a>, <a href="/api-reference/authorization?tag=Authorization&amp;operationId=profileLogin" target="_blank" rel="noopener">Workspace (Business Profile)</a>

        **API key permission required:** `ANALYTICS_BACKEND_METRIC_HISTOGRAM_READ`

        **User role permission required:** `analytics: read`
      operationId: analytics2-get-histogram-metrics
      responses:
        "200":
          description: List of metrics
          content:
            application/json;charset=UTF-8:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    hashId:
                      type: string
                      format: uuid
                      description: Unique ID of the resource
                    name:
                      type: string
                      description: Name of the resource
                    description:
                      type: string
                      description: Description of the resource
                    action:
                      type: object
                      description: The analyzed event
                      nullable: true
                      required:
                        - name
                      properties:
                        id:
                          type: integer
                          format: int64
                          deprecated: true
                          nullable: true
                          description: Deprecated parameter. DO NOT use. Has no effect in create/update requests.
                        name:
                          type: string
                          description: Action name of the event.
                          example: page.visit
                    eventName:
                      type: string
                      description: Action name of the event.
                      example: page.visit
                    actionId:
                      type: integer
                      format: int64
                      deprecated: true
                      nullable: true
                      description: Deprecated parameter. DO NOT use. Has no effect in create/update requests.
                    isNumber:
                      type: boolean
                      description: "`true` when the metric is purely numerical (does not calculate any events, parameters, etc.)"
                    isDynamicAnalytic:
                      type: boolean
                      description: "`true` if the analysis contains any [dynamic values](https://hub.synerise.com/docs/analytics/i_events-parameter-value/#dynamic-key)."
                    variables:
                      type: array
                      description: Dynamic keys used in this analysis
                      items:
                        type: object
                        properties:
                          name:
                            type: string
                            description: The name of the variable (dynamic key) which will receive this value for the current calculation.
                          value:
                            description: |
                              The value of the variable. Can be one of: string, integer, boolean, string[], integer[], or a DateFilter object (with type ABSOLUTE/RELATIVE).
                            example: example-string-value
                        required:
                          - name
                          - value
                    createdAt:
                      type: string
                      format: date-time
                      description: Creation time
                    isMetricHistogram:
                      type: boolean
                      description: "`true` when the metric can be used in a histogram"
                  required:
                    - createdAt
                    - isNumber
                    - name
        4XX:
          description: See error message for details
          content:
            application/json:
              schema:
                allOf:
                  - type: object
                    properties:
                      source:
                        type: object
                        nullable: true
                        description: Information about a parameter that caused the error, if applicable.
                        properties:
                          pointer:
                            type: string
                            description: Information about a parameter
                          value:
                            type: string
                            nullable: true
                            description: Currently unused
                      errors:
                        type: array
                        description: An array of errors, if applicable
                        items:
                          type: object
                          properties:
                            timestamp:
                              type: string
                              format: date-time
                              description: Time when the error occurred
                            errorCode:
                              type: string
                              description: Code of the error, needed for troubleshooting. See [https://developers.synerise.com/errors.html](https://developers.synerise.com/errors.html).
                            httpStatus:
                              type: integer
                              description: HTTP status code
                            message:
                              type: string
                              description: Description of the problem
                            traceId:
                              type: string
                              description: Currently unused
                              nullable: true
                            help:
                              type: string
                              nullable: true
                              description: Currently unused
                  - type: object
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                        description: Time when the error occurred
                      errorCode:
                        type: string
                        description: Code of the error, needed for troubleshooting. See [https://developers.synerise.com/errors.html](https://developers.synerise.com/errors.html).
                      httpStatus:
                        type: integer
                        description: HTTP status code
                      message:
                        type: string
                        description: Description of the problem
                      traceId:
                        type: string
                        description: Currently unused
                        nullable: true
                      help:
                        type: string
                        nullable: true
                        description: Currently unused
        5XX:
          description: See error message for details
          content:
            application/json:
              schema:
                allOf:
                  - type: object
                    properties:
                      source:
                        type: object
                        nullable: true
                        description: Information about a parameter that caused the error, if applicable.
                        properties:
                          pointer:
                            type: string
                            description: Information about a parameter
                          value:
                            type: string
                            nullable: true
                            description: Currently unused
                      errors:
                        type: array
                        description: An array of errors, if applicable
                        items:
                          type: object
                          properties:
                            timestamp:
                              type: string
                              format: date-time
                              description: Time when the error occurred
                            errorCode:
                              type: string
                              description: Code of the error, needed for troubleshooting. See [https://developers.synerise.com/errors.html](https://developers.synerise.com/errors.html).
                            httpStatus:
                              type: integer
                              description: HTTP status code
                            message:
                              type: string
                              description: Description of the problem
                            traceId:
                              type: string
                              description: Currently unused
                              nullable: true
                            help:
                              type: string
                              nullable: true
                              description: Currently unused
                  - type: object
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                        description: Time when the error occurred
                      errorCode:
                        type: string
                        description: Code of the error, needed for troubleshooting. See [https://developers.synerise.com/errors.html](https://developers.synerise.com/errors.html).
                      httpStatus:
                        type: integer
                        description: HTTP status code
                      message:
                        type: string
                        description: Description of the problem
                      traceId:
                        type: string
                        description: Currently unused
                        nullable: true
                      help:
                        type: string
                        nullable: true
                        description: Currently unused
      security:
        - JWT: []
      x-snr-doc-urls:
        - /api-reference/analytics-suite#tag/Analytics:-Metrics/operation/analytics2-get-histogram-metrics
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request GET \
              --url https://api.synerise.com/analytics/analytics/v3/metrics/histogram-metrics \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
        - lang: Python
          label: Python
          source: |-
            import http.client

            conn = http.client.HTTPSConnection("api.synerise.com")

            headers = { 'Authorization': "Bearer REPLACE_BEARER_TOKEN" }

            conn.request("GET", "/analytics/analytics/v3/metrics/histogram-metrics", headers=headers)

            res = conn.getresponse()
            data = res.read()

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = null;

            const xhr = new XMLHttpRequest();
            xhr.withCredentials = true;

            xhr.addEventListener("readystatechange", function () {
              if (this.readyState === this.DONE) {
                console.log(this.responseText);
              }
            });

            xhr.open("GET", "https://api.synerise.com/analytics/analytics/v3/metrics/histogram-metrics");
            xhr.setRequestHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN");

            xhr.send(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const http = require("https");

            const options = {
              "method": "GET",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/analytics/analytics/v3/metrics/histogram-metrics",
              "headers": {
                "Authorization": "Bearer REPLACE_BEARER_TOKEN"
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on("data", function (chunk) {
                chunks.push(chunk);
              });

              res.on("end", function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/analytics/analytics/v3/metrics/histogram-metrics');
            $request->setMethod(HTTP_METH_GET);

            $request->setHeaders([
              'Authorization' => 'Bearer REPLACE_BEARER_TOKEN'
            ]);

            try {
              $response = $request->send();

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.get("https://api.synerise.com/analytics/analytics/v3/metrics/histogram-metrics")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .asString();
servers:
  - description: Microsoft Azure EU
    url: https://api.synerise.com
  - description: Microsoft Azure USA
    url: https://api.azu.synerise.com
  - description: Google Cloud Platform
    url: https://api.geb.synerise.com
tags:
  - name: "Analytics: Metrics"
components:
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      description: |-
        JWT Bearer token. The header looks like this: `Bearer {JWT}`

        Remember to include the space between 'Bearer' and the token.

        Generate a token via the **Authorization** endpoints.
```
