# Update a role by ID Updates an existing role record. Endpoint: PUT /v1/api/roles/{id} Version: 1.2.4 Security: X-Api-Key ## Path parameters: - `id` (string, required) Roles ID ## Request fields (application/json): - `name` (string) Name of the role. Example: "Manager" - `permissions` (array) Permissions assigned to the role. Example: [{"name":"create_order","permissionId":"507f1f77bcf86cd799439011","category":"orders","subCategory":"management","value":true}] - `permissions.name` (string, required) Name of the permission. Example: "create_order" - `permissions.permissionId` (string, required) Permission ID reference. Example: "507f1f77bcf86cd799439011" - `permissions.category` (string, required) Category of the permission. Example: "orders" - `permissions.subCategory` (string, required) Sub-category of the permission. Example: "management" - `permissions.value` (boolean, required) Whether the permission is enabled. Example: true ## Response 200 fields (application/json): - `id` (string) Unique identifier for the Roles. Example: "o1p2q3r4s5t6u7v8w9x0y1z2" - `createdAt` (string) Timestamp when the Roles was created. Example: "2025-12-07T19:31:48.436+00:00" - `updatedAt` (string) Timestamp when the Roles was last updated. Example: "2025-12-07T19:35:48.436+00:00" - `companyId` (string) Company ID associated with the Roles. Example: "o1p2q3r4s5t6u7v8w9x0y1z2" - `name` (string) Name of the role. Example: "Manager" - `permissions` (array) Permissions assigned to the role. Example: [{"name":"create_order","permissionId":"507f1f77bcf86cd799439011","category":"orders","subCategory":"management","value":true}] - `permissions.name` (string, required) Name of the permission. Example: "create_order" - `permissions.permissionId` (string, required) Permission ID reference. Example: "507f1f77bcf86cd799439011" - `permissions.category` (string, required) Category of the permission. Example: "orders" - `permissions.subCategory` (string, required) Sub-category of the permission. Example: "management" - `permissions.value` (boolean, required) Whether the permission is enabled. Example: true ## Response 400 fields (application/json): - `statusCode` (number, required) HTTP status code Example: 400 - `message` (string, required) Error message describing what went wrong Example: "Validation failed: Field `schemaField` is required." - `error` (string, required) Error type/name Enum: "Bad Request", "Unauthorized", "Forbidden", "Not Found", "Conflict", "Unprocessable Entity", "Internal Server Error" ## Response 404 fields (application/json): - `statusCode` (number, required) HTTP status code Example: 404 - `message` (string, required) Error message describing what went wrong Example: "The resource was not found." - `error` (string, required) Error type/name Enum: "Bad Request", "Unauthorized", "Forbidden", "Not Found", "Conflict", "Unprocessable Entity", "Internal Server Error"