Skip to content

Access Policy

The APIs here are designed for managing door access policies. These policies can be bound with access schedules, floors, and other door access resources.

Access Policy Schemas

ParameterTypeDescription
IdIdentity ID of the access policy.
nameStringName of the access policy.
resourcesArray[Object]Specify the locations that can be accessed.
resources[].typeStringInclude door and door_group resources. enum_type {door, door_group}
resources[].idStringWhen resource type is door_group, it refers to the group ID of a building or a customized door group. When type is door, it refers to the ID of a door.
schedule_idStringIdentity ID of the schedule.

Create Access Policy

This API allows you to create an access policy.

Request URL: /api/v1/developer/access_policies
Permission Key: edit:policy
Method: POST

Request Header

ParameterRequiredTypeDescription
AuthorizationTStringToken required for authentication and access control.

Request Body

ParameterRequiredTypeDescriptionHow to Get It?Example
nameTStringName of the access policy.
resourceFArray[Object]Used to assign accessible locations to the access policy.Get it from the API /api/v1/developer/door_groups/topology; /api/v1/developer/door_groups
resources[].typeFStringenum type {door, door_group}
resources[].idFStringWhen resource type is 'door_group', it refers to the group ID of a building or a customized door group. When type is 'door', it refers to the ID of a door.
schedule_idTStringIdentity ID of the schedule. Assign additional schedules.Get it from the API /api/v1/developer/access_policies/schedules

Response Body

ParameterRequiredTypeDescriptionRelated APIPurpose
idTStringIdentity ID of the policy./api/v1/developer/users/:user_id/access_policiesUsed to both assign an access policy to a user or unassign a policy from them.

See Response Schema for full field definitions.

Request Sample: Shell/cURL

The request body should be a JSON object containing the following fields:

bash
curl '{host}/api/v1/developer/access_policies' \
-H 'Authorization: Bearer wHFmHR*****kD6wHg' \
-H 'accept: application/json' \
-H 'content-type: application/json' \
--data-raw '{
    "name": "test",
    "resources": [
        {
            "id": "6ff875d2-af87-470b-9cb5-774c6596afc8",
            "type": "door"
        },
        {
            "id": "5c496423-6d25-4e4f-8cdf-95ad5135188a",
            "type": "door_group"
        },
        {
            "id": "d5573467-d6b3-4e8f-8e48-8a322b91664a",
            "type": "door_group"
        }
    ],
    "schedule_id": "4e108aab-ec9a-4822-bf86-170ea986f934"
}' \
--insecure

Response Sample

json
{
  "code": "SUCCESS",
  "data": {
    "id": "bb5eb965-42dc-4206-9654-88a2d1c3aaa5",
    "name": "test13",
    "resources": [
      {
        "id": "6ff875d2-af87-470b-9cb5-774c6596afc8",
        "type": "door"
      },
      {
        "id": "5c496423-6d25-4e4f-8cdf-95ad5135188a",
        "type": "door_group"
      },
      {
        "id": "d5573467-d6b3-4e8f-8e48-8a322b91664a",
        "type": "door_group"
      }
    ],
    "schedule_id": "4e108aab-ec9a-4822-bf86-170ea986f934"
  },
  "msg": "success"
}

Update Access Policy

This API allows you to update a policy.

Request URL: /api/v1/developer/access_policies/:id
Permission Key: edit:policy
Method: PUT

Request Header

ParameterRequiredTypeDescription
AuthorizationTStringToken required for authentication and access control.

Request Path

ParameterRequiredTypeDescriptionExample
IdTStringIdentity ID of the access policy.

Request Body

ParameterRequiredTypeDescriptionHow to Get It?
nameFStringName of the access policy. Omit this parameter if it doesn't need to be updated.
resourceFArray[Object]Used to assign accessible locations to the access policy. Omit this parameter if it doesn't need to be updated.Get it from the API /api/v1/developer/door_groups/topology; /api/v1/developer/door_groups
resources[].typeFStringenum type {door, door_group}
resources[].idFStringWhen resource type is door_group, it refers to the group ID of a building or a customized door group. When type is door, it refers to the ID of a door.
schedule_idFStringIdentity ID of the schedule. Assign additional schedules. Omit this parameter if it doesn't need to be updated.Get it from the API /api/v1/developer/access_policies/schedules

Request Sample: Shell/cURL

The request body should be a JSON object containing the following fields:

