Skip to content
Leadtime
English
Esc
navigateopen⌘Jpreview

Toggle single permission

What this does: Grants or revokes a single permission for a custom role. This is the most granular way to update role permissions - perfect for making individual permission changes.

Important restrictions:

  • Base roles cannot have their permissions modified
  • Only custom roles can be updated
  • The permission must be valid and allowed for the role type
  • Guest roles cannot be granted certain permissions (e.g., workspace administration)

How it works:

  • Provide the permission key in the URL path (e.g., “projects.create”, “tasks.delete”)
  • Set the “allow” field to true to grant the permission, or false to revoke it
  • The permission is validated against disallowed permissions for the role type
  • All other permissions remain unchanged

Permission inheritance:

  • If the role has a parent that grants this permission, setting allow=true explicitly allows it
  • If the role has a parent that grants this permission, setting allow=false explicitly disallows it (overrides inheritance)
  • If the role has a parent that disallows this permission, setting allow=true explicitly allows it (overrides inheritance)

What is returned: Returns the complete role details with updated permissions, showing the new state of all permissions including the one that was changed.

Use cases:

  • Grant a specific permission to a role (e.g., allow “projects.create”)
  • Revoke a specific permission from a role (e.g., disallow “tasks.delete”)
  • Fine-tune role permissions one at a time
  • Build permission management UIs with individual toggles

Example: To grant “projects.create” permission: PATCH /roles/role-id/permissions/projects.create with {“allow”: true} To revoke “tasks.delete” permission: PATCH /roles/role-id/permissions/tasks.delete with {“allow”: false}

PATCH/administration/roles/{id}/permissions/{permissionKey}
Authorization
AuthorizationOAuth2 access token · headerrequired
Scopes:api:write
or
AuthorizationBearer token (JWT) · headerrequired
Path parameters
idstringrequired
permissionKeystringrequired
Query parameters
fieldsToReturnstring
Comma-separated list of top-level response fields to return. Overrides the endpoint compact default unless responseShape=full is used.
responseShapestring
Advanced override. Omit for the endpoint compact default. Use full only when you need the complete endpoint response, including nested fields that are not selectable with fieldsToReturn.
Allowed:compactfull
Header parameters
LT-Response-Shapestring
Advanced override. Set to full only when you need the complete endpoint response, including nested fields that are not selectable with fieldsToReturn.
Allowed:full
Request body
requiredapplication/json
allowbooleanrequired
Boolean value indicating whether to grant (true) or revoke (false) the permission specified in the URL path. Setting to true explicitly allows the permission, even if it was inherited from a parent role. Setting to false explicitly disallows the permission, overriding any inheritance.
Responses
200
createdAtstring<date-time>
ISO 8601 timestamp indicating when this custom role was created. Only present for custom roles, not base roles.
createdBystring
User ID of the person who created this custom role. Only present for custom roles, not base roles.
descriptionstringrequired
Human-readable description of the role purpose and responsibilities, localized based on user language preference.
editedAtstring<date-time>
ISO 8601 timestamp indicating when this custom role was last modified. Only present for custom roles, not base roles.
effectivePermissionsobjectrequired
Permission map after resolving the full parent chain and child overrides.
iconstringrequired
Icon identifier for the role. Can be a RemixIcon class name (e.g., "ri-user-line") or an emoji code (e.g., ":person_in_tuxedo:"). Used for visual identification in role lists.
idstringrequired
Unique identifier for the role. Base roles have IDs containing underscore-prefixed identifiers (e.g., "_root_", "_ceo_", "_staff_"). Custom roles have workspace-prefixed IDs.
namestringrequired
Display name of the role, localized based on user language preference.
parentIdstring
ID of the parent role if this role inherits permissions from another role. Undefined if the role has no parent (e.g., base roles or top-level custom roles).
permissionsobjectrequired
Complete map of all permissions for this role. Keys are permission identifiers (e.g., "projects.create", "tasks.delete"). Values are true if the permission is explicitly allowed, false if explicitly disallowed, or missing if inherited from parent role. This map includes both explicitly set permissions and inherited permissions.
rawPermissionsobjectrequired
Permissions explicitly stored or defined on this role before inheritance.
readOnlybooleanrequired
Boolean flag indicating if this is a base role (system-defined) that cannot be modified or deleted. Base roles include Root, CEO, Team Leader, Staff, and Guest.
typestringrequired
Role type indicating the intended use case. "normal" for internal team members, "guest" for external users. Determines permission restrictions.
401Unauthorized - Invalid or missing authentication token
403Forbidden - Insufficient API scopes or permissions
Request
curl -X PATCH "https://leadtime.app/api/public/administration/roles/string/permissions/string" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "allow": true
}'
Response
{
  "createdAt": "2024-01-01T00:00:00Z",
  "createdBy": "string",
  "description": "Standard employee role",
  "editedAt": "2024-01-01T00:00:00Z",
  "effectivePermissions": {
    "profile.manage": true,
    "tasks.create": true,
    "tasks.delete": false
  },
  "icon": "ri-user-line",
  "id": "workspace-id_employee",
  "name": "Employee",
  "parentId": "workspace-id_admin",
  "permissions": {
    "projects.create": true,
    "projects.delete": false
  },
  "rawPermissions": {
    "tasks.create": true,
    "tasks.delete": false
  },
  "readOnly": false,
  "type": "normal"
}