# Get node statistics

- Operation ID: `getBlockStatistics`
- HTTP method: `GET`
- Path: `/automation-brain/diagrams/{diagramId}/blocks/{blockId}/statistics`
- [Human-readable API reference](https://hub.synerise.com/api-reference/automation#tag/Workflows/operation/getBlockStatistics)

## 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:
  /automation-brain/diagrams/{diagramId}/blocks/{blockId}/statistics:
    get:
      security:
        - JWT: []
      tags:
        - Workflows
      summary: Get node statistics
      operationId: getBlockStatistics
      description: |
        Retrieve execution statistics for a single block enriched with block metadata (name, type).

        ---

        **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:** `AUTOMATION_STATS_READ`

        **User role permission required:** `automation_2_journeys: read`
      parameters:
        - name: diagramId
          in: path
          description: UUID of the workflow/diagram
          required: true
          schema:
            type: string
        - name: blockId
          in: path
          description: UUID of the node
          required: true
          schema:
            type: string
        - name: timePeriod
          in: query
          description: Time period for statistics
          required: false
          schema:
            type: string
            enum:
              - currentHour
              - currentDay
              - previousHour
              - previousDay
      responses:
        "200":
          description: Block statistics with block info
          content:
            application/json:
              schema:
                type: object
                description: The name of this object is the UUID of the node
                required:
                  - type
                  - entered
                properties:
                  name:
                    type: string
                    description: Name of the node, if defined
                  type:
                    type: string
                    description: Node type
                    example: EventTrigger
                  entered:
                    type: integer
                    format: int64
                    description: The number of profiles which entered this node
                  executed:
                    type: integer
                    format: int64
                    description: "The number of profiles which completed this node. NOT available for: Trigger nodes, End nodes, ABx Test nodes, Split Path nodes, and Merge Paths nodes."
                additionalProperties:
                  type: integer
                  description: Additional statistics, depending on node type. See the [User guide](https://hub.synerise.com/docs/automation/automation-activity-tracking/#statistics-reference) for a list.
                  format: int64
        "400":
          description: See error message for details
          content:
            application/json:
              schema:
                type: object
                properties:
                  httpStatus:
                    type: integer
                    description: HTTP status code of error
                  errorCode:
                    type: string
                    description: Synerise error code. See [API error reference](https://developers.synerise.com/errors.html)
                  message:
                    type: string
                    description: A description of the problem
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the problem occurred
                  help:
                    type: string
                    description: Link to the error reference
                  traceId:
                    type: string
                    description: Trace ID for troubleshooting
                  errors:
                    type: array
                    description: Array of errors
                    items:
                      $ref: "#/components/schemas/automation-brain-Error"
                  source:
                    type: object
                    description: Source of the problem
                    properties:
                      pointer:
                        type: string
                      value:
                        type: string
                    required:
                      - pointer
                  details:
                    type: object
                    description: Additional details
                    properties:
                      activeDiagrams:
                        type: array
                        description: Running diagrams using the entity, returned when they block the operation (e.g. error ABV-0101)
                        items:
                          type: object
                          description: Id and name of a diagram referenced in error details
                          required:
                            - id
                            - name
                          properties:
                            id:
                              type: string
                              format: uuid
                            name:
                              type: string
                    additionalProperties:
                      type: string
                  field:
                    type: string
                    description: JSON field which caused a problem
                required:
                  - errorCode
                  - httpStatus
                  - message
        "403":
          description: Forbidden; insufficient permissions
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Summary of the error
                  status:
                    type: integer
                    format: int32
                    description: Status code
                  timestamp:
                    type: string
                    description: Time when the message was sent
                  message:
                    type: string
                    description: Description of the problem
        "404":
          description: Diagram or block not found
      x-snr-doc-urls:
        - /api-reference/automation#tag/Workflows/operation/getBlockStatistics
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request GET \
              --url 'https://api.synerise.com/automation-brain/diagrams/%7BdiagramId%7D/blocks/%7BblockId%7D/statistics?timePeriod=SOME_STRING_VALUE' \
              --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", "/automation-brain/diagrams/%7BdiagramId%7D/blocks/%7BblockId%7D/statistics?timePeriod=SOME_STRING_VALUE", 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/automation-brain/diagrams/%7BdiagramId%7D/blocks/%7BblockId%7D/statistics?timePeriod=SOME_STRING_VALUE");
            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": "/automation-brain/diagrams/%7BdiagramId%7D/blocks/%7BblockId%7D/statistics?timePeriod=SOME_STRING_VALUE",
              "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/automation-brain/diagrams/%7BdiagramId%7D/blocks/%7BblockId%7D/statistics');
            $request->setMethod(HTTP_METH_GET);

            $request->setQueryData([
              'timePeriod' => 'SOME_STRING_VALUE'
            ]);

            $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/automation-brain/diagrams/%7BdiagramId%7D/blocks/%7BblockId%7D/statistics?timePeriod=SOME_STRING_VALUE")
              .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: Workflows
components:
  schemas:
    automation-brain-Error:
      type: object
      properties:
        httpStatus:
          type: integer
          description: HTTP status code of error
        errorCode:
          type: string
          description: Synerise error code. See [API error reference](https://developers.synerise.com/errors.html)
        message:
          type: string
          description: A description of the problem
        timestamp:
          type: string
          format: date-time
          description: Time when the problem occurred
        help:
          type: string
          description: Link to the error reference
        traceId:
          type: string
          description: Trace ID for troubleshooting
        errors:
          type: array
          description: Array of errors
          items:
            $ref: "#/components/schemas/automation-brain-Error"
        source:
          type: object
          description: Source of the problem
          properties:
            pointer:
              type: string
            value:
              type: string
          required:
            - pointer
        details:
          type: object
          description: Additional details
          properties:
            activeDiagrams:
              type: array
              description: Running diagrams using the entity, returned when they block the operation (e.g. error ABV-0101)
              items:
                type: object
                description: Id and name of a diagram referenced in error details
                required:
                  - id
                  - name
                properties:
                  id:
                    type: string
                    format: uuid
                  name:
                    type: string
          additionalProperties:
            type: string
        field:
          type: string
          description: JSON field which caused a problem
      required:
        - errorCode
        - httpStatus
        - message
  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.
```
