# Role

{% hint style="success" %}
API SERVER:

⇒ <mark style="color:yellow;">**<https://apivcloud.innoway.vn>**</mark>
{% endhint %}

## POST /api/roles

> Create role

```json
{"openapi":"3.0.0","info":{"title":"Role","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}},"schemas":{"Role":{"type":"object","description":"Thông tin role và tập quyền (RBAC)","properties":{"id":{"type":"string","format":"uuid","description":"Định danh duy nhất của role"},"owner":{"type":"string","format":"uuid","description":"ID người tạo hoặc chủ sở hữu role"},"project_id":{"type":"string","format":"uuid","description":"ID project mà role thuộc về"},"project_name":{"type":"string","description":"Tên project"},"name":{"type":"string","description":"Tên role hiển thị trong hệ thống"},"policies":{"type":"array","description":"Danh sách policy (mỗi policy định nghĩa quyền trên 1 hoặc nhiều tài nguyên)","items":{"$ref":"#/components/schemas/Policy"}},"role_type":{"type":"string","description":"Loại role"},"applicable_to":{"type":"string","description":"Đối tượng áp dụng role"}},"required":["name","role_type","project_id","policies"]},"Policy":{"type":"object","description":"Định nghĩa tập quyền trên một nhóm tài nguyên","properties":{"policy_name":{"type":"string","description":"Tên policy (dùng để mô tả hoặc phân nhóm)"},"resources":{"type":"array","description":"Danh sách tài nguyên mà policy áp dụng","items":{"type":"string"}},"actions":{"type":"array","description":"Danh sách hành động được phép trên tài nguyên","items":{"type":"string","enum":["read","create","modify","delete"]}},"group_resources":{"type":"array","nullable":true,"description":"Danh sách nhóm tài nguyên(nếu có)","items":{"type":"string"}}},"required":["resources","actions"]}}},"paths":{"/api/roles":{"post":{"summary":"Create role","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Role"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Role"}}}}}}}}}
```

## GET /api/roles

> Get list roles

```json
{"openapi":"3.0.0","info":{"title":"Role","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}},"schemas":{"RoleListResponse":{"type":"object","description":"Response danh sách role có phân trang","properties":{"total":{"type":"integer","description":"Tổng số role thỏa điều kiện truy vấn"},"offset":{"type":"integer","description":"Vị trí bắt đầu lấy dữ liệu (dùng cho phân trang)"},"limit":{"type":"integer","description":"Số lượng bản ghi tối đa trả về"},"roles":{"type":"array","description":"Danh sách role","items":{"$ref":"#/components/schemas/Role"}}}},"Role":{"type":"object","description":"Thông tin role và tập quyền (RBAC)","properties":{"id":{"type":"string","format":"uuid","description":"Định danh duy nhất của role"},"owner":{"type":"string","format":"uuid","description":"ID người tạo hoặc chủ sở hữu role"},"project_id":{"type":"string","format":"uuid","description":"ID project mà role thuộc về"},"project_name":{"type":"string","description":"Tên project"},"name":{"type":"string","description":"Tên role hiển thị trong hệ thống"},"policies":{"type":"array","description":"Danh sách policy (mỗi policy định nghĩa quyền trên 1 hoặc nhiều tài nguyên)","items":{"$ref":"#/components/schemas/Policy"}},"role_type":{"type":"string","description":"Loại role"},"applicable_to":{"type":"string","description":"Đối tượng áp dụng role"}},"required":["name","role_type","project_id","policies"]},"Policy":{"type":"object","description":"Định nghĩa tập quyền trên một nhóm tài nguyên","properties":{"policy_name":{"type":"string","description":"Tên policy (dùng để mô tả hoặc phân nhóm)"},"resources":{"type":"array","description":"Danh sách tài nguyên mà policy áp dụng","items":{"type":"string"}},"actions":{"type":"array","description":"Danh sách hành động được phép trên tài nguyên","items":{"type":"string","enum":["read","create","modify","delete"]}},"group_resources":{"type":"array","nullable":true,"description":"Danh sách nhóm tài nguyên(nếu có)","items":{"type":"string"}}},"required":["resources","actions"]}}},"paths":{"/api/roles":{"get":{"summary":"Get list roles","parameters":[{"name":"project_id","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer"}},{"name":"offset","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"Get list roles successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoleListResponse"}}}}}}}}}
```

## GET /api/roles/{role\_id}

