# List users by org GET https://api-sandbox.payabli.com/api/Query/users/org/{orgId} Get list of users for an org. Use filters to limit results. Reference: https://docs.payabli.com/developers/api-reference/user/get-list-of-users-for-an-org ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Get list of users for an org version: endpoint_query.ListUsersOrg paths: /Query/users/org/{orgId}: get: operationId: list-users-org summary: Get list of users for an org description: Get list of users for an org. Use filters to limit results. tags: - - subpackage_query parameters: - name: orgId in: path description: The numeric identifier for organization, assigned by Payabli. required: true schema: type: integer - name: fromRecord in: query description: >- The number of records to skip before starting to collect the result set. required: false schema: type: integer default: 0 - name: limitRecord in: query description: >- Max number of records to return for the query. Use `0` or negative value to return all records. required: false schema: type: integer default: 20 - name: parameters in: query description: >- Collection of field names, conditions, and values used to filter the query. **You must remove `parameters=` from the request before you send it, otherwise Payabli will ignore the filters.** Because of a technical limitation, you can't make a request that includes filters from the API console on this page. The response won't be filtered. Instead, copy the request, remove `parameters=` and run the request in a different client. For example: --url https://api-sandbox.payabli.com/api/Query/transactions/org/236?parameters=totalAmount(gt)=1000&limitRecord=20 should become: --url https://api-sandbox.payabli.com/api/Query/transactions/org/236?totalAmount(gt)=1000&limitRecord=20 See [Filters and Conditions Reference](/developers/developer-guides/pay-ops-reporting-engine-overview#filters-and-conditions-reference) for help. **List of field names accepted:** - `createdDate` (gt, ge, lt, le, eq, ne) - `name` (ne, eq, ct, nct) - `email` (ne, eq, ct, nct) - `status` (in, nin, eq, ne) - `role.xxx` (ne, eq, ct, nct) where xxx is the role field: `roleLabel` or `roleValue` **List of comparison accepted - enclosed between parentheses:** - `eq` or empty => equal - `gt` => greater than - `ge` => greater or equal - `lt` => less than - `le` => less or equal - `ne` => not equal - `ct` => contains - `nct` => not contains - `in` => inside array separated by "|" - `nin` => not inside array separated by "|" **List of parameters accepted:** - `limitRecord`: max number of records for query (default="20", "0" or negative value for all) - `fromRecord`: initial record in query Example: `name(ct)=john` return all records with name containing 'john'. required: false schema: type: object additionalProperties: type: string - name: sortBy in: query description: >- The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. required: false schema: type: string - name: requestToken in: header required: true schema: type: string responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/type_:QueryUserResponse' '400': description: Bad request/ invalid data content: {} '401': description: Unauthorized request. content: {} '500': description: Internal API Error content: {} '503': description: Database connection error content: {} components: schemas: type_:UsrAccess: type: object properties: roleLabel: type: string roleValue: type: boolean type_:AdditionalDataString: type: string type_:CreatedAt: type: string format: date-time type_:Email: type: string format: email type_:Language: type: string type_:NameUser: type: string type_:PhoneNumber: type: string type_:Orgentryname: type: string type_:Orgid: type: integer format: int64 type_:Orgtype: type: integer type_:OrgXScope: type: object properties: orgEntry: $ref: '#/components/schemas/type_:Orgentryname' orgId: $ref: '#/components/schemas/type_:Orgid' orgType: $ref: '#/components/schemas/type_:Orgtype' type_:Timezone: type: integer type_:Mfa: type: boolean type_:MfaMode: type: integer type_:UsrStatus: type: integer type_:UserQueryRecord: type: object properties: Access: type: array items: $ref: '#/components/schemas/type_:UsrAccess' AdditionalData: $ref: '#/components/schemas/type_:AdditionalDataString' createdAt: $ref: '#/components/schemas/type_:CreatedAt' description: The timestamp for the user's creation, in UTC. Email: $ref: '#/components/schemas/type_:Email' description: The user's email address. language: $ref: '#/components/schemas/type_:Language' lastAccess: type: string format: date-time description: The timestamp for the user's last activity, in UTC. Name: $ref: '#/components/schemas/type_:NameUser' Phone: $ref: '#/components/schemas/type_:PhoneNumber' description: The user's phone number. Scope: type: array items: $ref: '#/components/schemas/type_:OrgXScope' snData: type: string description: >- Additional data provided by the social network related to the customer. snIdentifier: type: string description: Identifier or token for customer in linked social network. snProvider: type: string description: >- Social network linked to customer. Possible values: facebook, google, twitter, microsoft. timeZone: $ref: '#/components/schemas/type_:Timezone' userId: type: integer format: int64 description: The user's ID in Payabli. UsrMFA: $ref: '#/components/schemas/type_:Mfa' UsrMFAMode: $ref: '#/components/schemas/type_:MfaMode' UsrStatus: $ref: '#/components/schemas/type_:UsrStatus' type_:PageIdentifier: type: string type_:Pagesize: type: integer type_:Totalrecords: type: integer type_:QuerySummary: type: object properties: pageIdentifier: $ref: '#/components/schemas/type_:PageIdentifier' pageSize: $ref: '#/components/schemas/type_:Pagesize' totalAmount: type: number format: double description: Total amount for the records. totalNetAmount: type: number format: double description: Total net amount for the records. totalPages: $ref: '#/components/schemas/type_:Totalrecords' totalRecords: $ref: '#/components/schemas/type_:Totalrecords' type_:QueryUserResponse: type: object properties: Records: type: array items: $ref: '#/components/schemas/type_:UserQueryRecord' Summary: $ref: '#/components/schemas/type_:QuerySummary' ``` ## SDK Code Examples ```typescript import { PayabliClient, PayabliEnvironment } from "@payabli/sdk-node"; async function main() { const client = new PayabliClient({ environment: PayabliEnvironment.Sandbox, apiKey: "YOUR_API_KEY_HERE", }); await client.query.listUsersOrg(123, { fromRecord: 251, limitRecord: 0, sortBy: "desc(field_name)", }); } main(); ``` ```python from payabli import payabli from payabli.environment import payabliEnvironment client = payabli( environment=payabliEnvironment.SANDBOX, api_key="YOUR_API_KEY_HERE" ) client.query.list_users_org( org_id=123, from_record=251, limit_record=0, sort_by="desc(field_name)" ) ``` ```csharp using PayabliApi; using System.Threading.Tasks; namespace Usage; public class Example { public async Task Do() { var client = new PayabliApiClient( apiKey: "YOUR_API_KEY_HERE", clientOptions: new ClientOptions { BaseUrl = PayabliApiEnvironment.Sandbox } ); await client.Query.ListUsersOrgAsync( 123, new ListUsersOrgRequest { FromRecord = 251, LimitRecord = 0, SortBy = "desc(field_name)" } ); } } ``` ```go package example import ( client "github.com/payabli/sdk-go/v/client" option "github.com/payabli/sdk-go/v/option" payabli "github.com/payabli/sdk-go/v" context "context" ) func do() { client := client.NewClient( option.WithBaseURL( payabli.Environments.Sandbox, ), option.WithApiKey( "YOUR_API_KEY_HERE", ), ) request := &payabli.ListUsersOrgRequest{ FromRecord: payabli.Int( 251, ), LimitRecord: payabli.Int( 0, ), SortBy: payabli.String( "desc(field_name)", ), } client.Query.ListUsersOrg( context.TODO(), 123, request, ) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/Query/users/org/123?fromRecord=251&limitRecord=0&sortBy=desc%28field_name%29") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["requestToken"] = '' 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-sandbox.payabli.com/api/Query/users/org/123?fromRecord=251&limitRecord=0&sortBy=desc%28field_name%29") .header("requestToken", "") .asString(); ``` ```php request('GET', 'https://api-sandbox.payabli.com/api/Query/users/org/123?fromRecord=251&limitRecord=0&sortBy=desc%28field_name%29', [ 'headers' => [ 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift import Foundation let headers = ["requestToken": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Query/users/org/123?fromRecord=251&limitRecord=0&sortBy=desc%28field_name%29")! 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() ```