UniFi Identity
The APIs here are designed for the UniFi Identity app.
Send UniFi Identity Invitations
This API enables you to send invitations and invite users to join UniFi Identity.
| Request URL | /api/v1/developer/users/identity/invitations |
|---|---|
| Permission Key | edit:user |
| Method | POST |
| UniFi Access Requirement | 1.24.6 or later |
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Request Body
| Parameter | Required | Type | Description |
| Array[Object].user_id | T | String | Identity ID of the user. |
| Array[Object].email | F | String | Email of the user. If filled in, it will update the user's existing email address. |
Request Sample: Shell/cURL
bash
curl -XPOST '{host}/api/v1/developer/users/identity/invitations' \
-H 'Authorization: Bearer wHFmHR*****kD6wHg' \
-H 'accept: application/json' \
-H 'content-type: application/json' \
--data-raw '[
{
"user_id": "e0051e08-c4d5-43db-87c8-a9b19cb66513",
"email": "example@*.com"
}
]' \
--insecureResponse Body
Success:
json
{
"code": "SUCCESS",
"data": [],
"msg": "success"
}If there is a failure to send an email:
json
{
"code": "SUCCESS",
"data": [
{
"error_code": "",
"error_msg": "invalid email",
"user_email": "example@*.com",
"user_id": "e0051e08-c4d5-43db-87c8-a9b19cb66513"
}
],
"msg": "success"
}Fetch Available Resources
This API enables you to fetch the available UniFi Identity resources.
| Request URL | /api/v1/developer/users/identity/assignments |
|---|---|
| Permission Key | view:user |
| Method | GET |
| UniFi Access Requirement | 1.24.6 or later |
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Query Parameters
| Parameter | Required | Type | Description | Example |
| resource_type | F | String | Display the type of resources; show all when left blank. enum resource_type {evstation,vpn,wifi} | resource_type=evstation,wifi,vpn |
Response Body
| Parameter | Required | Type | Description |
| data. [resource_type] | T | String | Type of the resources. enum resource_type {evstation, vpn, wifi, camera} |
| id | T | String | Identity ID of the resources. |
| name | T | String | Name of the resources. |
| deleted | T | Boolean | Indicate whether the resource is disabled. |
Request Sample: Shell/cURL
bash
curl '{host}/api/v1/developer/users/identity/assignments?resource_type=evstation,wifi,vpn' \
-H 'Authorization: Bearer wHFmHR*****kD6wHg' \
-H 'accept: application/json' \
-H 'content-type: application/json' \
--insecureResponse Sample
json
{
"code": "SUCCESS",
"data": {
"evstation": [],
"vpn": [
{
"deleted": false,
"id": "65cff9a9c188cb71cfac8e9d",
"metadata": null,
"name": "UDM Pro",
"short_name": ""
}
],
"wifi": [
{
"deleted": false,
"id": "65cff9a8c188cb71cfac8e9a",
"metadata": null,
"name": "UniFi Identity",
"short_name": ""
}
]
},
"msg": "success"
}Assign Resources to Users
This API enables you to assign UniFi Identity resources to users.
| Request URL | /api/v1/developer/users/:id/identity/assignments |
|---|---|
| Permission Key | edit:user |
| Method | POST |
| UniFi Access Requirement | 1.24.6 or later |
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Request Path
| Parameter | Required | Type | Description | How to Get It? |
| id | T | String | Identity ID of the user. | Get it from the API /api/v1/developer/users |
Request Body
| Parameter | Required | Type | Description | How to Get It? |
| resource_type | T | String | enum resource_type {ev(station,vpn,wifi} | Get it from the API 10.2 |
| resource_ids | T | Array<String] | Identity ID of the resources. | Get it from the API 10.2 |
Request Sample: Shell/cURL
bash
curl -XPOST '{host}/api/v1/developer/users/b602879b-b857-400b-970b-336d4cb881ad/identity/assignments'
-H 'Authorization: Bearer wHFmHR*****kD6wHg'
-H 'accept: application/json'
-H 'content-type: application/json'
--data '{
"resource_type": "wifi",
"resource_ids": [
"65cff9a8c188cb71cfac8e9a"
]
}
--insecureResponse Sample
json
{
"code": "SUCCESS",
"data": null,
"msg": "success"
}Fetch Resources Assigned to Users
This API enables you to fetch the UniFi Identity resources assigned to users.
| Request URL | /api/v1/developer/users/:id/identity/assignments |
|---|---|
| Permission Key | view:user |
| Method | GET |
|---|---|
| UniFi Access Requirement | 1.24.6 or later |
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Request Path
| Parameter | Required | Type | Description | How to Get It? |
| id | T | String | Identity ID of the user. | Get it from the API /api/v1/developer/users |
Response Body
| Parameter | Required | Type | Description |
| data. [resource_type] | T | Array[Object] | Type of the resources. enum resource_type {evstation, vpn,wifi,camera} |
| id | T | String | Identity ID of the resources. |
| name | T | String | Name of the resources. |
| deleted | T | Boolean | Indicate whether a resource is disabled. |
Request Sample: Shell/cURL
bash
curl -XGET '{host}'/api/v1/developer/users/b602879b-b857-400b-970b-336d4cb881ad/identity/assignments'
-H 'Authorization: Bearer wHFmHR*****kD6wHg'
-H 'accept: application/json'
-H 'content-type: application/json'
--insecureResponse Sample
json
{
"code": "SUCCESS",
"data": {
"ev_station": [],
"vpn": [
{
"deleted": false,
"id": "65dff9a9c188cb71cfac8e9d",
"metadata": {
"has_ip": true
},
"name": "UDM Pro",
"short_name": ""
}
],
"wifi": [
{
"deleted": false,
"id": "65dff9a8c188cb71cfac8e9a",
"metadata": null,
"name": "UniFi Identity",
"short_name": ""
}
]
},
"msg": "success"
}Assign Resources to User Groups
This API enables you to assign UniFi Identity resources to user groups.
| Request URL | /api/v1/developer/user_groups/:id/identity/assignments |
|---|---|
| Permission Key | edit:user |
| Method | POST |
| UniFi Access Requirement | 2.2.0 or later |
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Request Path
| Parameter | Required | Type | Description | How to Get It? |
| id | T | String | Identity ID of the user group. | Get it from the API /api/v1/developer/user_groups |
Request Body
| Parameter | Required | Type | Description | How to Get It? |
| resource_type | T | String | enum resource_type {ev_station,vpn,wifi} | Get it from the API 10.2 |
| resource_ids | T | Array[String] | Identity ID of the resources. | Get it from the API 10.2 |
Request Sample: Shell/cURL
bash
curl -XPOST '{{host}}/api/v1/developer/user_groups/7476c839-8e10-472e-894f-c5b8254c35b5/identity/assignments'
-H 'Authorization: Bearer wHFmHR******kD6wHg'
-H 'accept: application/json'
-H 'content-type: application/json'
--data '{
"resource_type": "wifi",
"resource_ids": [
"65dff9a8c188cb71cfac8e9a"
]
}'
--insecureResponse Sample
json
{
"code": "SUCCESS",
"data": null,
"msg": "success"
}Fetch the Resources Assigned to User Groups
This API enables you to fetch the UniFi Identity resources assigned to user groups.
| Request URL | /api/v1/developer/user_groups/:id/identity/assignments |
|---|---|
| Permission Key | view:user |
| Method | GET |
| UniFi Access Requirement | 2.2.0 or later |
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Request Path
| Parameter | Required | Type | Description | How to Get It? |
| id | T | String | Identity ID of the user group. | Get it from the API /api/v1/developer/user_groups |
Response Body
| Parameter | Required | Type | Description |
| data.[resource_type] | T | Array[Object] | Type of the resources. enum resource_type {ev_station,vpn,wifi,camera} |
| id | T | String | Identity ID of the resources. |
| name | T | String | Name of the resources. |
| deleted | T | Boolean | Indicate whether a resource is disabled. |
Request Sample: Shell/cURL
bash
curl -XGET '{{host}}/api/v1/developer/user_groups/7476c839-8e10-472e-894f-c5b8254c35b5/identity/assignments'
-H 'Authorization: Bearer wHFmHR******kD6wHg'
-H 'accept: application/json'
-H 'content-type: application/json'
--insecureResponse Sample
json
{
"code": "SUCCESS",
"data": {
"ev_station": [],
"vpn": [
{
"deleted": false,
"id": "65dff9a9c188cb71cfac8e9d",
"metadata": {
"has_ip": true
},
"name": "UDM Pro",
"short_name": ""
}
],
"wifi": [
{
"deleted": false,
"id": "65dff9a8c188cb71cfac8e9a",
"metadata": null,
"name": "UniFi Identity",
"short_name": ""
}
]
},
"msg": "success"
}