Skip to main content

Incidents Trend

Retrieve the trend of incidents for a given date range.
This endpoint returns:
  • labels: an array of dates in the interval
  • series: number of incidents for each corresponding date

Endpoint

GET /hubspot/stats/incidents-trend/:startDate/:endDate

URL Parameters

ParameterTypeRequiredDescription
startDatestringStart date of the range (YYYY-MM-DD)
endDatestringEnd date of the range (YYYY-MM-DD)

Request Headers

HeaderValueDescription
AuthorizationBearer <token>User authentication token
Note: No request body is required.

Response

Success Response (HTTP 200)

{
  "message": "",
  "data": {
    "labels": ["2025-11-01", "2025-11-02", "2025-11-03"],
    "series": [5, 3, 7]
  }
}
  • labels: Dates between startDate and endDate
  • series: Number of incidents created on each date

Error Response (HTTP 400–500)

{
  "message": "Invalid params",
  "data": {}
}
Any non-200 status code indicates an error.

Authentication

This endpoint requires user authentication via Authorization: Bearer <token>.
No user data should be sent — it is populated internally.

Example Request (cURL)

curl -X GET "https://yourdomain.com/hubspot/stats/incidents-trend/2025-11-01/2025-11-07" \
-H "Authorization: Bearer YOUR_TOKEN"

Example Request (JavaScript - fetch)

const response = await fetch(
  "/hubspot/stats/incidents-trend/2025-11-01/2025-11-07",
  {
    method: "GET",
    headers: {
      "Authorization": "Bearer YOUR_TOKEN"
    }
  }
);

const data = await response.json();
console.log(data);

Notes

  • Dates must follow YYYY-MM-DD format.
  • Dates without incidents will appear in labels with 0 count in series.
  • Trend calculation is computed server-side using the ticket creation date.