SweetConnect LogoSweetConnect
ApiDatabus metrics

Get machine logs over a time window

Fetches machine logs within a specified time range

Access restricted to roles:

  • admin
  • manufacturer-admin
  • manufacturer-user
  • producer-admin
  • producer-user
GET
/v1/metrics/{machineId}/logs
AuthorizationBearer <token>

In: header

Path Parameters

machineId*string

UUID of the machine to query states for

Formatuuid

Query Parameters

limit?number

Maximum number of metrics to return

Default10
Range1 <= value <= 100000
startDate?unknown

Start of time window in UTC timezone. Accepted formats:

  - ISO 8601 (e.g. "2025-06-10T10:07:13Z
  - Duration (e.g. "-3d", "1h). Accepted units are: m (minutes), h (hours), d (days), w (weeks)
  - Unix timestamp in milliseconds (e.g. 1752503444666)
  - Special: "now"
  
  Defaults to "-15m" if not provided.
endDate?unknown

End of time window in UTC timezone. Accepted formats:

  - ISO 8601 (e.g. "2025-06-14T23:59:59Z")
  - Duration (e.g. "-1h", "3d")
  - Unix timestamp in milliseconds (e.g. 1721068799000)
  - Special: "now"
  
  Defaults to "now" if not provided.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://test.sweetconnect.io/api/databus/v1/metrics/9488c561-749f-4b3d-8c2f-30e867ba66db/logs"
{
  "data": [
    {
      "type": "log",
      "time": 1756826815845,
      "value": "Aborted",
      "machineId": "9488c561-749f-4b3d-8c2f-30e867ba66db",
      "machineConnectionId": "165356",
      "errorCode": "1"
    }
  ]
}
{
  "errors": [
    {
      "errorCode": "RequestValidationError",
      "message": "The 'username' field is required.",
      "extension": {
        "type": "body",
        "key": "username"
      }
    }
  ]
}
{
  "errors": [
    {
      "errorCode": "Unauthorized",
      "message": "Authentication is required to access this resource.",
      "extension": {}
    }
  ]
}
{
  "errors": [
    {
      "errorCode": "NoPermission",
      "message": "You do not have permission to access this resource.",
      "extension": {}
    }
  ]
}
{
  "errors": [
    {
      "errorCode": "NotFound",
      "message": "The requested resource was not found.",
      "extension": {}
    }
  ]
}