bash
curl '{host}/api/v1/developer/access_policies/242c88e3-0524-42de-8447-45891c5df714'  
-H 'Authorization: Bearer wHFmHR******kD6wHg'  
-H 'accept: application/json'  
-H 'content-type: application/json' --data-raw  
{'  
    "name": "test",  
    "resource": [  
        {"id": "6ff875d2-af87-470b-9cb5-774c6596afc8",  
        "type": "door"  
    ],  
        {"id": "5c496423-6d25-4e4f-8cdf-95ad5135188a",  
        "type": "door_group"  
    },  
        {"id": "d5573467-d6b3-4e8f-8e48-8a322b91664a",  
        "type": "door_group"  
    },  
    "schedule_id": "4e108aab-ec9a-4822-bf86-170ea986f934"  
}  
--insecure

Response Body

ParameterRequiredTypeDescriptionRelated apiPurpose
idTStringIdentity ID of the policy./api/v1/developer/users/:user_id/access_policiesUsed to both assign an access policy to a user or unassign a policy from them.

See Response Schema for full field definitions.

Delete Access Policy

This API allows you to delete an access policy.

Request URL: /api/v1/developer/access_policies/:id
Permission Key: edit:policy
Method: DELETE

Request Header

ParameterRequiredTypeDescription
AuthorizationTStringToken required for authentication and access control.

Request Body

ParameterRequiredTypeDescription
IdTStringIdentity ID of the access policy.

Request Sample: Shell/cURL

The request body should be a JSON object containing the following fields:

bash
curl -XDELETE '{host}'/api/v1/developer/access_policies/460d0bcc-5d4f-4e7b-8a3c-8d4502765e11'  
-H 'Authorization: Bearer wHFmHR*****kD6wHg'  
--insecure

Response Sample

json
{
  "code": "SUCCESS",
  "msg": "success",
  "data": "success"
}

Fetch Access Policy

This API allows you to fetch a policy details.

Request URL: /api/v1/developer/access_policies/:id
Permission Key: view:policy
Method: GET

Request Header

ParameterRequiredTypeDescription
AuthorizationTStringToken required for authentication and access control.

Request Body

ParameterRequiredTypeDescription
IdTStringIdentity ID of the access policy.

Response Body

ParameterRequiredTypeDescriptionExample
DataTObject

See Response Schema for full field definitions.

Request Sample: Shell/cURL

The request body should be a JSON object containing the following fields:

bash
curl '{host}/api/v1/developer/ccess_policy'  
-H 'Authorization: Bearer wHFmHR*****kD6wHg'  
-H 'accept: application/json'  
-H 'content-type: application/json'  
--insecure

Response Sample

json
{
  "code": "SUCCESS",
  "data": {
    "id": "ed09985f-cf52-486e-bc33-377b6ed7bbf2",
    "name": "test11",
    "resources": [
      {
        "id": "6ff875d2-af87-470b-9cb5-774c6596afc8",
        "type": "door"
      },
      {
        "id": "5c496423-6d25-4e4f-8cdf-95ad5135188a",
        "type": "door_group"
      },
      {
        "id": "d5573467-d6b3-4e8f-8e48-8a322b91664a",
        "type": "door_group"
      }
    ],
    "schedule_id": "4e108aab-ec9a-4822-bf86-170ea986f934"
  },
  "msg": "success"
}

Fetch All Access Policies

This API allows you to fetch all access policies.

Request URL: /api/v1/developer/access_policies
Permission Key: view:policy
Method: GET

Request Header

ParameterRequiredTypeDescription
AuthorizationTStringToken required for authentication and access control.

Response Body

ParameterRequiredTypeDescriptionExample
DataTArray[Object]

See Response Schema for full field definitions.

Request Sample: Shell/cURL

The request body should be a JSON object containing the following fields:

bash
curl '{host}/api/v1/developer/access_policies'  
-H 'Authorization: Bearer wHFmHR*****kD6wHg'  
-H 'accept: application/json'  
-H 'content-type: application/json'  
--insecure

Response Sample

json
{
  "code": "SUCCESS",
  "data": [
    {
      "id": "73f15cab-c725-4a76-a419-a4026d131e96",
      "name": "Default Admin Policy",
      "resources": [
        {
          "id": "d5573467-d6b3-4e8f-8e48-8a322b91664a",
          "type": "door_group"
        },
        {
          "id": "5c496423-6d25-4e4f-8cdf-95ad5135188a",
          "type": "door_group"
        }
      ],
      "schedule_id": "73facd6c-839e-4521-a4f4-c07e1d44e748"
    },
    {
      "id": "b96948a4-fed9-40a3-9c4a-e473822a3db7",
      "name": "Default UNVR Policy",
      "resources": [
        {
          "id": "d5573467-d6b3-4e8f-8e48-8a322b91664a",
          "type": "door_group"
        },
        {
          "id": "6ff875d2-af87-470b-9cb5-774c6596afc8",
          "type": "door"
        }
      ],
      "schedule_id": "58c0f89b-f35c-4d2c-af7b-8b8918df2c31"
    },
    {
      "id": "edbc80df-3698-49fd-8b53-f1867f104947",
      "name": "TEST",
      "resources": [
        {
          "id": "d5573467-d6b3-4e8f-8e48-8a322b91664a",
          "type": "door_group"
        },
        {
          "id": "5c496423-6d25-4e4f-8cdf-95ad5135188a",
          "type": "door_group"
        },
        {
          "id": "6ff875d2-af87-470b-9cb5-774c6596afc8",
          "type": "door"
        }
      ],
      "schedule_id": "73facd6c-839e-4521-a4f4-c07e1d44e748"
    }
  ],
  "msg": "success"
}

Holiday Group Schemas

A holiday group refers to a collection of holidays.

ParameterTypeDescription
idStringIdentity ID of the holiday group.
nameStringName of the holiday group.
is_defaultBooleanIndicate whether the holiday group is the system default.
descriptionStringDescription of the holiday group.
holidaysArray[Object]Show a list of the holidays within the holiday group.
holidays[].descriptionStringDescription of the holiday.
holidays[].idStringIdentity ID of the holiday.
holidays[].nameStringName of the holiday.
holidays[].repeatBooleanIndicate whether the holiday repeats annually.
holidays[].start_timeStringStart time of the holiday, provided in UTC format according to RFC3339.
holidays[].end_timeStringEnd time of the holiday, provided in UTC format according to RFC3339.

Create Holiday Group

This API allows you to create a holiday group.

Request URL: /api/v1/developer/access_policies/holiday_groups
Permission Key: edit:policy
Method: POST

Request Header

ParameterRequiredTypeDescription
AuthorizationTStringToken required for authentication and access control.

Request Body

ParameterRequiredTypeDescriptionExample
nameTStringName of the holiday group.
descriptionFStringDescription of the holiday group.
holidaysFArray[Object]Show a list of the holidays within the holiday group.
holidays[].descriptionFStringDescription of the holiday.
holidays[].nameFStringName of the holiday.
holidays[].repeatFBooleanIndicate whether the holiday repeats annually.
holidays[].is_templateFBooleanIndicate whether the holiday is created using a holiday group template.
holidays[].start_timeFStringStart time of the holiday, provided in UTC format according to RFC3339.2023-08-25T00:00:00Z
holidays[].end_timeFStringEnd time of the holiday, provided in UTC format according to RFC3339.2023-08-26T00:00:00Z

Response Body

ParameterRequiredTypeDescriptionRelated APIPurpose
idTStringIdentity ID of the holiday group./api/v1/developer/access_policies/schedulesUsed to add a holiday group to the schedule.

See Response Schema for full field definitions.

Request Sample: Shell/cURL

The request body should be a JSON object containing the following fields:

bash
curl '{host}/api/v1/developer/access_policies/holiday_groups'  
-H 'Authorization: Bearer wHFmHR*****kD6wHg'  
-H 'accept: application/json'
bash
-H 'content-type: application/json' --data-raw
{' "name": "Holiday Group-169286791557142", "holidays": [ "name": "Holiday Name 1", "description": "", "repeat": false, "start_time": "2023-08-25T00:00:00z", "end_time": "2023-08-26T00:00:00z"
}, "name": "Holiday Name 2", "description": "", "repeat": false, "start_time": "2023-08-26T00:00:00z", "end_time": "2023-08-27T00:00:00z"
} ]
}

