# Get users and groups in project GET https://app.unleash-instance.example.com/api/admin/projects/{projectId}/access **Enterprise feature** Get all groups, users and their roles, and available roles for the given project. Reference: https://docs.getunleash.io/api/get-project-access ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Get users and groups in project version: endpoint_projects.getProjectAccess paths: /api/admin/projects/{projectId}/access: get: operationId: get-project-access summary: Get users and groups in project description: >- **Enterprise feature** Get all groups, users and their roles, and available roles for the given project. tags: - - subpackage_projects parameters: - name: projectId in: path required: true schema: type: string - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '200': description: projectAccessSchema content: application/json: schema: $ref: '#/components/schemas/projectAccessSchema' '401': description: >- Authorization information is missing or invalid. Provide a valid API token as the `authorization` header, e.g. `authorization:*.*.my-admin-token`. content: {} '403': description: >- The provided user credentials are valid, but the user does not have the necessary permissions to perform this operation content: {} components: schemas: UserSchemaAccountType: type: string enum: - value: User - value: Service Account userSchema: type: object properties: id: type: integer description: The user id name: type: - string - 'null' description: Name of the user email: type: string description: Email of the user username: type: - string - 'null' description: A unique username for the user imageUrl: type: string description: URL used for the user profile image inviteLink: type: string description: >- If the user is actively inviting other users, this is the link that can be shared with other users loginAttempts: type: integer description: How many unsuccessful attempts at logging in has the user made emailSent: type: boolean description: Is the welcome email sent to the user or not rootRole: type: integer description: >- Which [root role](https://docs.getunleash.io/concepts/rbac#predefined-roles) this user is assigned seenAt: type: - string - 'null' format: date-time description: The last time this user logged in createdAt: type: string format: date-time description: The user was created at this time accountType: $ref: '#/components/schemas/UserSchemaAccountType' description: A user is either an actual User or a Service Account permissions: type: array items: type: string description: Deprecated scimId: type: - string - 'null' description: The SCIM ID of the user, only present if managed by SCIM seatType: type: - string - 'null' description: The seat type of this user companyRole: type: - string - 'null' description: The role of the user within the company. productUpdatesEmailConsent: type: - boolean - 'null' description: Whether the user has consented to receive product update emails. activeSessions: type: - integer - 'null' description: Count of active browser sessions for this user deletedSessions: type: number format: double description: >- Experimental. The number of deleted browser sessions after last login required: - id groupUserModelSchema: type: object properties: joinedAt: type: string format: date-time description: The date when the user joined the group createdBy: type: - string - 'null' description: The username of the user who added this user to this group user: $ref: '#/components/schemas/userSchema' required: - user groupWithProjectRoleSchema: type: object properties: name: type: string description: The name of the group id: type: integer description: The group's ID in the Unleash system addedAt: type: string format: date-time description: When this group was added to the project roleId: type: integer description: The ID of the role this group has in the given project roles: type: array items: type: integer description: A list of roles this user has in the given project description: type: - string - 'null' description: A custom description of the group mappingsSSO: type: array items: type: string description: A list of SSO groups that should map to this Unleash group rootRole: type: - number - 'null' format: double description: >- A role id that is used as the root role for all users in this group. This can be either the id of the Viewer, Editor or Admin role. createdBy: type: - string - 'null' description: A user who created this group createdAt: type: - string - 'null' format: date-time description: When was this group created users: type: array items: $ref: '#/components/schemas/groupUserModelSchema' description: A list of users belonging to this group scimId: type: - string - 'null' description: The SCIM ID of the group, only present if managed by SCIM required: - id userWithProjectRoleSchema: type: object properties: isAPI: type: boolean description: >- Whether this user is authenticated through Unleash tokens or logged in with a session name: type: string description: The name of the user email: type: - string - 'null' description: The user's email address id: type: integer description: The user's ID in the Unleash system imageUrl: type: - string - 'null' format: uri description: A URL pointing to the user's image. addedAt: type: string format: date-time description: When this user was added to the project roleId: type: integer description: The ID of the role this user has in the given project roles: type: array items: type: integer description: A list of roles this user has in the given project required: - id roleSchema: type: object properties: id: type: integer description: The role id type: type: string description: >- A role can either be a global root role (applies to all projects) or a project role name: type: string description: The name of the role description: type: string description: >- A more detailed description of the role and what use it's intended for project: type: - string - 'null' description: What project the role belongs to required: - id - type - name projectAccessSchema: type: object properties: groups: type: array items: $ref: '#/components/schemas/groupWithProjectRoleSchema' description: A list of groups that have access to this project users: type: array items: $ref: '#/components/schemas/userWithProjectRoleSchema' description: A list of users and their roles within this project roles: type: array items: $ref: '#/components/schemas/roleSchema' description: A list of roles that are available within this project. required: - groups - users - roles ``` ## SDK Code Examples ```python import requests url = "https://app.unleash-instance.example.com/api/admin/projects/projectId/access" headers = {"Authorization": ""} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://app.unleash-instance.example.com/api/admin/projects/projectId/access'; const options = {method: 'GET', headers: {Authorization: ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://app.unleash-instance.example.com/api/admin/projects/projectId/access" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://app.unleash-instance.example.com/api/admin/projects/projectId/access") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = '' response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://app.unleash-instance.example.com/api/admin/projects/projectId/access") .header("Authorization", "") .asString(); ``` ```php request('GET', 'https://app.unleash-instance.example.com/api/admin/projects/projectId/access', [ 'headers' => [ 'Authorization' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://app.unleash-instance.example.com/api/admin/projects/projectId/access"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", ""); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://app.unleash-instance.example.com/api/admin/projects/projectId/access")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```