# List suborganizations by organization
GET https://api-sandbox.payabli.com/api/Query/organizations/{orgId}
Retrieves a list of an organization's suborganizations and their full details such as orgId, users, and settings. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response.
Reference: https://docs.payabli.com/developers/api-reference/organization/get-list-of-organizations-for-entrypoint
## OpenAPI Specification
```yaml
openapi: 3.1.1
info:
title: Get list of organizations for a parent
version: endpoint_query.ListOrganizations
paths:
/Query/organizations/{orgId}:
get:
operationId: list-organizations
summary: Get list of organizations for a parent
description: >-
Retrieves a list of an organization's suborganizations and their full
details such as orgId, users, and settings. Use filters to limit
results. Include the `exportFormat` query parameter to return the
results as a file instead of a JSON response.
tags:
- - subpackage_query
parameters:
- name: orgId
in: path
description: The numeric identifier for organization, assigned by Payabli.
required: true
schema:
type: integer
- name: exportFormat
in: query
required: false
schema:
$ref: '#/components/schemas/type_:ExportFormat'
- 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
**List of field names accepted:**
- `createdAt` (gt, ge, lt, le, eq, ne)
- `startDate` (gt, ge, lt, le, eq, ne)
- `dbaname` (ct, nct)
- `legalname` (ct, nct)
- `ein` (ct, nct)
- `address` (ct, nct)
- `city` (ct, nct)
- `state` (ct, nct)
- `phone` (ct, nct)
- `mcc` (ct, nct)
- `owntype` (ct, nct)
- `ownerName` (ct, nct)
- `contactName` (ct, nct)
- `orgParentname` (ct, nct)
- `boardingId` (eq, ne)
- `entryName` (ct, nct)
**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
- `nin` => not inside array
**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: `dbaname(ct)=hoa` returns all records with a `dbaname`
containing "hoa"
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___queryTypes__:ListOrganizationsResponse
'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_:ExportFormat:
type: string
enum:
- description: Comma-separated values file
value: csv
- description: Excel spreadsheet file
value: xlsx
type_:OrganizationQueryRecordServicesItem:
type: object
properties:
description:
type: string
enabled:
type: boolean
monthlyCost:
type: number
format: double
name:
type: string
reseller:
type: boolean
setupCost:
type: number
format: double
txCost:
type: number
format: double
txPercentCost:
type: number
format: double
type_:Achaccount:
type: string
type_:Achrouting:
type: string
type_:BillingAddressNullable:
type: string
type_:BillingCityNullable:
type: string
type_:BillingCountryNullable:
type: string
type_:BillingStateNullable:
type: string
type_:BillingZip:
type: string
type_:Instrument:
type: object
properties:
achAccount:
$ref: '#/components/schemas/type_:Achaccount'
achRouting:
$ref: '#/components/schemas/type_:Achrouting'
billingAddress:
$ref: '#/components/schemas/type_:BillingAddressNullable'
billingCity:
$ref: '#/components/schemas/type_:BillingCityNullable'
billingCountry:
$ref: '#/components/schemas/type_:BillingCountryNullable'
billingState:
$ref: '#/components/schemas/type_:BillingStateNullable'
billingZip:
$ref: '#/components/schemas/type_:BillingZip'
required:
- achAccount
- achRouting
type_:Email:
type: string
format: email
type_:AdditionalDataString:
type: string
type_:Contacts:
type: object
properties:
contactEmail:
$ref: '#/components/schemas/type_:Email'
description: Contact email address.
contactName:
type: string
description: Contact name.
contactPhone:
type: string
description: Contact phone number.
contactTitle:
type: string
description: Contact title.
additionalData:
$ref: '#/components/schemas/type_:AdditionalDataString'
type_:ContactsField:
type: array
items:
$ref: '#/components/schemas/type_:Contacts'
type_:CreatedAt:
type: string
format: date-time
type_:Orgid:
type: integer
format: int64
type_:IsRoot:
type: boolean
type_:Orgaddress:
type: string
type_:Orgcity:
type: string
type_:Orgcountry:
type: string
type_:Orgentryname:
type: string
type_:Orgidstring:
type: string
type_:FileContentFtype:
type: string
enum:
- value: pdf
- value: doc
- value: docx
- value: jpg
- value: jpeg
- value: png
- value: gif
- value: txt
type_:FileContent:
type: object
properties:
fContent:
type: string
description: >-
Content of file, Base64-encoded. Ignored if furl is specified. Max
upload size is 30 MB.
filename:
type: string
description: The name of the attached file.
ftype:
$ref: '#/components/schemas/type_:FileContentFtype'
description: The MIME type of the file (if content is provided)
furl:
type: string
description: Optional URL provided to show or download the file remotely
type_:Orgname:
type: string
type_:OrgParentId:
type: integer
format: int64
type_:OrgParentName:
type: string
type_:Orgstate:
type: string
type_:Orgtimezone:
type: integer
type_:Orgtype:
type: integer
type_:Orgwebsite:
type: string
type_:Orgzip:
type: string
type_:RecipientEmailNotification:
type: boolean
type_:ReplyToEmail:
type: string
format: email
type_:Resumable:
type: boolean
type_:SummaryOrg:
type: object
properties:
amountSubs:
type: number
format: double
amountTx:
type: number
format: double
childOrgs:
type: integer
childPaypoints:
type: integer
countSubs:
type: integer
countTx:
type: integer
type_:UsrAccess:
type: object
properties:
roleLabel:
type: string
roleValue:
type: boolean
type_:Language:
type: string
type_:NameUser:
type: string
type_:PhoneNumber:
type: string
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_:OrganizationQueryRecord:
type: object
properties:
services:
type: array
items:
$ref: '#/components/schemas/type_:OrganizationQueryRecordServicesItem'
billingInfo:
$ref: '#/components/schemas/type_:Instrument'
contacts:
$ref: '#/components/schemas/type_:ContactsField'
createdAt:
$ref: '#/components/schemas/type_:CreatedAt'
hasBilling:
type: boolean
hasResidual:
type: boolean
idOrg:
$ref: '#/components/schemas/type_:Orgid'
isRoot:
$ref: '#/components/schemas/type_:IsRoot'
orgAddress:
$ref: '#/components/schemas/type_:Orgaddress'
orgCity:
$ref: '#/components/schemas/type_:Orgcity'
orgCountry:
$ref: '#/components/schemas/type_:Orgcountry'
orgEntryName:
$ref: '#/components/schemas/type_:Orgentryname'
orgId:
$ref: '#/components/schemas/type_:Orgidstring'
orgLogo:
$ref: '#/components/schemas/type_:FileContent'
orgName:
$ref: '#/components/schemas/type_:Orgname'
orgParentId:
$ref: '#/components/schemas/type_:OrgParentId'
orgParentName:
$ref: '#/components/schemas/type_:OrgParentName'
orgState:
$ref: '#/components/schemas/type_:Orgstate'
orgTimezone:
$ref: '#/components/schemas/type_:Orgtimezone'
orgType:
$ref: '#/components/schemas/type_:Orgtype'
orgWebsite:
$ref: '#/components/schemas/type_:Orgwebsite'
orgZip:
$ref: '#/components/schemas/type_:Orgzip'
recipientEmailNotification:
$ref: '#/components/schemas/type_:RecipientEmailNotification'
replyToEmail:
$ref: '#/components/schemas/type_:ReplyToEmail'
resumable:
$ref: '#/components/schemas/type_:Resumable'
summary:
$ref: '#/components/schemas/type_:SummaryOrg'
users:
type: array
items:
$ref: '#/components/schemas/type_:UserQueryRecord'
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___queryTypes__:ListOrganizationsResponse:
type: object
properties:
Records:
type: array
items:
$ref: '#/components/schemas/type_:OrganizationQueryRecord'
Summary:
$ref: '#/components/schemas/type_:QuerySummary'
required:
- Records
- Summary
```
## 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.listOrganizations(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_organizations(
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.ListOrganizationsAsync(
123,
new ListOrganizationsRequest {
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.ListOrganizationsRequest{
FromRecord: payabli.Int(
251,
),
LimitRecord: payabli.Int(
0,
),
SortBy: payabli.String(
"desc(field_name)",
),
}
client.Query.ListOrganizations(
context.TODO(),
123,
request,
)
}
```
```ruby
require 'uri'
require 'net/http'
url = URI("https://api-sandbox.payabli.com/api/Query/organizations/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/organizations/123?fromRecord=251&limitRecord=0&sortBy=desc%28field_name%29")
.header("requestToken", "")
.asString();
```
```php
request('GET', 'https://api-sandbox.payabli.com/api/Query/organizations/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/organizations/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()
```