> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://developers.awork.com/apiv1/roles/get-roles-users/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.awork.com/_mcp/server. # Returns all users in roles of the workspace. GET https://api.awork.com/api/v1/roles/users The user must be an admin or have `workspace-manage-config:read` permissions. Reference: https://developers.awork.com/apiv1/roles/get-roles-users ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Query parameters - `page` (integer, optional, default: 1) — Page number for pagination - `pageSize` (integer, optional, default: 10) — Number of items per page - `orderby` (string, optional) — The properties to order by - `filterby` (string, optional) — The filter expression to filter by ### Headers - `aw-internal-request` (string, required, default: true) — Marks this request as an internal request. Only allowed by the awork app or internally. ## Response ### 200 OK - `list of UserInRole` ## Types ### UserInRole - `userId` (string, required) — The id of the user to add to the role. - `isDeactivated` (boolean, optional) — Whether the user is deactivated in this role. - `roleId` (string, optional) — The id of the role the user is assigned to. ## Examples **Response** ```json [ { "userId": "123e4567-e89b-12d3-a456-426614174000", "isDeactivated": false, "roleId": "123e4567-e89b-12d3-a456-426614174000" } ] ``` **SDK Code** ```python import requests url = "https://api.awork.com/api/v1/roles/users" headers = { "aw-internal-request": "true", "Authorization": "Bearer " } response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.awork.com/api/v1/roles/users'; const options = { method: 'GET', headers: {'aw-internal-request': 'true', Authorization: 'Bearer '} }; 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://api.awork.com/api/v1/roles/users" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("aw-internal-request", "true") req.Header.Add("Authorization", "Bearer ") 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://api.awork.com/api/v1/roles/users") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["aw-internal-request"] = 'true' request["Authorization"] = 'Bearer ' 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://api.awork.com/api/v1/roles/users") .header("aw-internal-request", "true") .header("Authorization", "Bearer ") .asString(); ``` ```php request('GET', 'https://api.awork.com/api/v1/roles/users', [ 'headers' => [ 'Authorization' => 'Bearer ', 'aw-internal-request' => 'true', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.awork.com/api/v1/roles/users"); var request = new RestRequest(Method.GET); request.AddHeader("aw-internal-request", "true"); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "aw-internal-request": "true", "Authorization": "Bearer " ] let request = NSMutableURLRequest(url: NSURL(string: "https://api.awork.com/api/v1/roles/users")! 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() ```