Response Sample

json
{
  "code": "SUCCESS",
  "data": {
    "description": "",
    "holidays": [
      {
        "description": "",
        "end_time": "2023-08-26 00:00:00z",
        "id": "8900533d-03be-4f84-832d-54ff59905759",
        "name": "Holiday Name 1",
        "repeat": false,
        "start_time": "2023-08-25 00:00:00z"
      },
      {
        "description": "",
        "end_time": "2023-08-27 00:00:00z",
        "id": "9fff81cc-d476-40c4-80f9-d510451ce2cd",
        "name": "Holiday Name 2",
        "repeat": false,
        "start_time": "2023-08-26 00:00:00z"
      }
    ],
    "id": "7be7a7a0-818f-4f76-98c3-1c38957f4dca",
    "is_default": false,
    "name": "Holiday Group-169286791557142",
    "template_name": ""
  },
  "msg": "success"
}

Update Holiday Group

This API allows you to update a holiday group.

Request URL: /api/v1/developer/access_policies/holiday_groups/:id
Permission Key: edit:policy
Method: PUT

Request Header

ParameterRequiredTypeDescription
AuthorizationTStringToken required for authentication and access control.

Request Path

ParameterRequiredTypeDescriptionExample
IdTStringIdentity ID of the holiday group.

Request Body

