# List invoices by organization GET https://api-sandbox.payabli.com/api/Query/invoices/org/{orgId} Returns a list of invoices 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/invoice/get-list-of-invoices-for-an-organization ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Get list of invoices for an organization version: endpoint_invoice.ListInvoicesOrg paths: /Query/invoices/org/{orgId}: get: operationId: list-invoices-org summary: Get list of invoices for an organization description: >- Returns a list of invoices 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_invoice 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 See [Filters and Conditions Reference](/developers/developer-guides/pay-ops-reporting-engine-overview#filters-and-conditions-reference) for help. List of field names accepted: - `invoiceDate` (gt, ge, lt, le, eq, ne) - `dueDate` (gt, ge, lt, le, eq, ne) - `sentDate` (gt, ge, lt, le, eq, ne) - `frequency` (in, nin,ne, eq) - `invoiceType` (eq, ne) - `payTerms` (in, nin, eq, ne) - `paypointId` (ne, eq) - `totalAmount` (gt, ge, lt, le, eq, ne) - `paidAmount` (gt, ge, lt, le, eq, ne) - `status` (in, nin, eq, ne) - `invoiceNumber` (ct, nct, eq, ne) - `purchaseOrder` (ct, nct, eq, ne) - `itemProductCode` (ct, nct) - `itemDescription` (ct, nct) - `customerFirstname` (ct, nct, eq, ne) - `customerLastname` (ct, nct, eq, ne) - `customerName` (ct, nct) - `customerId` (eq, ne) - `customerNumber` (ct, nct, eq, ne) - `customerCompanyname` (ct, nct, eq, ne) - `customerAddress` (ct, nct, eq, ne) - `customerCity` (ct, nct, eq, ne) - `customerZip` (ct, nct, eq, ne) - `customerState` (ct, nct, eq, ne) - `customerCountry` (ct, nct, eq, ne) - `customerPhone` (ct, nct, eq, ne) - `customerEmail` (ct, nct, eq, ne) - `customerShippingAddress` (ct, nct, eq, ne) - `customerShippingCity` (ct, nct, eq, ne) - `customerShippingZip` (ct, nct, eq, ne) - `customerShippingState` (ct, nct, eq, ne) - `customerShippingCountry` (ct, nct, eq, ne) - `orgId` (eq) - `paylinkId` (ne, eq) - `paypointLegal` (ne, eq, ct, nct) - `paypointDba` (ne, eq, ct, nct) - `orgName` (ne, eq, ct, nct) - `additional-xxx` (ne, eq, ct, nct) where xxx is the additional field name 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: totalAmount(gt)=20 return all records with totalAmount 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. Fields marked optional may return `null` if not set. content: application/json: schema: $ref: '#/components/schemas/type_invoice:QueryInvoiceResponse' '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_invoice:InvoiceId: type: integer format: int64 type_:CustomerId: type: integer format: int64 type_:PaypointId: type: integer format: int64 type_:InvoiceNumber: type: string type_:Datenullable: type: string format: date type_:DatetimeNullable: type: string format: date-time type_:CreatedAt: type: string format: date-time type_:Invoicestatus: type: integer type_:InvoiceType: type: integer type_:Frequency: type: string enum: - value: onetime - value: weekly - value: every2weeks - value: every6months - value: monthly - value: every3months - value: annually type_:Terms: type: string type_:TermsConditions: type: string type_:Tax: type: number format: double type_:Discount: type: number format: double type_:InvoiceAmount: type: number format: double type_invoice:InvoicePaidAmount: type: number format: double type_:FreightAmount: type: number format: double type_:DutyAmount: type: number format: double type_:PurchaseOrder: type: string type_:Shippingaddress: type: string type_:Shippingaddressadditional: type: string type_:Shippingcity: type: string type_:Shippingstate: type: string type_:Shippingzip: type: string type_:ShippingFromZip: type: string type_:Shippingcountry: type: string type_:Email: type: string format: email type_:SummaryCommodityCode: type: string type_:ItemCommodityCode: type: string type_:ItemDescription: type: string type_:ItemProductCode: type: string type_:ItemProductName: type: string type_:ItemUnitofMeasure: type: string type_:BillItem: type: object properties: itemCategories: type: array items: type: string description: Array of tags classifying item or product. itemCommodityCode: $ref: '#/components/schemas/type_:ItemCommodityCode' itemCost: type: number format: double description: Item or product price per unit. itemDescription: $ref: '#/components/schemas/type_:ItemDescription' itemMode: type: integer description: >- Internal class of item or product: value '0' is only for invoices , '1' for bills and, '2' common for both. itemProductCode: $ref: '#/components/schemas/type_:ItemProductCode' itemProductName: $ref: '#/components/schemas/type_:ItemProductName' itemQty: type: integer description: Quantity of item or product. itemTaxAmount: type: number format: double description: Tax amount applied to item or product. itemTaxRate: type: number format: double description: Tax rate applied to item or product. itemTotalAmount: type: number format: double description: Total amount in item or product. itemUnitOfMeasure: $ref: '#/components/schemas/type_:ItemUnitofMeasure' required: - itemCost type_:AdditionalDataMap: type: object additionalProperties: type: string type_:BillingAddressNullable: type: string type_:BillingAddressAddtlNullable: type: string type_:BillingCityNullable: type: string type_:BillingCountryNullable: type: string type_:PhoneNumber: type: string type_:BillingStateNullable: type: string type_:BillingZip: type: string type_:CustomerNumberNullable: type: string type_:CustomerStatus: type: integer type_:Identifierfields: type: array items: type: string type_:PayorDataResponse: type: object properties: AdditionalData: oneOf: - $ref: '#/components/schemas/type_:AdditionalDataMap' - type: 'null' BillingAddress1: oneOf: - $ref: '#/components/schemas/type_:BillingAddressNullable' - type: 'null' BillingAddress2: oneOf: - $ref: '#/components/schemas/type_:BillingAddressAddtlNullable' - type: 'null' BillingCity: oneOf: - $ref: '#/components/schemas/type_:BillingCityNullable' - type: 'null' BillingCountry: oneOf: - $ref: '#/components/schemas/type_:BillingCountryNullable' - type: 'null' BillingEmail: oneOf: - $ref: '#/components/schemas/type_:Email' - type: 'null' BillingPhone: oneOf: - $ref: '#/components/schemas/type_:PhoneNumber' - type: 'null' BillingState: oneOf: - $ref: '#/components/schemas/type_:BillingStateNullable' - type: 'null' BillingZip: oneOf: - $ref: '#/components/schemas/type_:BillingZip' - type: 'null' description: >- Customer's billing ZIP code. For Pay In functions, this field supports 5-digit and 9-digit ZIP codes and alphanumeric Canadian postal codes. For example: "37615-1234" or "37615". CompanyName: type: - string - 'null' description: Customer's company name. customerId: oneOf: - $ref: '#/components/schemas/type_:CustomerId' - type: 'null' CustomerNumber: oneOf: - $ref: '#/components/schemas/type_:CustomerNumberNullable' - type: 'null' customerStatus: oneOf: - $ref: '#/components/schemas/type_:CustomerStatus' - type: 'null' description: >- Customer status. This is used to determine if the customer is active or inactive. FirstName: type: - string - 'null' description: Customer/Payor first name. Identifiers: oneOf: - $ref: '#/components/schemas/type_:Identifierfields' - type: 'null' LastName: type: - string - 'null' description: Customer/Payor last name. ShippingAddress1: oneOf: - $ref: '#/components/schemas/type_:Shippingaddress' - type: 'null' ShippingAddress2: oneOf: - $ref: '#/components/schemas/type_:Shippingaddressadditional' - type: 'null' ShippingCity: oneOf: - $ref: '#/components/schemas/type_:Shippingcity' - type: 'null' ShippingCountry: oneOf: - $ref: '#/components/schemas/type_:Shippingcountry' - type: 'null' ShippingState: oneOf: - $ref: '#/components/schemas/type_:Shippingstate' - type: 'null' ShippingZip: oneOf: - $ref: '#/components/schemas/type_:Shippingzip' - type: 'null' required: - AdditionalData - BillingAddress1 - BillingAddress2 - BillingCity - BillingCountry - BillingEmail - BillingPhone - BillingState - BillingZip - CompanyName - customerId - CustomerNumber - customerStatus - FirstName - Identifiers - LastName - ShippingAddress1 - ShippingAddress2 - ShippingCity - ShippingCountry - ShippingState - ShippingZip 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_:BillEvents: type: array items: $ref: '#/components/schemas/type_:GeneralEvents' type_:BillOptions: type: object properties: includePaylink: type: boolean description: Flag to indicate if the scheduled invoice includes a payment link. includePdf: type: boolean description: >- Flag to indicate if the scheduled invoice includes a PDF version of invoice type_:Legalname: type: string type_:Dbaname: type: string type_:Entrypointfield: type: string type_:Orgid: type: integer format: int64 type_:OrgParentName: type: string type_:PairFiles: type: object properties: originalName: type: string description: Original filename zipName: type: string description: >- Filename assigned to zipped file. This is the name to use for reference in the API functions to get files in attachments. descriptor: type: string description: Descriptor of the file. type_:DocumentsRef: type: object properties: filelist: type: array items: $ref: '#/components/schemas/type_:PairFiles' description: Array of objects describing files contained in the ZIP file. zipfile: type: string description: Zip file containing attachments. type_:ExternalPaypointId: type: string type_:PageIdentifier: type: string type_invoice:QueryInvoiceResponseRecordsItem: type: object properties: invoiceId: $ref: '#/components/schemas/type_invoice:InvoiceId' customerId: $ref: '#/components/schemas/type_:CustomerId' paypointId: $ref: '#/components/schemas/type_:PaypointId' invoiceNumber: $ref: '#/components/schemas/type_:InvoiceNumber' invoiceDate: $ref: '#/components/schemas/type_:Datenullable' description: 'Invoice date in any of the accepted formats: YYYY-MM-DD, MM/DD/YYYY.' invoiceDueDate: $ref: '#/components/schemas/type_:Datenullable' description: >- Invoice due date in any of the accepted formats: YYYY-MM-DD, MM/DD/YYYY. invoiceSentDate: $ref: '#/components/schemas/type_:Datenullable' description: >- Invoice sent date in any of the accepted formats: YYYY-MM-DD, MM/DD/YYYY. invoiceEndDate: $ref: '#/components/schemas/type_:Datenullable' description: The end date for a scheduled invoice cycle (`invoiceType` = 1). lastPaymentDate: $ref: '#/components/schemas/type_:DatetimeNullable' description: Timestamp of last payment. createdAt: $ref: '#/components/schemas/type_:CreatedAt' invoiceStatus: $ref: '#/components/schemas/type_:Invoicestatus' invoiceType: $ref: '#/components/schemas/type_:InvoiceType' frequency: $ref: '#/components/schemas/type_:Frequency' description: Frequency of scheduled invoice. paymentTerms: $ref: '#/components/schemas/type_:Terms' termsConditions: oneOf: - $ref: '#/components/schemas/type_:TermsConditions' - type: 'null' notes: type: - string - 'null' description: Invoice notes. tax: $ref: '#/components/schemas/type_:Tax' discount: $ref: '#/components/schemas/type_:Discount' invoiceAmount: $ref: '#/components/schemas/type_:InvoiceAmount' invoicePaidAmount: $ref: '#/components/schemas/type_invoice:InvoicePaidAmount' freightAmount: $ref: '#/components/schemas/type_:FreightAmount' dutyAmount: $ref: '#/components/schemas/type_:DutyAmount' purchaseOrder: oneOf: - $ref: '#/components/schemas/type_:PurchaseOrder' - type: 'null' firstName: type: string description: First name of the recipient of the invoice. lastName: type: string description: Last name of the recipient of the invoice. company: type: - string - 'null' description: Company name of the recipient of the invoice. shippingAddress1: $ref: '#/components/schemas/type_:Shippingaddress' shippingAddress2: $ref: '#/components/schemas/type_:Shippingaddressadditional' shippingCity: $ref: '#/components/schemas/type_:Shippingcity' shippingState: $ref: '#/components/schemas/type_:Shippingstate' shippingZip: $ref: '#/components/schemas/type_:Shippingzip' shippingFromZip: $ref: '#/components/schemas/type_:ShippingFromZip' shippingCountry: $ref: '#/components/schemas/type_:Shippingcountry' shippingEmail: $ref: '#/components/schemas/type_:Email' description: Shipping recipient's contact email address. shippingPhone: type: string description: Recipient phone number. summaryCommodityCode: oneOf: - $ref: '#/components/schemas/type_:SummaryCommodityCode' - type: 'null' items: type: array items: $ref: '#/components/schemas/type_:BillItem' description: Array of line items included in the invoice. Customer: $ref: '#/components/schemas/type_:PayorDataResponse' paylinkId: type: string billEvents: $ref: '#/components/schemas/type_:BillEvents' scheduledOptions: oneOf: - $ref: '#/components/schemas/type_:BillOptions' - type: 'null' description: Object with options for scheduled invoices. PaypointLegalname: $ref: '#/components/schemas/type_:Legalname' description: Paypoint's legal name. PaypointDbaname: $ref: '#/components/schemas/type_:Dbaname' description: Paypoint's DBA name. PaypointEntryname: $ref: '#/components/schemas/type_:Entrypointfield' description: Paypoint's entryname. ParentOrgId: $ref: '#/components/schemas/type_:Orgid' ParentOrgName: $ref: '#/components/schemas/type_:OrgParentName' AdditionalData: type: - object - 'null' additionalProperties: description: Any type description: >- Custom list of key:value pairs. This field is used to store any data related to the invoice or for your system. DocumentsRef: oneOf: - $ref: '#/components/schemas/type_:DocumentsRef' - type: 'null' description: Object containing attachments associated to the invoice. externalPaypointID: $ref: '#/components/schemas/type_:ExternalPaypointId' pageIdentifier: oneOf: - $ref: '#/components/schemas/type_:PageIdentifier' - type: 'null' required: - invoiceId - customerId - paypointId - invoiceNumber - invoiceDate - invoiceDueDate - invoiceSentDate - invoiceEndDate - createdAt - invoiceStatus - invoiceType - frequency - paymentTerms - termsConditions - notes - tax - discount - invoiceAmount - invoicePaidAmount - freightAmount - dutyAmount - purchaseOrder - firstName - lastName - company - shippingAddress1 - shippingAddress2 - shippingCity - shippingState - shippingZip - shippingFromZip - shippingCountry - shippingEmail - shippingPhone - summaryCommodityCode - items - Customer - paylinkId - billEvents - scheduledOptions - PaypointLegalname - PaypointDbaname - PaypointEntryname - ParentOrgId - ParentOrgName - AdditionalData - DocumentsRef - externalPaypointID - pageIdentifier 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_invoice:QueryInvoiceResponse: type: object properties: Records: type: array items: $ref: '#/components/schemas/type_invoice:QueryInvoiceResponseRecordsItem' Summary: $ref: '#/components/schemas/type_:QuerySummary' required: - Records - Summary ``` ## SDK Code Examples ```typescript Example response for invoice queries. import { PayabliClient, PayabliEnvironment } from "@payabli/sdk-node"; async function main() { const client = new PayabliClient({ environment: PayabliEnvironment.Sandbox, apiKey: "YOUR_API_KEY_HERE", }); await client.invoice.listInvoicesOrg(123, { fromRecord: 251, limitRecord: 0, sortBy: "desc(field_name)", }); } main(); ``` ```python Example response for invoice queries. from payabli import payabli from payabli.environment import payabliEnvironment client = payabli( environment=payabliEnvironment.SANDBOX, api_key="YOUR_API_KEY_HERE" ) client.invoice.list_invoices_org( org_id=123, from_record=251, limit_record=0, sort_by="desc(field_name)" ) ``` ```csharp Example response for invoice queries. 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.Invoice.ListInvoicesOrgAsync( 123, new ListInvoicesOrgRequest { FromRecord = 251, LimitRecord = 0, SortBy = "desc(field_name)" } ); } } ``` ```go Example response for invoice queries. 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.ListInvoicesOrgRequest{ FromRecord: payabli.Int( 251, ), LimitRecord: payabli.Int( 0, ), SortBy: payabli.String( "desc(field_name)", ), } client.Invoice.ListInvoicesOrg( context.TODO(), 123, request, ) } ``` ```ruby Example response for invoice queries. require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/Query/invoices/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 for invoice queries. import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api-sandbox.payabli.com/api/Query/invoices/org/123?fromRecord=251&limitRecord=0&sortBy=desc%28field_name%29") .header("requestToken", "") .asString(); ``` ```php Example response for invoice queries. request('GET', 'https://api-sandbox.payabli.com/api/Query/invoices/org/123?fromRecord=251&limitRecord=0&sortBy=desc%28field_name%29', [ 'headers' => [ 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift Example response for invoice queries. import Foundation let headers = ["requestToken": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Query/invoices/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() ```