# List batches for org GET https://api-sandbox.payabli.com/api/Query/batches/org/{orgId} Retrieve a list of batches for an org. 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/query/get-list-of-batches-for-an-organization ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Get list of batches for an organization version: endpoint_query.ListBatchesOrg paths: /Query/batches/org/{orgId}: get: operationId: list-batches-org summary: Get list of batches for an organization description: >- Retrieve a list of batches for an org. 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 See [Filters and Conditions Reference](/developers/developer-guides/pay-ops-reporting-engine-overview#filters-and-conditions-reference) for more information. **List of field names accepted:** - `batchDate` (gt, ge, lt, le, eq, ne) - `batchNumber` (ne, eq) - `method` (in, nin, eq, ne) - `connectorName` (ne, eq, ct, nct) - `batchAmount` (gt, ge, lt, le, eq, ne) - `feeBatchAmount` (gt, ge, lt, le, eq, ne) - `netBatchAmount` (gt, ge, lt, le, eq, ne) - `releaseAmount` (gt, ge, lt, le, eq, ne) - `heldAmount` (gt, ge, lt, le, eq, ne) - `status` (in, nin, eq, ne) - `paypointLegal` (ne, eq, ct, nct) - `paypointDba` (ne, eq, ct, nct) - `orgName` (ne, eq, ct, nct) - `paypointId` (ne, eq) - `externalPaypointID` (ct, nct, eq, ne) - `expectedDepositDate` (gt, ge, lt, le, eq, ne) - `depositDate` (gt, ge, lt, le, eq, ne) - `batchRecords` (gt, ge, lt, le, eq, ne) - `transferId` (ne, eq) - `transferDate` (gt, ge, lt, le, eq, ne) - `grossAmount` (gt, ge, lt, le, eq, ne) - `chargeBackAmount` (gt, ge, lt, le, eq, ne) - `returnedAmount` (gt, ge, lt, le, eq, ne) - `billingFeeAmount` (gt, ge, lt, le, eq, ne) - `thirdPartyPaidAmount` (gt, ge, lt, le, eq, ne) - `netFundedAmount` (gt, ge, lt, le, eq, ne) - `adjustmentAmount` (gt, ge, lt, le, eq, ne) - `processor` (ne, eq, ct, nct) - `transferStatus` (ne, eq, in, nin) **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: `batchAmount(gt)=20` returns all records with a `batchAmount` greater than 20.00 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__:QueryBatchesResponse' '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_:BatchNumber: type: string type_:TransferIdentifier: type: string type_:Source: type: string type_:GeneralEvents: type: object properties: description: type: string description: Event description. eventTime: type: string format: date-time description: Event timestamp, in UTC. extraData: type: object additionalProperties: description: Any type description: Extra data. refData: type: string description: Reference data. source: $ref: '#/components/schemas/type_:Source' description: The event source. type_:PaypointId: type: integer format: int64 type_:PaypointName: type: string type_:Dbaname: type: string type_:OrgParentName: type: string type_:ExternalPaypointId: type: string type_:Entrypointfield: type: string type_:ExpectedDepositDate: type: string format: date-time type_:DepositDate: type: string format: date-time type___queryTypes__:QueryBatchesTransfer: type: object properties: TransferId: type: - integer - 'null' description: The transfer ID. TransferDate: type: - string - 'null' format: date-time description: The transfer date. Processor: type: - string - 'null' description: The processor used for the transfer. TransferStatus: type: - integer - 'null' description: The transfer status. GrossAmount: type: - number - 'null' format: double description: The gross amount of the transfer. ChargeBackAmount: type: - number - 'null' format: double description: The chargeback amount. ReturnedAmount: type: - number - 'null' format: double description: The returned amount. RefundAmount: type: - number - 'null' format: double description: The refund amount. HoldAmount: type: - number - 'null' format: double description: The amount being held. ReleasedAmount: type: - number - 'null' format: double description: The amount that has been released. BillingFeesAmount: type: - number - 'null' format: double description: The billing fees amount. ThirdPartyPaidAmount: type: - number - 'null' format: double description: The third party paid amount. AdjustmentsAmount: type: - number - 'null' format: double description: The adjustments amount. NetFundedAmount: type: - number - 'null' format: double description: The net funded amount. required: - TransferId - TransferDate - Processor - TransferStatus - GrossAmount - ChargeBackAmount - ReturnedAmount - RefundAmount - HoldAmount - ReleasedAmount - BillingFeesAmount - ThirdPartyPaidAmount - AdjustmentsAmount - NetFundedAmount type___queryTypes__:QueryBatchesResponseRecordsItem: type: object properties: IdBatch: type: - integer - 'null' description: The batch ID. BatchNumber: oneOf: - $ref: '#/components/schemas/type_:BatchNumber' - type: 'null' TransferIdentifier: oneOf: - $ref: '#/components/schemas/type_:TransferIdentifier' - type: 'null' EventsData: type: - array - 'null' items: $ref: '#/components/schemas/type_:GeneralEvents' description: Events associated with the batch. ConnectorName: type: - string - 'null' BatchDate: type: - string - 'null' format: date-time description: The batch date. BatchAmount: type: - number - 'null' format: double description: The amount of the batch. BatchFeesAmount: type: - number - 'null' format: double description: The total of fees in the batch. BatchAuthAmount: type: - number - 'null' format: double BatchReleasedAmount: type: - number - 'null' format: double description: Previously held funds that have been released after a risk review. BatchHoldAmount: type: - number - 'null' format: double description: >- The total amount of the batch that's being held for fraud or risk concerns. BatchReturnedAmount: type: - number - 'null' format: double description: Total amount of ACH returns deducted from batch. BatchRefundAmount: type: - number - 'null' format: double description: The total amount of refunds deducted from batch. BatchSplitAmount: type: - number - 'null' format: double description: >- Total of split transactions that included split funding instructions at the time of authorization. BatchStatus: type: integer description: >- The batch status. See [Batch Status](/developers/references/money-in-statuses#batch-status) for more. BatchRecords: type: integer description: The number of records in the batch. PaypointId: oneOf: - $ref: '#/components/schemas/type_:PaypointId' - type: 'null' PaypointName: oneOf: - $ref: '#/components/schemas/type_:PaypointName' - type: 'null' PaypointDba: oneOf: - $ref: '#/components/schemas/type_:Dbaname' - type: 'null' ParentOrgName: $ref: '#/components/schemas/type_:OrgParentName' description: The entrypoint's parent org. ParentOrgId: type: integer description: The parent organization ID. externalPaypointID: oneOf: - $ref: '#/components/schemas/type_:ExternalPaypointId' - type: 'null' EntryName: $ref: '#/components/schemas/type_:Entrypointfield' BankName: type: - string - 'null' description: The bank name. BatchType: type: - integer - 'null' description: The batch type. Method: type: - string - 'null' description: The payment method used. ExpectedDepositDate: oneOf: - $ref: '#/components/schemas/type_:ExpectedDepositDate' - type: 'null' DepositDate: oneOf: - $ref: '#/components/schemas/type_:DepositDate' - type: 'null' TransferDate: type: - string - 'null' format: date-time description: The batch transfer date. Transfer: oneOf: - $ref: '#/components/schemas/type___queryTypes__:QueryBatchesTransfer' - type: 'null' description: Transfer details for the batch. required: - IdBatch - BatchNumber - TransferIdentifier - EventsData - ConnectorName - BatchDate - BatchAmount - BatchFeesAmount - BatchAuthAmount - BatchReleasedAmount - BatchHoldAmount - BatchReturnedAmount - BatchRefundAmount - BatchSplitAmount - BatchStatus - BatchRecords - PaypointId - PaypointName - PaypointDba - ParentOrgName - ParentOrgId - externalPaypointID - EntryName - BankName - BatchType - Method - ExpectedDepositDate - DepositDate - TransferDate - Transfer type_:PageIdentifier: type: string type_:BatchSummary: type: object properties: pageidentifier: $ref: '#/components/schemas/type_:PageIdentifier' pageSize: type: integer description: Number of records on each response page. totalAmount: type: number format: double description: Total amount for the records. totalNetAmount: type: number format: double description: Total net amount for the records. totalPages: type: integer description: Total number of pages in response. totalRecords: type: integer description: Total number of records in response. type___queryTypes__:QueryBatchesResponse: type: object properties: Records: type: array items: $ref: >- #/components/schemas/type___queryTypes__:QueryBatchesResponseRecordsItem Summary: $ref: '#/components/schemas/type_:BatchSummary' required: - Records - Summary ``` ## SDK Code Examples ```typescript Example Response 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.listBatchesOrg(123, { fromRecord: 251, limitRecord: 0, sortBy: "desc(field_name)", }); } main(); ``` ```python Example Response from payabli import payabli from payabli.environment import payabliEnvironment client = payabli( environment=payabliEnvironment.SANDBOX, api_key="YOUR_API_KEY_HERE" ) client.query.list_batches_org( org_id=123, from_record=251, limit_record=0, sort_by="desc(field_name)" ) ``` ```csharp Example Response using PayabliPayabliApi; using System.Threading.Tasks; namespace Usage; public class Example { public async Task Do() { var client = new PayabliPayabliApiClient( apiKey: "YOUR_API_KEY_HERE", clientOptions: new ClientOptions { BaseUrl = PayabliPayabliApiEnvironment.Sandbox } ); await client.Query.ListBatchesOrgAsync( 123, new ListBatchesOrgRequest { FromRecord = 251, LimitRecord = 0, SortBy = "desc(field_name)" } ); } } ``` ```go Example Response package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api-sandbox.payabli.com/api/Query/batches/org/123?fromRecord=251&limitRecord=0&sortBy=desc%28field_name%29" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("requestToken", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Example Response require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/Query/batches/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 Example Response import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api-sandbox.payabli.com/api/Query/batches/org/123?fromRecord=251&limitRecord=0&sortBy=desc%28field_name%29") .header("requestToken", "") .asString(); ``` ```php Example Response request('GET', 'https://api-sandbox.payabli.com/api/Query/batches/org/123?fromRecord=251&limitRecord=0&sortBy=desc%28field_name%29', [ 'headers' => [ 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift Example Response import Foundation let headers = ["requestToken": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Query/batches/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() ```