ParameterRequiredTypeDescriptionExample
nameTStringName of the holiday group.
descriptionFStringDescription of the holiday group.
holidaysFArray[Object]Show a list of the holidays within the holiday group. Omit this parameter if it doesn't need to be updated.
holidays[].idFStringIdentity ID of the holiday. Omit this parameter if it doesn't need to be updated.Get it from the API /api/v1/developer/access_policies/holiday_groups
holidays[].descriptionFStringDescription of the holiday.
holidays[].nameFStringName of the holiday.
holidays[].repeatFBooleanIndicate whether the holiday repeats annually.
holidays[].start_timeFStringStart time of the holiday, provided in UTC format according to RFC3339.2023-08-25T00:00:00Z
holidays[].end_timeFStringEnd time of the holiday, provided in UTC format according to RFC3339.2023-08-26T00:00:00Z

Response Body

ParameterRequiredTypeDescriptionRelated APIPurpose
idTStringIdentity ID of the holiday group./ api/v1/developer/access_policies/schedulesUsed to add a holiday group to the schedule.

See Response Schema for full field definitions.

Request Sample: Shell/cURL

The request body should be a JSON object containing the following fields:

bash
curl -XPUT '{host}/api/v1/developer/access_policies/holiday_groups/7be7a7a0-818f-4f76-98c3-1c38957f4dca'
-H 'Authorization: Bearer wHFmHR****************kD6wHg'
-H 'accept: application/json'
-H 'content-type: application/json' --data-raw
{
    "name": "Holiday Group-169286791557142",
    "holidays": [
        {
        "name": "Holiday Name 1",
        "description": "", "repeat": false,
        "start_time": "2023-08-25T00:00:00z",
        "end_time": "2023-08-26T00:00:00z"
    ],
    # add a new holiday
    {
        "id": "d23a4226-765f-4967-b84f-6dfd53f33c89", # update an existing holiday
        "name": "Holiday Name 2",
        "description": "", "repeat": false,
        "start_time": "2023-08-26T00:00:00z",
        "end_time": "2023-08-27T00:00:00z"
    }
}

Response Sample

json
{
  "code": "SUCCESS",
  "data": {
    "description": "",
    "holidays": [
      {
        "description": "",
        "end_time": "2023-08-26 00:00:00z",
        "id": "8900533d-03be-4f84-832d-54ff59905759",
        "name": "Holiday Name 1",
        "repeat": false,
        "start_time": "2023-08-25 00:00:00z"
      },
      {
        "description": "",
        "end_time": "2023-08-27 00:00:00z",
        "id": "9fff81cc-d476-40c4-80f9-d510451ce2cd",
        "name": "Holiday Name 2",
        "repeat": false,
        "start_time": "2023-08-26 00:00:00z"
      }
    ],
    "id": "7be7a7a0-818f-4f76-98c3-1c38957f4dca",
    "is_default": false,
    "name": "Holiday Group-169286791557142",
    "template_name": ""
  },
  "msg": "success"
}

Delete Holiday Group

This API allows you to delete a holiday group.

Request URL: /api/v1/developer/access_policies/holiday_groups/:id
Permission Key: edit:policy
Method: DELETE

Request Header

ParameterRequiredTypeDescription
AuthorizationTStringToken required for authentication and access control.

Request Path

ParameterRequiredTypeDescriptionRelated API
idTStringIdentity ID of the holiday group./api/v1/developer/access_policies/holiday_groups

Request Sample: Shell/cURL

The request body should be a JSON object containing the following fields:

bash
curl -XDELETE '{host}/api/v1/developer/access_policies/holiday_groups/7be7a7a0-818f-4f76-98c3-1c38957f4dca'  
-H 'Authorization: Bearer wHFmHR*****kD6wHg'  
-H 'accept: application/json'  
-H 'content-type: application/json'  
--insecure

Response Sample

json
{
  "code": "SUCCESS",
  "data": "success",
  "msg": "success"
}

Fetch Holiday Group

This API allows you to fetch a holiday group.

Request URL: /api/v1/developer/access_policies/holiday_groups/:id
Permission Key: view:policy
Method: GET

Request Header

ParameterRequiredTypeDescription
AuthorizationTStringToken required for authentication and access control.

Request Body

ParameterRequiredTypeDescription
IdTStringIdentity ID of the holiday group.

Response Body

ParameterRequiredTypeDescriptionRelated APIPurpose
idTStringIdentity ID of the holiday group./ api/v1/developer/access_policies/schedulesUsed to add a holiday group to the schedule.

See Response Schema for full field definitions.

Request Sample: Shell/cURL

The request body should be a JSON object containing the following fields:

bash
curl -XGET '{host}/api/v1/developer/access_policies/holiday_groups/7be7a7a0-818f-4f76-98c3-1c38957f4dca'  
-H 'Authorization: Bearer wHFmHR*****KD6wHg'  
-H 'accept: application/json'  
-H 'content-type: application/json'  
--insecure

Response Sample

json
{
  "code": "SUCCESS",
  "data": {
    "description": "",
    "holidays": [
      {
        "description": "",
        "end_time": "2023-08-26 00:00:00z",
        "id": "8900533d-03be-4f84-832d-54ff59905759",
        "name": "Holiday Name 1",
        "repeat": false,
        "start_time": "2023-08-25 00:00:00z"
      },
      {
        "description": "",
        "end_time": "2023-08-27 00:00:00z",
        "id": "9fff81cc-d476-40c4-80f9-d510451ce2cd",
        "name": "Holiday Name 2",
        "repeat": false,
        "start_time": "2023-08-26 00:00:00z"
      }
    ],
    "id": "7be7a7a0-818f-4f76-98c3-1c38957f4dca",
    "is_default": false,
    "name": "Holiday Group-169286791557142",
    "template_name": ""
  },
  "msg": "success"
}

Fetch All Holiday Groups

This API allows you to fetch the list of all holiday groups.

Request URL: /api/v1/developer/access_policies/holiday_groups
Permission Key: view:policy

Request Header

ParameterRequiredTypeDescription
AuthorizationTStringToken required for authentication and access control.

Request Body

ParameterRequiredTypeDescription
IdTStringIdentity ID of the holiday group.

Response Body

ParameterRequiredTypeDescriptionRelated APIPurpose
idTStringIdentity ID of the holiday group./api/v1/developer/access_policies/schedulesUsed to add a holiday group to the schedule.
nameTStringName of the holiday group.
descriptionTStringDescription of the holiday group.
countTIntegerTotal number of holidays.

Request Sample: Shell/cURL

The request body should be a JSON object containing the following fields:

bash
curl -XGET '{host}/api/v1/developer/access_policies/holiday_groups'  
-H 'Authorization: Bearer wHFmHR*****kD6wHg'  
-H 'accept: application/json'  
-H 'content-type: application/json'  
--insecure

Response Sample

json
{
  "code": "SUCCESS",
  "data": [
    {
      "count": 0,
      "description": "",
      "id": "8cc22b49-a7f4-49a6-9f04-044444992d6c",
      "is_default": true,
      "name": "No Holidays"
    },
    {
      "count": 2,
      "description": "",
      "id": "86c634da-7b2c-411c-a2c1-1495d089c719",
      "is_default": false,
      "name": "Holiday Group-1692867312225"
    }
  ],
  "msg": "success"
}

Schedule Schemas

These schemas are utilized for creating time periods for daily visits from Sunday through Saturday. The primary purpose of these schemas is to facilitate the assignment of access policies to users.

ParameterTypeDescription
idStringIdentity ID of the schedule.
nameStringName of the schedule.
is_defaultBooleanIndicate whether the schedule is the system default.
typeStringContains the access type, which is assigned to a user along with an access policy.
weeklyObjectThe customizable scheduling strategy for each day from Sunday to Saturday. If not specified, it means access is allowed every day.
weekly mondayArray[Object]Specify the daily access time period from Sunday to Saturday.
weekly monday[].start_timeStringStart time of the access time period.
weekly monday[].end_timeStringEnd time of the access time period.
holiday_scheduleArray[Object]Specify the accessible period during holidays. UniFi Access Requirement: 1.20.11 or later
holiday_schedule[0].start_timeStringStart time of the access time period.
holiday_schedule[0].end_timeStringEnd time of the access time period.
holiday_group_idStringIdentity ID of the holiday group.
holiday_group.idStringIdentity ID of the holiday group.
holiday_group.nameStringName of the holiday group.
holiday_group.is_defaultBooleanIndicate whether the holiday group is the system default.
holiday_group.descriptionStringDescription of the holiday group.
holiday_group.holidaysArray[Object]Show a list of the holidays within the holiday group.
holiday_group.holidays[].descriptionStringDescription of the holiday.
holiday_group.holidays[].idStringIdentity ID of the holiday.
holiday_group.holidays[].nameStringName of the holiday.
holiday_group.holidays[].repeatBooleanIndicate whether the holiday repeats annually.
holiday_group.holidays[].start_timeStringStart time of the holiday, provided in UTC format according to RFC3339.
holiday_group.holidays[].end_timeStringEnd time of the holiday, provided in UTC format according to RFC3339.

Create Schedule

This API allows you to create a door access schedule.

Request URL: /api/v1/developer/access_policies/schedules
Permission Key: edit:policy
Method: POST

Request Header

ParameterRequiredTypeDescription
AuthorizationTStringToken required for authentication and access control.

Request Body

ParameterRequiredTypeDescriptionExample
nameTStringThe name of the schedule. This needs to be globally unique.schedule-1789067565323
week_scheduleTObjectThe customizable scheduling strategy for each day from Sunday to Saturday. If not specified, it means access is allowed every day.
week_schedule mondayTArray[Object]Specify the daily access time period from Sunday to Saturday.
week_schedule monday[0].start_timeTStringStart time of the access time period.00:00:00
week_schedule monday[0].end_timeTStringEnd time of the access time period.23:59:59
holiday_group_idFStringIdentity ID of the holiday group. The default is No holidays system group.75660081-431b-4dbe-9b98-e0257877118e
holiday_scheduleFArray[Object]Specify the accessible period during holidays.
holiday_schedule[].start_timeFStringStart time of the access time period.03:15:00
holiday_schedule[].end_timeFStringEnd time of the access time period.11:45:59

Response Body

ParameterRequiredTypeDescriptionRelated APIPurpose
idTStringIdentity ID of the schedule./api/v1/developer/access_policiesUsed to add a schedule to the access policy.

See Response Schema for full field definitions.

Request Sample: Shell/cURL

The request body should be a JSON object containing the following fields:

bash
curl '{host}/api/v1/developer/access_policies/schedules' \
-H 'Authorization: Bearer wHFmHR*****kD6wHg' \
-H 'accept: application/json' \
-H 'content-type: application/json' \
--data-raw '{
    "name": "schedule-1688977094169",
    "week_schedule": {
        "sunday": [],
        "monday": [
            { "start_time": "10:00:00", "end_time": "17:00:59" }
        ],
        "tuesday": [
            { "start_time": "10:00:00", "end_time": "17:00:59" }
        ],
        "wednesday": [
            { "start_time": "10:00:00", "end_time": "17:00:59" }
        ],
        "thursday": [],
        "friday": [
            { "start_time": "10:00:00", "end_time": "17:00:59" }
        ],
        "saturday": []
    },
    "holiday_group_id": "75660081-431b-4dbe-9b98-e0257877118e",
    "holiday_schedule": [
        { "start_time": "03:15:00", "end_time": "11:45:59" },
        { "start_time": "15:00:00", "end_time": "19:00:59" }
    ]
}' \
--insecure

