# Get consumption metric with new data points

- Operation ID: `generateDailyNewDataPointsStats`
- HTTP method: `POST`
- Path: `/business-profile-service/organizations/usage/stats/newDataPoints`
- [Human-readable API reference](https://hub.synerise.com/api-reference/organizations#tag/Consumption/operation/generateDailyNewDataPointsStats)

## 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:
  /business-profile-service/organizations/usage/stats/newDataPoints:
    post:
      operationId: generateDailyNewDataPointsStats
      summary: Get consumption metric with new data points
      description: |
        Retrieve the number of new events (events added to the database on a particular day), listed by day. You can limit the metric to particular workspaces and event types (actions).

        ---

        **API consumers:** <a href="/api-reference/authorization?tag=Authorization&amp;operationId=userLogin" target="_blank" rel="noopener">Synerise User</a>, <span title="Contact support">Organization</span>
      security:
        - JWT: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                from:
                  type: string
                  example: 2025-05-29
                  description: First day to retrieve, in `YYYY-MM-DD` format
                to:
                  type: string
                  example: 2025-05-30
                  description: Last day to retrieve, in `YYYY-MM-DD` format
                actions:
                  type: array
                  description: You can limit the events added to the report. Without this parameter, all events are included.
                  items:
                    type: string
                    example: page.visit
                bpGuids:
                  type: array
                  description: You can limit the workspaces added to the report. Without this parameter, all workspaces in the organization are included.
                  items:
                    type: string
                    format: uuid
                    example: 34eea35e-3ac4-44f4-95b5-fd00a3b45eff
              required:
                - from
                - to
      responses:
        "200":
          description: Statistics of new events for the specified date range
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    dailyUsageStatistics:
                      type: object
                      description: Statistics for individual days
                      properties:
                        day:
                          type: string
                          format: date
                          description: Date of the data in this object
                        events:
                          type: object
                          description: The top 5 most popular event types. The keys in the object are action names.
                          additionalProperties:
                            type: integer
                            description: The number of events
                        other:
                          type: integer
                          description: The number of events which were not included in the top 5 from `events`
                        total:
                          type: integer
                          description: The total number of events
                        totalWeight:
                          type: number
                          format: double
                          nullable: true
                          description: The total weight generated by weight-eligible actions on this day (fractional). Present only when the request's `actions` include at least one weight-eligible action; otherwise omitted.
                        weights:
                          type: object
                          nullable: true
                          description: The weight generated per weight-eligible action (fractional). The keys in the object are action names. Present only when the request's `actions` include at least one weight-eligible action; otherwise omitted.
                          additionalProperties:
                            type: number
                            format: double
                            description: The weight generated by this action
                    eventsTotal:
                      type: object
                      description: The top 5 most popular event types. The keys in the object are action names.
                      additionalProperties:
                        type: integer
                        description: The number of events
                    totalAll:
                      type: integer
                      description: The total number of all events in all requested days
                    totalOther:
                      type: integer
                      description: The total number of all events in all requested days which were no included in the top 5 from `eventsTotal`
                    totalWeight:
                      type: number
                      format: double
                      nullable: true
                      description: The total weight generated by weight-eligible actions across all requested days (fractional). Present only when the request's `actions` include at least one weight-eligible action; otherwise omitted.
                    averageWeight:
                      type: number
                      format: double
                      nullable: true
                      description: The average weight per weight-bearing event across the period (total weight divided by the total weight-event count, rounded to 2 decimal places). Present only when the request's `actions` include at least one weight-eligible action; otherwise omitted.
        "401":
          description: "Unauthorized: wrong consumer scope; token missing/expired/invalid; invalid API key; etc."
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    description: HTTP status of the response
                  error:
                    type: string
                    description: Synerise error code. See [error reference](https://developers.synerise.com/errors.html).
                  message:
                    type: string
                    description: Description of the problem
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the error occurred
        "403":
          description: "Unauthorized: insufficient permissions."
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    description: HTTP status of the response
                  error:
                    type: string
                    description: Synerise error code. See [error reference](https://developers.synerise.com/errors.html).
                  message:
                    type: string
                    description: Description of the problem
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the error occurred
        4xx:
          description: Request failed. See response for details.
          content:
            application/json:
              schema:
                type: object
                required:
                  - message
                  - timestamp
                properties:
                  httpStatus:
                    type: integer
                    description: HTTP status of the response
                  errorCode:
                    type: string
                    description: Synerise error code. See [error reference](https://developers.synerise.com/errors.html).
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the error occurred
                  message:
                    type: string
                    description: Description of the problem
                  traceId:
                    type: string
                    description: Trace ID for troubleshooting
                  errors:
                    type: array
                    description: Details of the problems
                    items:
                      type: object
                      properties:
                        errorCode:
                          type: string
                          description: Synerise error code. See [error reference](https://developers.synerise.com/errors.html).
                        message:
                          type: string
                          description: Description of the problem
                        details:
                          type: object
                          description: Details of the problem, if applicable.
                        source:
                          type: object
                          description: Properties that caused a problem, if applicable.
                          properties:
                            parameter:
                              type: string
                              description: The name of the property that caused an error
      tags:
        - Consumption
      x-snr-doc-urls:
        - /api-reference/organizations#tag/Consumption/operation/generateDailyNewDataPointsStats
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request POST \
              --url https://api.synerise.com/business-profile-service/organizations/usage/stats/newDataPoints \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '{"from":"2025-05-29","to":"2025-05-30","actions":["page.visit"],"bpGuids":["34eea35e-3ac4-44f4-95b5-fd00a3b45eff"]}'
        - lang: Python
          label: Python
          source: |-
            import http.client

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

            payload = "{\"from\":\"2025-05-29\",\"to\":\"2025-05-30\",\"actions\":[\"page.visit\"],\"bpGuids\":[\"34eea35e-3ac4-44f4-95b5-fd00a3b45eff\"]}"

            headers = {
                'Authorization': "Bearer REPLACE_BEARER_TOKEN",
                'content-type': "application/json"
                }

            conn.request("POST", "/business-profile-service/organizations/usage/stats/newDataPoints", payload, headers)

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

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = JSON.stringify({
              "from": "2025-05-29",
              "to": "2025-05-30",
              "actions": [
                "page.visit"
              ],
              "bpGuids": [
                "34eea35e-3ac4-44f4-95b5-fd00a3b45eff"
              ]
            });

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

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

            xhr.open("POST", "https://api.synerise.com/business-profile-service/organizations/usage/stats/newDataPoints");
            xhr.setRequestHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN");
            xhr.setRequestHeader("content-type", "application/json");

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

            const options = {
              "method": "POST",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/business-profile-service/organizations/usage/stats/newDataPoints",
              "headers": {
                "Authorization": "Bearer REPLACE_BEARER_TOKEN",
                "content-type": "application/json"
              }
            };

            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.write(JSON.stringify({
              from: '2025-05-29',
              to: '2025-05-30',
              actions: ['page.visit'],
              bpGuids: ['34eea35e-3ac4-44f4-95b5-fd00a3b45eff']
            }));
            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/business-profile-service/organizations/usage/stats/newDataPoints');
            $request->setMethod(HTTP_METH_POST);

            $request->setHeaders([
              'Authorization' => 'Bearer REPLACE_BEARER_TOKEN',
              'content-type' => 'application/json'
            ]);

            $request->setBody('{"from":"2025-05-29","to":"2025-05-30","actions":["page.visit"],"bpGuids":["34eea35e-3ac4-44f4-95b5-fd00a3b45eff"]}');

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

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.post("https://api.synerise.com/business-profile-service/organizations/usage/stats/newDataPoints")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .header("content-type", "application/json")
              .body("{\"from\":\"2025-05-29\",\"to\":\"2025-05-30\",\"actions\":[\"page.visit\"],\"bpGuids\":[\"34eea35e-3ac4-44f4-95b5-fd00a3b45eff\"]}")
              .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: Consumption
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.
```
