{
  "opencollection": "1.0.0",
  "info": {
    "name": "Logto API references Account center Roles API",
    "version": "Cloud"
  },
  "request": {
    "auth": {
      "type": "oauth2",
      "flow": "client_credentials",
      "accessTokenUrl": "/oidc/token",
      "credentials": {
        "clientId": "{{clientId}}",
        "clientSecret": "{{clientSecret}}"
      }
    }
  },
  "items": [
    {
      "info": {
        "name": "Roles",
        "type": "folder"
      },
      "items": [
        {
          "info": {
            "name": "Get roles",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://[tenant_id].logto.app/api/roles",
            "params": [
              {
                "name": "excludeUserId",
                "value": "",
                "type": "query",
                "description": "Exclude roles assigned to a user."
              },
              {
                "name": "excludeApplicationId",
                "value": "",
                "type": "query",
                "description": "Exclude roles assigned to an application."
              },
              {
                "name": "type",
                "value": "",
                "type": "query",
                "description": "Filter by role type."
              },
              {
                "name": "page",
                "value": "",
                "type": "query",
                "description": "Page number (starts from 1)."
              },
              {
                "name": "page_size",
                "value": "",
                "type": "query",
                "description": "Entries per page."
              },
              {
                "name": "search_params",
                "value": "",
                "type": "query",
                "description": "Search query parameters."
              }
            ]
          },
          "docs": "Get roles with filters and pagination."
        },
        {
          "info": {
            "name": "Create a role",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://[tenant_id].logto.app/api/roles",
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Create a new role with the given data."
        },
        {
          "info": {
            "name": "Get role",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://[tenant_id].logto.app/api/roles/:id",
            "params": [
              {
                "name": "id",
                "value": "",
                "type": "path",
                "description": "The unique identifier of the role."
              }
            ]
          },
          "docs": "Get role details by ID."
        },
        {
          "info": {
            "name": "Update role",
            "type": "http"
          },
          "http": {
            "method": "PATCH",
            "url": "https://[tenant_id].logto.app/api/roles/:id",
            "params": [
              {
                "name": "id",
                "value": "",
                "type": "path",
                "description": "The unique identifier of the role."
              }
            ],
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Update role details. This method performs a partial update."
        },
        {
          "info": {
            "name": "Delete role",
            "type": "http"
          },
          "http": {
            "method": "DELETE",
            "url": "https://[tenant_id].logto.app/api/roles/:id",
            "params": [
              {
                "name": "id",
                "value": "",
                "type": "path",
                "description": "The unique identifier of the role."
              }
            ]
          },
          "docs": "Delete a role with the given ID."
        },
        {
          "info": {
            "name": "Get role users",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://[tenant_id].logto.app/api/roles/:id/users",
            "params": [
              {
                "name": "id",
                "value": "",
                "type": "path",
                "description": "The unique identifier of the role."
              },
              {
                "name": "page",
                "value": "",
                "type": "query",
                "description": "Page number (starts from 1)."
              },
              {
                "name": "page_size",
                "value": "",
                "type": "query",
                "description": "Entries per page."
              },
              {
                "name": "search_params",
                "value": "",
                "type": "query",
                "description": "Search query parameters."
              }
            ]
          },
          "docs": "Get users who have the role assigned with pagination."
        },
        {
          "info": {
            "name": "Assign role to users",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://[tenant_id].logto.app/api/roles/:id/users",
            "params": [
              {
                "name": "id",
                "value": "",
                "type": "path",
                "description": "The unique identifier of the role."
              }
            ],
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Assign a role to a list of users. The role must have the type `User`."
        },
        {
          "info": {
            "name": "Remove role from user",
            "type": "http"
          },
          "http": {
            "method": "DELETE",
            "url": "https://[tenant_id].logto.app/api/roles/:id/users/:userId",
            "params": [
              {
                "name": "id",
                "value": "",
                "type": "path",
                "description": "The unique identifier of the role."
              },
              {
                "name": "userId",
                "value": "",
                "type": "path",
                "description": "The unique identifier of the user."
              }
            ]
          },
          "docs": "Remove a role from a user with the given ID."
        },
        {
          "info": {
            "name": "Get role applications",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://[tenant_id].logto.app/api/roles/:id/applications",
            "params": [
              {
                "name": "id",
                "value": "",
                "type": "path",
                "description": "The unique identifier of the role."
              },
              {
                "name": "page",
                "value": "",
                "type": "query",
                "description": "Page number (starts from 1)."
              },
              {
                "name": "page_size",
                "value": "",
                "type": "query",
                "description": "Entries per page."
              },
              {
                "name": "search_params",
                "value": "",
                "type": "query",
                "description": "Search query parameters."
              }
            ]
          },
          "docs": "Get applications that have the role assigned with pagination."
        },
        {
          "info": {
            "name": "Assign role to applications",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://[tenant_id].logto.app/api/roles/:id/applications",
            "params": [
              {
                "name": "id",
                "value": "",
                "type": "path",
                "description": "The unique identifier of the role."
              }
            ],
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Assign a role to a list of applications. The role must have the type `Application`."
        },
        {
          "info": {
            "name": "Remove role from application",
            "type": "http"
          },
          "http": {
            "method": "DELETE",
            "url": "https://[tenant_id].logto.app/api/roles/:id/applications/:applicationId",
            "params": [
              {
                "name": "id",
                "value": "",
                "type": "path",
                "description": "The unique identifier of the role."
              },
              {
                "name": "applicationId",
                "value": "",
                "type": "path",
                "description": "The unique identifier of the application."
              }
            ]
          },
          "docs": "Remove the role from an application with the given ID."
        },
        {
          "info": {
            "name": "Get role scopes",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://[tenant_id].logto.app/api/roles/:id/scopes",
            "params": [
              {
                "name": "id",
                "value": "",
                "type": "path",
                "description": "The unique identifier of the role."
              },
              {
                "name": "page",
                "value": "",
                "type": "query",
                "description": "Page number (starts from 1)."
              },
              {
                "name": "page_size",
                "value": "",
                "type": "query",
                "description": "Entries per page."
              },
              {
                "name": "search_params",
                "value": "",
                "type": "query",
                "description": "Search query parameters."
              }
            ]
          },
          "docs": "Get API resource scopes (permissions) linked with a role."
        },
        {
          "info": {
            "name": "Link scopes to role",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://[tenant_id].logto.app/api/roles/:id/scopes",
            "params": [
              {
                "name": "id",
                "value": "",
                "type": "path",
                "description": "The unique identifier of the role."
              }
            ],
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Link a list of API resource scopes (permissions) to a role. The original linked scopes will be kept."
        },
        {
          "info": {
            "name": "Unlink scope from role",
            "type": "http"
          },
          "http": {
            "method": "DELETE",
            "url": "https://[tenant_id].logto.app/api/roles/:id/scopes/:scopeId",
            "params": [
              {
                "name": "id",
                "value": "",
                "type": "path",
                "description": "The unique identifier of the role."
              },
              {
                "name": "scopeId",
                "value": "",
                "type": "path",
                "description": "The unique identifier of the scope."
              }
            ]
          },
          "docs": "Unlink an API resource scope (permission) from a role with the given ID."
        }
      ]
    }
  ],
  "bundled": true
}