Response Sample

json
{
  "code": "SUCCESS",
  "data": {
    "id": "1d31b648-b8ff-4bd1-b742-60dbd70592cd",
    "is_default": false,
    "name": "schedule-1688977094169",
    "type": "access",
    "weekly": {
      "friday": [
        { "start_time": "10:00:00", "end_time": "17:00:59" }
      ],
      "monday": [
        { "start_time": "10:00:00", "end_time": "17:00:59" }
      ],
      "saturday": [],
      "sunday": [],
      "thursday": [],
      "tuesday": [
        { "start_time": "10:00:00", "end_time": "17:00:59" }
      ],
      "wednesday": [
        { "start_time": "10:00:00", "end_time": "17:00:59" }
      ]
    },
    "holiday_group_id": "75660081-431b-4dbe-9b98-e0257877118e",
    "holiday_group": {
      "description": "",
      "holidays": [
        {
          "description": "",
          "end_time": "2023-08-26 00:00:00z",
          "id": "d51777c4-9559-45aa-8e23-434995d9d2a1",
          "is_template": false,
          "name": "Holiday Name 1",
          "repeat": false,
          "start_time": "2023-08-25 00:00:00z"
        },
        {
          "description": "",
          "end_time": "2023-08-27 00:00:00z",
          "id": "d23a4226-765f-4967-b84f-6dfd53f33c89",
          "is_template": false,
          "name": "Holiday Name 2",
          "repeat": false,
          "start_time": "2023-08-26 00:00:00z"
        }
      ],
      "id": "75660081-431b-4dbe-9b98-e0257877118e",
      "is_default": false,
      "name": "Holiday Group-1692867915571423",
      "template_name": ""
    },
    "holiday_schedule": [
      { "start_time": "03:15:00", "end_time": "11:45:59" },
      { "start_time": "15:00:00", "end_time": "19:00:59" }
    ]
  },
  "msg": "success"
}

