> For the complete documentation index, see [llms.txt](https://docs.projetly.ai/home/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.projetly.ai/home/api-reference/user-roles.md).

# User Roles

## All Roles

> This endpoint is used to fetch all roles in the current organization

```json
{"openapi":"3.0.3","info":{"title":"Projetly API","version":"1.0.0"},"servers":[{"url":"https://api.app.projetly.io"}],"security":[{"bearerAuth":[]},{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT token obtained from /api/login/. Pass as: Authorization: Bearer <token>"}},"schemas":{"RoleOpt":{"type":"object","description":"Serializer for Documents.\n\nRecognized primitve fields:\n\n    * ``StringField``\n    * ``URLField``\n    * ``EmailField``\n    * ``IntField``\n    * ``LongField``\n    * ``FloatField``\n    * ``DecimalField``\n    * ``BooleanField``\n    * ``DateTimeField``\n    * ``ComplexDateTimeField``\n    * ``ObjectIdField``\n    * ``SequenceField`` (assumes it has integer counter)\n    * ``UUIDField``\n    * ``GeoPointField``\n    * ``GeoJsonBaseField`` (all those fields)\n    * ``DateField``\n\nCompound fields: ``ListField`` and ``DictField`` are mapped to corresponding DRF fields, with respect to nested field specification.\n\nThe ``ReferenceField`` is handled like ``ForeignKey`` in DRF: there nested serializer autogenerated if serializer depth greater then 0, otherwise it's handled by it's own (results as ``str(id)``).\n\nFor ``EmbeddedDocumentField`` also nested serializer autogenerated for non-zero depth, otherwise it is skipped. TODO: THIS IS PROBABLY WRONG AND SHOULD BE FIXED.\n\nGeneric fields ``GenericReferenceField`` and ``GenericEmbeddedDocumentField`` are handled by their own with corresponding serializer fields.\n\nNot well supported or untested:\n\n    ``FileField``\n    ``ImageField``\n    ``BinaryField``\n\nAll other fields are mapped to ``DocumentField`` and probably will work wrong.","properties":{"role_id":{"type":"string"},"role_name":{"type":"string","maxLength":100},"is_customer_role":{"type":"boolean"},"is_admin_role":{"type":"boolean"},"is_manager_role":{"type":"boolean"},"is_observer_role":{"type":"boolean"},"is_user_role":{"type":"boolean"},"is_partner_role":{"type":"boolean"},"is_organization_admin_role":{"type":"boolean"},"is_pre_sales_consultant":{"type":"boolean"},"is_system_role":{"type":"boolean"}},"required":["role_id","role_name"]}}},"paths":{"/api/users/role/":{"get":{"operationId":"users_role_list","description":"This endpoint is used to fetch all roles in the current organization","summary":"All Roles","parameters":[{"in":"query","name":"items_per_page","schema":{"type":"integer"},"description":"Items Per Page","required":true},{"in":"query","name":"page","schema":{"type":"integer"},"description":"Page Number","required":true},{"in":"query","name":"reverse","schema":{"type":"boolean"},"description":"Sorting Order"},{"in":"query","name":"sort","schema":{"type":"string"},"description":"Sorting Key"}],"tags":["User Roles"],"responses":{"200":{"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RoleOpt"}}}},"description":""}}}}}}
```

## GET /api/users/role/{id}/

> Adaptation of DRF ModelViewSet

```json
{"openapi":"3.0.3","info":{"title":"Projetly API","version":"1.0.0"},"servers":[{"url":"https://api.app.projetly.io"}],"security":[{"bearerAuth":[]},{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT token obtained from /api/login/. Pass as: Authorization: Bearer <token>"}},"schemas":{"RoleOpt":{"type":"object","description":"Serializer for Documents.\n\nRecognized primitve fields:\n\n    * ``StringField``\n    * ``URLField``\n    * ``EmailField``\n    * ``IntField``\n    * ``LongField``\n    * ``FloatField``\n    * ``DecimalField``\n    * ``BooleanField``\n    * ``DateTimeField``\n    * ``ComplexDateTimeField``\n    * ``ObjectIdField``\n    * ``SequenceField`` (assumes it has integer counter)\n    * ``UUIDField``\n    * ``GeoPointField``\n    * ``GeoJsonBaseField`` (all those fields)\n    * ``DateField``\n\nCompound fields: ``ListField`` and ``DictField`` are mapped to corresponding DRF fields, with respect to nested field specification.\n\nThe ``ReferenceField`` is handled like ``ForeignKey`` in DRF: there nested serializer autogenerated if serializer depth greater then 0, otherwise it's handled by it's own (results as ``str(id)``).\n\nFor ``EmbeddedDocumentField`` also nested serializer autogenerated for non-zero depth, otherwise it is skipped. TODO: THIS IS PROBABLY WRONG AND SHOULD BE FIXED.\n\nGeneric fields ``GenericReferenceField`` and ``GenericEmbeddedDocumentField`` are handled by their own with corresponding serializer fields.\n\nNot well supported or untested:\n\n    ``FileField``\n    ``ImageField``\n    ``BinaryField``\n\nAll other fields are mapped to ``DocumentField`` and probably will work wrong.","properties":{"role_id":{"type":"string"},"role_name":{"type":"string","maxLength":100},"is_customer_role":{"type":"boolean"},"is_admin_role":{"type":"boolean"},"is_manager_role":{"type":"boolean"},"is_observer_role":{"type":"boolean"},"is_user_role":{"type":"boolean"},"is_partner_role":{"type":"boolean"},"is_organization_admin_role":{"type":"boolean"},"is_pre_sales_consultant":{"type":"boolean"},"is_system_role":{"type":"boolean"}},"required":["role_id","role_name"]}}},"paths":{"/api/users/role/{id}/":{"get":{"operationId":"users_role_retrieve","description":"Adaptation of DRF ModelViewSet","parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true}],"tags":["User Roles"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoleOpt"}}},"description":""}}}}}}
```

## Edits the role with the given id

> This endpoint is used to edit a role for the current organization

```json
{"openapi":"3.0.3","info":{"title":"Projetly API","version":"1.0.0"},"servers":[{"url":"https://api.app.projetly.io"}],"security":[{"bearerAuth":[]},{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT token obtained from /api/login/. Pass as: Authorization: Bearer <token>"}}},"paths":{"/api/users/role/{id}/":{"put":{"operationId":"users_role_update","description":"This endpoint is used to edit a role for the current organization","summary":"Edits the role with the given id","parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true}],"tags":["User Roles"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"responses":{"200":{"description":"No response body"}}}}}}
```

## Deletes the role with the given id

> This endpoint is used to delete a role for the current organization

```json
{"openapi":"3.0.3","info":{"title":"Projetly API","version":"1.0.0"},"servers":[{"url":"https://api.app.projetly.io"}],"security":[{"bearerAuth":[]},{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT token obtained from /api/login/. Pass as: Authorization: Bearer <token>"}}},"paths":{"/api/users/role/{id}/":{"delete":{"operationId":"users_role_destroy","description":"This endpoint is used to delete a role for the current organization","summary":"Deletes the role with the given id","parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true}],"tags":["User Roles"],"responses":{"204":{"description":"No response body"}}}}}}
```

## PATCH /api/users/role/{id}/

> Adaptation of DRF ModelViewSet

```json
{"openapi":"3.0.3","info":{"title":"Projetly API","version":"1.0.0"},"servers":[{"url":"https://api.app.projetly.io"}],"security":[{"bearerAuth":[]},{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT token obtained from /api/login/. Pass as: Authorization: Bearer <token>"}},"schemas":{"PatchedRoleOpt":{"type":"object","description":"Serializer for Documents.\n\nRecognized primitve fields:\n\n    * ``StringField``\n    * ``URLField``\n    * ``EmailField``\n    * ``IntField``\n    * ``LongField``\n    * ``FloatField``\n    * ``DecimalField``\n    * ``BooleanField``\n    * ``DateTimeField``\n    * ``ComplexDateTimeField``\n    * ``ObjectIdField``\n    * ``SequenceField`` (assumes it has integer counter)\n    * ``UUIDField``\n    * ``GeoPointField``\n    * ``GeoJsonBaseField`` (all those fields)\n    * ``DateField``\n\nCompound fields: ``ListField`` and ``DictField`` are mapped to corresponding DRF fields, with respect to nested field specification.\n\nThe ``ReferenceField`` is handled like ``ForeignKey`` in DRF: there nested serializer autogenerated if serializer depth greater then 0, otherwise it's handled by it's own (results as ``str(id)``).\n\nFor ``EmbeddedDocumentField`` also nested serializer autogenerated for non-zero depth, otherwise it is skipped. TODO: THIS IS PROBABLY WRONG AND SHOULD BE FIXED.\n\nGeneric fields ``GenericReferenceField`` and ``GenericEmbeddedDocumentField`` are handled by their own with corresponding serializer fields.\n\nNot well supported or untested:\n\n    ``FileField``\n    ``ImageField``\n    ``BinaryField``\n\nAll other fields are mapped to ``DocumentField`` and probably will work wrong.","properties":{"role_id":{"type":"string"},"role_name":{"type":"string","maxLength":100},"is_customer_role":{"type":"boolean"},"is_admin_role":{"type":"boolean"},"is_manager_role":{"type":"boolean"},"is_observer_role":{"type":"boolean"},"is_user_role":{"type":"boolean"},"is_partner_role":{"type":"boolean"},"is_organization_admin_role":{"type":"boolean"},"is_pre_sales_consultant":{"type":"boolean"},"is_system_role":{"type":"boolean"}}},"RoleOpt":{"type":"object","description":"Serializer for Documents.\n\nRecognized primitve fields:\n\n    * ``StringField``\n    * ``URLField``\n    * ``EmailField``\n    * ``IntField``\n    * ``LongField``\n    * ``FloatField``\n    * ``DecimalField``\n    * ``BooleanField``\n    * ``DateTimeField``\n    * ``ComplexDateTimeField``\n    * ``ObjectIdField``\n    * ``SequenceField`` (assumes it has integer counter)\n    * ``UUIDField``\n    * ``GeoPointField``\n    * ``GeoJsonBaseField`` (all those fields)\n    * ``DateField``\n\nCompound fields: ``ListField`` and ``DictField`` are mapped to corresponding DRF fields, with respect to nested field specification.\n\nThe ``ReferenceField`` is handled like ``ForeignKey`` in DRF: there nested serializer autogenerated if serializer depth greater then 0, otherwise it's handled by it's own (results as ``str(id)``).\n\nFor ``EmbeddedDocumentField`` also nested serializer autogenerated for non-zero depth, otherwise it is skipped. TODO: THIS IS PROBABLY WRONG AND SHOULD BE FIXED.\n\nGeneric fields ``GenericReferenceField`` and ``GenericEmbeddedDocumentField`` are handled by their own with corresponding serializer fields.\n\nNot well supported or untested:\n\n    ``FileField``\n    ``ImageField``\n    ``BinaryField``\n\nAll other fields are mapped to ``DocumentField`` and probably will work wrong.","properties":{"role_id":{"type":"string"},"role_name":{"type":"string","maxLength":100},"is_customer_role":{"type":"boolean"},"is_admin_role":{"type":"boolean"},"is_manager_role":{"type":"boolean"},"is_observer_role":{"type":"boolean"},"is_user_role":{"type":"boolean"},"is_partner_role":{"type":"boolean"},"is_organization_admin_role":{"type":"boolean"},"is_pre_sales_consultant":{"type":"boolean"},"is_system_role":{"type":"boolean"}},"required":["role_id","role_name"]}}},"paths":{"/api/users/role/{id}/":{"patch":{"operationId":"users_role_partial_update","description":"Adaptation of DRF ModelViewSet","parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true}],"tags":["User Roles"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchedRoleOpt"}},"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/PatchedRoleOpt"}},"multipart/form-data":{"schema":{"$ref":"#/components/schemas/PatchedRoleOpt"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoleOpt"}}},"description":""}}}}}}
```

## GET /api/users/role/option/

> Adaptation of DRF ModelViewSet

```json
{"openapi":"3.0.3","info":{"title":"Projetly API","version":"1.0.0"},"servers":[{"url":"https://api.app.projetly.io"}],"security":[{"bearerAuth":[]},{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT token obtained from /api/login/. Pass as: Authorization: Bearer <token>"}},"schemas":{"RoleOpt":{"type":"object","description":"Serializer for Documents.\n\nRecognized primitve fields:\n\n    * ``StringField``\n    * ``URLField``\n    * ``EmailField``\n    * ``IntField``\n    * ``LongField``\n    * ``FloatField``\n    * ``DecimalField``\n    * ``BooleanField``\n    * ``DateTimeField``\n    * ``ComplexDateTimeField``\n    * ``ObjectIdField``\n    * ``SequenceField`` (assumes it has integer counter)\n    * ``UUIDField``\n    * ``GeoPointField``\n    * ``GeoJsonBaseField`` (all those fields)\n    * ``DateField``\n\nCompound fields: ``ListField`` and ``DictField`` are mapped to corresponding DRF fields, with respect to nested field specification.\n\nThe ``ReferenceField`` is handled like ``ForeignKey`` in DRF: there nested serializer autogenerated if serializer depth greater then 0, otherwise it's handled by it's own (results as ``str(id)``).\n\nFor ``EmbeddedDocumentField`` also nested serializer autogenerated for non-zero depth, otherwise it is skipped. TODO: THIS IS PROBABLY WRONG AND SHOULD BE FIXED.\n\nGeneric fields ``GenericReferenceField`` and ``GenericEmbeddedDocumentField`` are handled by their own with corresponding serializer fields.\n\nNot well supported or untested:\n\n    ``FileField``\n    ``ImageField``\n    ``BinaryField``\n\nAll other fields are mapped to ``DocumentField`` and probably will work wrong.","properties":{"role_id":{"type":"string"},"role_name":{"type":"string","maxLength":100},"is_customer_role":{"type":"boolean"},"is_admin_role":{"type":"boolean"},"is_manager_role":{"type":"boolean"},"is_observer_role":{"type":"boolean"},"is_user_role":{"type":"boolean"},"is_partner_role":{"type":"boolean"},"is_organization_admin_role":{"type":"boolean"},"is_pre_sales_consultant":{"type":"boolean"},"is_system_role":{"type":"boolean"}},"required":["role_id","role_name"]}}},"paths":{"/api/users/role/option/":{"get":{"operationId":"users_role_option_retrieve","description":"Adaptation of DRF ModelViewSet","tags":["User Roles"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoleOpt"}}},"description":""}}}}}}
```