> Get role by id

```json
{"openapi":"3.0.0","info":{"title":"Role","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}},"schemas":{"Role":{"type":"object","description":"Thông tin role và tập quyền (RBAC)","properties":{"id":{"type":"string","format":"uuid","description":"Định danh duy nhất của role"},"owner":{"type":"string","format":"uuid","description":"ID người tạo hoặc chủ sở hữu role"},"project_id":{"type":"string","format":"uuid","description":"ID project mà role thuộc về"},"project_name":{"type":"string","description":"Tên project"},"name":{"type":"string","description":"Tên role hiển thị trong hệ thống"},"policies":{"type":"array","description":"Danh sách policy (mỗi policy định nghĩa quyền trên 1 hoặc nhiều tài nguyên)","items":{"$ref":"#/components/schemas/Policy"}},"role_type":{"type":"string","description":"Loại role"},"applicable_to":{"type":"string","description":"Đối tượng áp dụng role"}},"required":["name","role_type","project_id","policies"]},"Policy":{"type":"object","description":"Định nghĩa tập quyền trên một nhóm tài nguyên","properties":{"policy_name":{"type":"string","description":"Tên policy (dùng để mô tả hoặc phân nhóm)"},"resources":{"type":"array","description":"Danh sách tài nguyên mà policy áp dụng","items":{"type":"string"}},"actions":{"type":"array","description":"Danh sách hành động được phép trên tài nguyên","items":{"type":"string","enum":["read","create","modify","delete"]}},"group_resources":{"type":"array","nullable":true,"description":"Danh sách nhóm tài nguyên(nếu có)","items":{"type":"string"}}},"required":["resources","actions"]}}},"paths":{"/api/roles/{role_id}":{"get":{"summary":"Get role by id","parameters":[],"responses":{"200":{"description":"Get role successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Role"}}}}}}}}}
```

## PUT /api/roles/{role\_id}

> Update role

```json
{"openapi":"3.0.0","info":{"title":"Role","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}},"schemas":{"Role":{"type":"object","description":"Thông tin role và tập quyền (RBAC)","properties":{"id":{"type":"string","format":"uuid","description":"Định danh duy nhất của role"},"owner":{"type":"string","format":"uuid","description":"ID người tạo hoặc chủ sở hữu role"},"project_id":{"type":"string","format":"uuid","description":"ID project mà role thuộc về"},"project_name":{"type":"string","description":"Tên project"},"name":{"type":"string","description":"Tên role hiển thị trong hệ thống"},"policies":{"type":"array","description":"Danh sách policy (mỗi policy định nghĩa quyền trên 1 hoặc nhiều tài nguyên)","items":{"$ref":"#/components/schemas/Policy"}},"role_type":{"type":"string","description":"Loại role"},"applicable_to":{"type":"string","description":"Đối tượng áp dụng role"}},"required":["name","role_type","project_id","policies"]},"Policy":{"type":"object","description":"Định nghĩa tập quyền trên một nhóm tài nguyên","properties":{"policy_name":{"type":"string","description":"Tên policy (dùng để mô tả hoặc phân nhóm)"},"resources":{"type":"array","description":"Danh sách tài nguyên mà policy áp dụng","items":{"type":"string"}},"actions":{"type":"array","description":"Danh sách hành động được phép trên tài nguyên","items":{"type":"string","enum":["read","create","modify","delete"]}},"group_resources":{"type":"array","nullable":true,"description":"Danh sách nhóm tài nguyên(nếu có)","items":{"type":"string"}}},"required":["resources","actions"]}}},"paths":{"/api/roles/{role_id}":{"put":{"summary":"Update role","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Role"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{}}}}}}}}
```

## DELETE /api/roles/{role\_id}

> Delete role

```json
{"openapi":"3.0.0","info":{"title":"Role","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}}},"paths":{"/api/roles/{role_id}":{"delete":{"summary":"Delete role","parameters":[],"responses":{"200":{"description":"Deleted","content":{"application/json":{}}}}}}}}
```

## The RoleListResponse object