Update Schedule

This API allows you to update a door access schedule.

Request URL: /api/v1/developer/access_policies/schedules/:id
Permission Key: edit:policy
Method: PUT

Request Header

ParameterRequiredTypeDescription
AuthorizationTStringToken required for authentication and access control.

Request Path

ParameterRequiredTypeDescriptionExample
IdTStringIdentity ID of the schedule.

Request Body

ParameterRequiredTypeDescriptionExample
nameFStringThe name of the schedule. This needs to be globally unique. Omit this parameter if it doesn't need to be updated.schedule-1789067565323
week_scheduleFObjectThe customizable scheduling strategy for each day from Sunday to Saturday. If not specified, it means access is allowed every day. Omit this parameter if it doesn't need to be updated.
week_schedule.mondayFArray[Object]Specify the daily access time period from Sunday to Saturday.
week_schedule.monday[0].start_timeFStringStart time of the access time period.00:00:00
week_schedule.monday[0].end_timeFStringEnd time of the access time period.23:59:59
holiday_group_idFStringIdentity ID of the holiday group. The default is No holidays system group.75660081-431b-4dbe-9b98-e0257877118e
holiday_scheduleFArray[Object]Specify the accessible period during holidays.
holiday_schedule[].start_timeFStringStart time of the access time period.03:15:00
holiday_schedule[].end_timeFStringEnd time of the access time period.11:45:59

