---
title: Add a Policy to a Device
slug: jetstream-v2/add-a-policy-to-a-device
docTags: 
createdAt: 2024-01-23T15:41:09.320Z
---

## About

Add a specified policy to the specified device in your Jetstream application. This triggers monitoring of the device's configuration values for any discrepancies from the policy – Jetstream will automatically schedule a [Get a Device's Configuration Parameters](docId:_94Vzb6djZTjxFYzb78UJ) request and compare the results with the policy and overridden device parameters. If Jetstream determines that there is a variance, then a [LogEntryEvent](docId:29y5YUYiF83JhS1F2y-R0) (PolicyError) will be published.

## Parameters

| **Property**                                         | **Location** | **Details**                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ---------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **AccessKey**<br />string<br />Required<br />Unique  | Header       | The access key for your user account.<br />This value is a 36-character GUID provided during [user account sign up](https://jetstreamrfid.com/login/signup).                                                                                                                                                                                                                                                                                            |
| **DeviceName**<br />string<br />Required<br />Unique | URL          | The name of the device.<br />This value has a max length of 128 ASCII characters.<br />This value must adhere to this regular expression: ^\[a-zA-Z0-9-\_]\*$<br />The device must not already have a policy added to it.                                                                                                                                                                                                                               |
| **Name**<br />string<br />Required<br />Unique       | Body         | The name of the policy.<br />This value is one of the policies retrieved by the [Get All Policies](docId\:TRcFPsEda-oO4VVkdn3DJ) request.<br />This value has a max length of 128 ASCII characters.<br />This value must adhere to this regular expression: ^\[a-zA-Z0-9-\_]\*$                                                                                                                                                                         |
| **Parameters**<br />dictionary(string,string)        | Body         | The parameters and values to override what’s currently set for them in the policy.<br />All parameters defined must be in the policy’s associated device definition.<br />All values defined must be of the type (e.g., int, bool, string, float, datetime) defined in the policy’s associated device definition.<br />If a device's parameters do not match the policy, a [LogEntryEvent](docId:29y5YUYiF83JhS1F2y-R0) (PolicyException) is published. |
| **LastPolicyUpdate**<br />string                     | Body         | The date/time value indicating when a policy was last added to the specified device.<br />This value is generated by Jetstream – do not define it in requests.                                                                                                                                                                                                                                                                                          |
| **LastPolicySync**<br />string                       | Body         | The date/time value indicating when a policy was last [synced](docId\:lLqub1KfYHmEOmOHN_1Fc) to the specified device.<br />This value is generated by Jetstream – do not define it in requests.                                                                                                                                                                                                                                                         |

## Example

### Request URL

**POST** https\://api.jetstreamrfid.com/2/devices/&#x7B;DeviceName}/Policy

### Request Body

:::BlockQuote
\{
&#x9;"Name": "MyPolicyName",
&#x9;"Parameters": \{
&#x9;	"aggregateeventscancount": 3
&#x9;}
}
:::

### Response Code

201 Created

### Response Body

:::BlockQuote
\{
&#x9;"Name": " MyPolicyName",
&#x9;"Parameters": \{
&#x9;	"aggregateeventscancount": "3"
&#x9;},
&#x9;"LastPolicyUpdate": "2017-05-18T18:56:27Z",
&#x9;"LastPolicySync": ""
}
:::

## Version Changes

Replaces AddDeviceToPolicy