```json
{"openapi":"3.0.0","info":{"title":"Role","version":"1.0.0"},"components":{"schemas":{"RoleListResponse":{"type":"object","description":"Response danh sách role có phân trang","properties":{"total":{"type":"integer","description":"Tổng số role thỏa điều kiện truy vấn"},"offset":{"type":"integer","description":"Vị trí bắt đầu lấy dữ liệu (dùng cho phân trang)"},"limit":{"type":"integer","description":"Số lượng bản ghi tối đa trả về"},"roles":{"type":"array","description":"Danh sách role","items":{"$ref":"#/components/schemas/Role"}}}},"Role":{"type":"object","description":"Thông tin role và tập quyền (RBAC)","properties":{"id":{"type":"string","format":"uuid","description":"Định danh duy nhất của role"},"owner":{"type":"string","format":"uuid","description":"ID người tạo hoặc chủ sở hữu role"},"project_id":{"type":"string","format":"uuid","description":"ID project mà role thuộc về"},"project_name":{"type":"string","description":"Tên project"},"name":{"type":"string","description":"Tên role hiển thị trong hệ thống"},"policies":{"type":"array","description":"Danh sách policy (mỗi policy định nghĩa quyền trên 1 hoặc nhiều tài nguyên)","items":{"$ref":"#/components/schemas/Policy"}},"role_type":{"type":"string","description":"Loại role"},"applicable_to":{"type":"string","description":"Đối tượng áp dụng role"}},"required":["name","role_type","project_id","policies"]},"Policy":{"type":"object","description":"Định nghĩa tập quyền trên một nhóm tài nguyên","properties":{"policy_name":{"type":"string","description":"Tên policy (dùng để mô tả hoặc phân nhóm)"},"resources":{"type":"array","description":"Danh sách tài nguyên mà policy áp dụng","items":{"type":"string"}},"actions":{"type":"array","description":"Danh sách hành động được phép trên tài nguyên","items":{"type":"string","enum":["read","create","modify","delete"]}},"group_resources":{"type":"array","nullable":true,"description":"Danh sách nhóm tài nguyên(nếu có)","items":{"type":"string"}}},"required":["resources","actions"]}}}}
```

## The Role object

```json
{"openapi":"3.0.0","info":{"title":"Role","version":"1.0.0"},"components":{"schemas":{"Role":{"type":"object","description":"Thông tin role và tập quyền (RBAC)","properties":{"id":{"type":"string","format":"uuid","description":"Định danh duy nhất của role"},"owner":{"type":"string","format":"uuid","description":"ID người tạo hoặc chủ sở hữu role"},"project_id":{"type":"string","format":"uuid","description":"ID project mà role thuộc về"},"project_name":{"type":"string","description":"Tên project"},"name":{"type":"string","description":"Tên role hiển thị trong hệ thống"},"policies":{"type":"array","description":"Danh sách policy (mỗi policy định nghĩa quyền trên 1 hoặc nhiều tài nguyên)","items":{"$ref":"#/components/schemas/Policy"}},"role_type":{"type":"string","description":"Loại role"},"applicable_to":{"type":"string","description":"Đối tượng áp dụng role"}},"required":["name","role_type","project_id","policies"]},"Policy":{"type":"object","description":"Định nghĩa tập quyền trên một nhóm tài nguyên","properties":{"policy_name":{"type":"string","description":"Tên policy (dùng để mô tả hoặc phân nhóm)"},"resources":{"type":"array","description":"Danh sách tài nguyên mà policy áp dụng","items":{"type":"string"}},"actions":{"type":"array","description":"Danh sách hành động được phép trên tài nguyên","items":{"type":"string","enum":["read","create","modify","delete"]}},"group_resources":{"type":"array","nullable":true,"description":"Danh sách nhóm tài nguyên(nếu có)","items":{"type":"string"}}},"required":["resources","actions"]}}}}
```

## The Policy object

```json
{"openapi":"3.0.0","info":{"title":"Role","version":"1.0.0"},"components":{"schemas":{"Policy":{"type":"object","description":"Định nghĩa tập quyền trên một nhóm tài nguyên","properties":{"policy_name":{"type":"string","description":"Tên policy (dùng để mô tả hoặc phân nhóm)"},"resources":{"type":"array","description":"Danh sách tài nguyên mà policy áp dụng","items":{"type":"string"}},"actions":{"type":"array","description":"Danh sách hành động được phép trên tài nguyên","items":{"type":"string","enum":["read","create","modify","delete"]}},"group_resources":{"type":"array","nullable":true,"description":"Danh sách nhóm tài nguyên(nếu có)","items":{"type":"string"}}},"required":["resources","actions"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://innoway.gitbook.io/innoway/tai-lieu/api/rest-api/role.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