Response Body

ParameterRequiredTypeDescriptionRelated APIPurpose
idTStringIdentity ID of the schedule./api/v1/developer/access_policiesUsed to add a schedule to the access policy.

See Response Schema for full field definitions.

Request Sample: Shell/cURL

The request body should be a JSON object containing the following fields:

bash
curl -XPUT '{host}/api/v1/developer/access_policies/schedules/1d31b648-b8ff-4bd1-b742-60dbd70592cd'  
-H 'Authorization: Bearer wHFmHR*****kD6wHg'  
-H 'accept: application/json'  
-H 'content-type: application/json' --data-raw  
{'  
    "name": "schedule-1688977094169",  
    "holiday_group_id": "75660081-431b-4dbe-9b98-e0257877118e",  
    "week_schedule": {  
        "sunday": [],  
        "monday": [  
            {
            "start_time": "10:00:00",  
            },
            "end_time": "17:00:59"  
        ]  
    ],  
    "tuesday": [  
            { "start_time": "10:00:00", "end_time": "17:00:59" }
        ],
        "wednesday": [
            { "start_time": "10:00:00", "end_time": "17:00:59" }
        ],
        "thursday": [
            { "start_time": "10:00:00", "end_time": "17:00:59" }
        ],
        "friday": [
            { "start_time": "10:00:00", "end_time": "17:00:59" }
        ],
        "saturday": []
    },
    "holiday_schedule": [
        { "start_time": "03:15:00", "end_time": "11:45:59" }
    ]
}' \
--insecure

Response Sample

json
{
  "code": "SUCCESS",
  "data": {},
  "msg": "success"
}

Fetch Schedule

This API allows you to fetch a door access schedule.

Request URL: /api/v1/developer/access_policies/schedules/:id
Permission Key: view:policy
Method: GET

Request Header

ParameterRequiredTypeDescription
AuthorizationTStringToken required for authentication and access control.

Request Path

ParameterRequiredTypeDescriptionExample
IdTStringIdentity ID of the schedule.

Response Body

ParameterRequiredTypeDescriptionExample
nameTStringName of the schedule.
week_scheduleTObjectThe customizable scheduling strategy for each day from Sunday to Saturday. If not specified, it means access is allowed every day.
holiday_groupFObjectShow the assigned holiday group.
holiday_scheduleFArray[Object]Show the accessible period during holidays.

