---
updatedAt: 2026-05-27T10:18:53.000Z
agentTools:
  projectIndex: https://gethapn.readme.io/llms.txt
---

# Get device supported behaviors

Gets a list of the behaviors available to a device.

A behavior is composed of a name identifier and an optional list of parameters.
Each parameter contains:
- `name`: This is the unique name of the parameter, and should be used as the key for sending a specific parameter value.
- `type`: The data of the parameter, like `number`, `string`, `date`, etc. This indicates what data type is supported as the value of the parameter when sending a behavior.

Additionally, the parameter definition might include information about the range and other constraints for the supported values.

The example below, shows the definition of a behavior that adjusts the reporting frequency of a device:

```json
{
  "name": "REPORT_FREQ",
  "description": "Change Reporting Frequency",
  "parameters": [
    {
      "name": "frequency",
      "type": "number",
      "min": 5,
      "max": 60
    }
  ]
}
```


# OpenAPI definition

````json
{
  "openapi": "3.0.3",
  "info": {
    "description": "The Hapn API is an HTTP interface for managing devices, accounts, and cloud data.",
    "version": "1.0.0",
    "title": "Hapn API",
    "termsOfService": "https://gethapn.com/terms",
    "contact": {
      "name": "Dev",
      "email": "developer@gethapn.com",
      "url": "http://gethapn.com"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    }
  },
  "servers": [
    {
      "url": "https://api.iotgps.io/v1",
      "description": "Prod"
    },
    {
      "url": "https://api-dev.iotgps.io/v1",
      "description": "Dev"
    }
  ],
  "paths": {
    "/behaviors/{imei}": {
      "get": {
        "summary": "Get device supported behaviors",
        "tags": [
          "Behaviors"
        ],
        "parameters": [
          {
            "name": "imei",
            "in": "path",
            "required": true,
            "description": "IMEI of the device",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Behavior list result",
            "content": {
              "application/json": {
                "schema": {
                  "description": "",
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string",
                      "minLength": 1
                    },
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Behavior"
                      }
                    }
                  },
                  "required": [
                    "success",
                    "message"
                  ]
                },
                "examples": {
                  "example-1": {
                    "value": {
                      "success": true,
                      "message": "ok",
                      "result": [
                        {
                          "name": "REPORT_FREQ",
                          "description": "Change Reporting Frequency",
                          "parameters": [
                            {
                              "name": "frequency",
                              "type": "number",
                              "min": 5,
                              "max": 60
                            }
                          ]
                        },
                        {
                          "name": "PING",
                          "description": "Ping"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/DeviceNotFound"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "get-device-behaviors",
        "description": "Gets a list of the behaviors available to a device.\n\nA behavior is composed of a name identifier and an optional list of parameters.\nEach parameter contains:\n- `name`: This is the unique name of the parameter, and should be used as the key for sending a specific parameter value.\n- `type`: The data of the parameter, like `number`, `string`, `date`, etc. This indicates what data type is supported as the value of the parameter when sending a behavior.\n\nAdditionally, the parameter definition might include information about the range and other constraints for the supported values.\n\nThe example below, shows the definition of a behavior that adjusts the reporting frequency of a device:\n\n```json\n{\n  \"name\": \"REPORT_FREQ\",\n  \"description\": \"Change Reporting Frequency\",\n  \"parameters\": [\n    {\n      \"name\": \"frequency\",\n      \"type\": \"number\",\n      \"min\": 5,\n      \"max\": 60\n    }\n  ]\n}\n```\n"
      },
      "parameters": [
        {
          "schema": {
            "type": "string"
          },
          "name": "imei",
          "description": "IMEI of device",
          "in": "path",
          "required": true
        }
      ]
    }
  },
  "components": {
    "schemas": {
      "Behavior": {
        "description": "A GPS Tracking device behavior",
        "type": "object",
        "x-examples": {
          "example-1": {
            "name": "REPORT_FREQ",
            "description": "Change Reporting Frequency",
            "parameters": [
              {
                "name": "frequency",
                "type": "number",
                "min": 5,
                "max": 60
              }
            ]
          }
        },
        "title": "Behavior",
        "properties": {
          "description": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "parameters": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BehaviorParameter"
            }
          }
        },
        "required": [
          "name",
          "description"
        ]
      },
      "BehaviorParameter": {
        "description": "A device behavior parameter",
        "type": "object",
        "title": "Behavior Parameter",
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "min": {
            "type": "number"
          },
          "max": {
            "type": "number"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "success",
          "message"
        ],
        "x-examples": {
          "example-1": {
            "value": {
              "success": false,
              "message": "Unauthorized"
            }
          }
        }
      }
    },
    "responses": {
      "DeviceNotFound": {
        "description": "The specified resource was not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "example-1": {
                "value": {
                  "success": false,
                  "message": "Device Not Found"
                }
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "example-1": {
                "value": {
                  "success": false,
                  "message": "Unauthorized"
                }
              }
            }
          }
        }
      },
      "Error": {
        "description": "Server error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "example-1": {
                "value": {
                  "success": false,
                  "message": "Error"
                }
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "OAuth2": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://auth.usehapn.com/oauth2/token",
            "scopes": {}
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Behaviors",
      "description": "Device behaviors management"
    }
  ],
  "security": [
    {
      "OAuth2": []
    }
  ]
}
````