---
agentTools:
  projectIndex: https://flumetech.readme.io/llms.txt
---

# Fetch User Usage Alerts

Fetch all usage alerts from devices owned by the user.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Flume API",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.flumewater.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://example.com/oauth2/token",
            "scopes": {}
          }
        }
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/users/{user_id}/usage-alerts": {
      "get": {
        "summary": "Fetch User Usage Alerts",
        "description": "Fetch all usage alerts from devices owned by the user.",
        "operationId": "fetch-user-usage-alerts",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "description": "ID of the user",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "required": true
          },
          {
            "name": "limit",
            "in": "query",
            "description": "How many usage alerts to return",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Offset of usage alerts to return",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 0
            }
          },
          {
            "name": "sort_field",
            "in": "query",
            "description": "Which field to sort usage alerts on",
            "schema": {
              "type": "string",
              "default": "id"
            }
          },
          {
            "name": "sort_direction",
            "in": "query",
            "description": "Which direction to sort usage alerts on",
            "schema": {
              "type": "string",
              "default": "ASC"
            }
          },
          {
            "name": "device_id",
            "in": "query",
            "description": "Return usage alerts created for the device with this specific device_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "flume_leak",
            "in": "query",
            "description": "Returns usage alerts that were determined to be leaks by the Flume Smart Leak Rule.",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"success\": true,\n  \"code\": 0,\n  \"message\": \"Request OK\",\n  \"http_code\": 200,\n  \"http_message\": \"OK\",\n  \"detailed\": null,\n  \"data\": [\n    {\n      \"id\": 4,\n      \"device_id\": \"6234820280525070850\",\n      \"triggered_datetime\": \"2017-03-06T10:00:00.000Z\",\n      \"flume_leak\": true,\n      \"query\": {\n        \"request_id\": \"TRIGGERED_USAGE_ALERT\",\n        \"since_datetime\": \"2017-03-05 23:00:00\",\n        \"until_datetime\": \"2017-03-06 10:00:00\",\n        \"tz\": \"America/Los_Angeles\",\n        \"bucket\": \"MIN\",\n        \"device_id\": [\n          \"6463194850930042705\"\n        ]\n      },\n      \"event_rule_name\": \"Flume Smart Leak Rule\"\n    },\n    {\n      \"id\": 5,\n      \"device_id\": \"6234820280525070850\",\n      \"triggered_datetime\": \"2017-03-06T10:00:00.000Z\",\n      \"flume_leak\": false,\n      \"query\": {\n        \"request_id\": \"TRIGGERED_USAGE_ALERT\",\n        \"since_datetime\": \"2017-03-05 23:00:00\",\n        \"until_datetime\": \"2017-03-06 02:00:00\",\n        \"tz\": \"America/Los_Angeles\",\n        \"bucket\": \"MIN\",\n        \"device_id\": [\n          \"6463194850930042705\"\n        ]\n      },\n      \"event_rule_name\": \"Custom Rule\"\n    }\n  ],\n  \"count\": 2,\n  \"pagination\": null\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true,
                      "default": true
                    },
                    "code": {
                      "type": "integer",
                      "example": 0,
                      "default": 0
                    },
                    "message": {
                      "type": "string",
                      "example": "Request OK"
                    },
                    "http_code": {
                      "type": "integer",
                      "example": 200,
                      "default": 0
                    },
                    "http_message": {
                      "type": "string",
                      "example": "OK"
                    },
                    "detailed": {},
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "example": 4,
                            "default": 0
                          },
                          "device_id": {
                            "type": "string",
                            "example": "6234820280525070850"
                          },
                          "triggered_datetime": {
                            "type": "string",
                            "example": "2017-03-06T10:00:00.000Z"
                          },
                          "flume_leak": {
                            "type": "boolean",
                            "example": true,
                            "default": true
                          },
                          "query": {
                            "type": "object",
                            "properties": {
                              "request_id": {
                                "type": "string",
                                "example": "TRIGGERED_USAGE_ALERT"
                              },
                              "since_datetime": {
                                "type": "string",
                                "example": "2017-03-05 23:00:00"
                              },
                              "until_datetime": {
                                "type": "string",
                                "example": "2017-03-06 10:00:00"
                              },
                              "tz": {
                                "type": "string",
                                "example": "America/Los_Angeles"
                              },
                              "bucket": {
                                "type": "string",
                                "example": "MIN"
                              },
                              "device_id": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "example": "6463194850930042705"
                                }
                              }
                            }
                          },
                          "event_rule_name": {
                            "type": "string",
                            "example": "Flume Smart Leak Rule"
                          }
                        }
                      }
                    },
                    "count": {
                      "type": "integer",
                      "example": 2,
                      "default": 0
                    },
                    "pagination": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"success\": false,\n  \"code\": 94,\n  \"message\": \"A provided parameter failed validation\",\n  \"http_code\": 400,\n  \"http_message\": \"Bad Request\",\n  \"detailed\": [\n    \"Provide a positive limit\",\n    \"Provide a positive offset\",\n    \"Sort field [sort_field] is not a valid field\",\n    \"Sort direction is not a valid direction {ASC/DESC}\",\n    \"device with id [device_id] is not found\",\n    \"notification type [notification_type] is not valid\"\n  ],\n  \"data\": [],\n  \"count\": 0,\n  \"pagination\": null\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false,
                      "default": true
                    },
                    "code": {
                      "type": "integer",
                      "example": 94,
                      "default": 0
                    },
                    "message": {
                      "type": "string",
                      "example": "A provided parameter failed validation"
                    },
                    "http_code": {
                      "type": "integer",
                      "example": 400,
                      "default": 0
                    },
                    "http_message": {
                      "type": "string",
                      "example": "Bad Request"
                    },
                    "detailed": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "example": "Provide a positive limit"
                      }
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {}
                      }
                    },
                    "count": {
                      "type": "integer",
                      "example": 0,
                      "default": 0
                    },
                    "pagination": {}
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "58b70615b72a430f007f9f99:5eebf59a32d2f700366c3ffa"
}
```