See Response Schema for full field definitions.

Request Sample: Shell/cURL

The request body should be a JSON object containing the following fields:

bash
curl --location '{host}/api/v1/developer/access_policies/schedules/908079e7-e26b-4951-9073-d775446d3584' --header 'Authorization: Bearer wHFmHR*****kD6wHg'

Response Sample

json
{
  "code": "SUCCESS",
  "data": {
    "id": "1d31b648-b8ff-4bd1-b742-60dbd70592cd",
    "is_default": false,
    "name": "schedule-1688977094169",
    "type": "access",
    "weekly": {
      "friday": [
        {
          "end_time": "17:00:59",
          "start_time": "10:00:00"
        }
      ],
      "monday": [
        {
          "end_time": "17:00:59",
          "start_time": "10:00:00"
        }
      ],
      "saturday": [],
      "sunday": [],
      "thursday": [
        {
          "end_time": "17:01:59",
          "start_time": "10:00:00"
        }
      ],
      "tuesday": [
        {
          "end_time": "17:00:59",
          "start_time": "10:00:00"
        }
      ],
      "wednesday": [
        {
          "end_time": "17:00:59",
          "start_time": "10:00:00"
        }
      ]
    },
    "holiday_group_id": "75660081-431b-4dbe-9b98-e0257877118e",
    "holiday_group": {
      "description": "",
      "holidays": [
        {
          "description": "",
          "end_time": "2023-08-26 00:00:00z",
          "id": "d51777c4-9559-45aa-8e23-434995d9d2a1",
          "is_template": false,
          "name": "Holiday Name 1",
          "repeat": false,
          "start_time": "2023-08-25 00:00:00z"
        },
        {
          "description": "",
          "end_time": "2023-08-27 00:00:00z",
          "id": "d23a4226-765f-4967-b84f-6dfd53f33c89",
          "is_template": false,
          "name": "Holiday Name 2",
          "repeat": false,
          "start_time": "2023-08-26 00:00:00z"
        }
      ],
      "id": "75660081-431b-4dbe-9b98-e0257877118e",
      "is_default": false,
      "name": "Holiday Group-16928679155714",
      "template_name": ""
    },
    "holiday_schedule": [
      {
        "end_time": "11:45:59",
        "start_time": "09:15:00"
      }
    ]
  },
  "msg": "success"
}

Fetch All Schedules

This API allows you to fetch all door access schedules.

Request URL: /api/v1/developer/access_policies/schedules
Permission Key: view:policy
Method: GET

Request Header

ParameterRequiredTypeDescription
AuthorizationTStringToken required for authentication and access control.

Response Body

ParameterRequiredTypeDescriptionExample
DataTArray[Object]

See Response Schema for full field definitions.

Request Sample: Shell/cURL

The request body should be a JSON object containing the following fields:

bash
curl --location '{host}'/api/v1/developer/access_policies/schedules'  
-H 'Authorization: Bearer wHFmHR*****kD6wHg'  
--insecure

Response Sample

json
{
  "code": "SUCCEED",
  "data": [
    {
      "id": "73facd6c-839e-4521-a4f4-c07e1d44e748",
      "holiday_group_id": "75660081-431b-4dbe-9b98-e0257877118e",
      "is_default": true,
      "name": "Always Access",
      "status": 1,
      "type": "access"
    },
    {
      "id": "58c0f89b-f35c-4d2c-af7b-8b8918df2c31",
      "holiday_group_id": "75660081-431b-4dbe-9b98-e0257877118e",
      "is_default": false,
      "name": "UNVR Schedule",
      "status": 1,
      "type": "access"
    }
  ],
  "msg": "success"
}

Delete Schedule

This API allows you to delete a door access schedule.

Request URL: /api/v1/developer/access_policies/schedules/:id
Permission Key: edit:policy
Method: DELETE

Request Header

ParameterRequiredTypeDescription
AuthorizationTStringToken required for authentication and access control.

Request Path

ParameterRequiredTypeDescriptionExample
IdTStringIdentity ID of the schedule.

Request Sample: Shell/cURL

The request body should be a JSON object containing the following fields:

bash
curl -XDELETE '{host}/api/v1/developer/access_policies/schedules/f5355214-3a45-4e0b-9245-12df7075df37'  
-H 'Authorization: Bearer wHFmHR*****kD6wHg'  
-H 'accept: application/json'  
-H 'content-type: application/json'  
--insecure

Response Sample

json
{
  "code": "SUCCESS",
  "msg": "success",
  "data": "success"
}