--- title: "Retrieving a List of Transactions" slug: "retrieving-a-list-of-transactions" updated: 2025-07-31T17:53:58Z published: 2025-07-31T17:53:58Z canonical: "docs.onespan.com/retrieving-a-list-of-transactions" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.onespan.com/llms.txt > Use this file to discover all available pages before exploring further. # Retrieving a List of Transactions [Java SDK](/v1/docs/retrieving-a-list-of-transactions#java-sdk) [.NET SDK](/v1/docs/retrieving-a-list-of-transactions#net-sdk) [REST API](/v1/docs/retrieving-a-list-of-transactions#rest-api) [APEX SDK](/v1/docs/retrieving-a-list-of-transactions#apex-sdk) When retrieving a list of transactions note that using DRAFT will return all transactions that are in the Drafts folder. This includes transactions that are in a Draft state, as well as expired and declined transactions. ## Java SDK It is strongly recommended that you use a [Callback Listener](/v1/docs/creating-a-callback-notification-listener) instead of polling for transaction statuses. The use of polling may consume unnecessary resources on both your end, and on the OneSpan Sign service. ### Retrieving Transaction Within Specified Date Ranges To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/retrieve-packages-within-date-range-java-sdk/) site. The first step in retrieving a list of transactions that fall within a specified date range is to define the range of dates. The following code will do this: ```java Date START_DATE = new LocalDateTime(2016, 1, 1, 0, 0).toDate(); //January 01 2016, 00:00 EST Date END_DATE = LocalDateTime.now().toDate(); ``` Then, you can retrieve your transactions within this date range, sorted by status. For example, COMPLETED, DRAFT, ARCHIVED, SENT, and DECLINED). The following code will do this: ```java Page draftPage = eslClient.getPackageService().getUpdatedPackagesWithinDateRange(PackageStatus.DRAFT, new PageRequest(1), START_DATE, END_DATE); ``` ### Retrieving a List of Transactions IDs To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/retrieve-package-ids-only-java-sdk/) site. Retrieving a list of transaction IDs returns a Page object containing a List of Map types, with each Map Type containing the PackageID. The following code will do this: ```java PageRequest pageRequest = new PageRequest(1, 100); Boolean hasNext = false; do {    Page> packages = eslClient.getPackageService().getPackagesFields(PackageStatus.COMPLETED,            pageRequest, Sets.newHashSet("id"));    hasNext = packages.hasNextPage();    pageRequest = pageRequest.next();        List> results = packages.getResults();    for (Map map : results) {        String packageId = map.get("id");        System.out.println(packageId);    }     } while (hasNext); ``` ## .NET SDK It is strongly recommended that you use a [Callback Listener](/v1/docs/creating-a-callback-notification-listener) instead of polling for transaction statuses. The use of polling may consume unnecessary resources on both your end, and on the OneSpan Sign service. ### Retrieving Transaction Within Specified Date Ranges To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/retrieve-packages-within-date-range-net-sdk/) site. The first step in retrieving a list of transactions that fall within a specified date range is to define the range of dates. The following code will do this: ```csharp DateTime START_DATE = DateTime.Now.AddDays(-100); //Retrieve packages for last 100 days DateTime END_DATE = DateTime.Now; ``` Then, you can retrieve your transactions within this date range sorted by status. For example, COMPLETED, DRAFT, ARCHIVED, SENT, and DECLINED). The following code will do this: ```csharp Page draftPage = eslClient.PackageService.GetUpdatedPackagesWithinDateRange(DocumentPackageStatus.DRAFT, new PageRequest(1), START_DATE, END_DATE); ``` ### Retrieving a List of Transactions IDs To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/retrieve-package-ids-only-net-sdk/) site. Retrieving a list of transaction IDs returns a Page object containing a List of Map types, with each Map Type containing the PackageID. The following code will do this: ```csharp            PageRequest pageRequest = new PageRequest(1, 100);            bool hasNext = false;            do            {                Page> packages = eslClient.PackageService.GetPackagesFields(DocumentPackageStatus.COMPLETED,                        pageRequest, new HashSet() { "id" });                hasNext = packages.HasNextPage();                pageRequest = pageRequest.Next;                IList> results = packages.Results;                foreach (var map in results)                {                    String packageId = map["id"];                    Debug.WriteLine(packageId);                }            } while (hasNext); ``` ## REST API It is strongly recommended that you use a [Callback Listener](/v1/docs/creating-a-callback-notification-listener) instead of polling for transaction statuses. The use of polling may consume unnecessary resources on both your end, and on the OneSpan Sign service. ### Retrieving Transaction Within Specified Date Ranges To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/retrieve-packages-within-date-range-rest-api/) site. The first step in retrieving a list of transactions that fall within a specified date range is to define the range of dates. The following code will do this: #### HTTP Request `GET /api/packages?query={status}&startDate={date}&endDate={date}` #### HTTP Headers ```http Accept: application/json Content-Type: application/json Authorization: Basic api_key ``` The JSON objects of each transaction will be returned to you. The following are the possible values for each parameter: #### Response Payload ```json {  "results": [   {      "id": "mC3p1FENigGItiL3Zmojtr64e0Y=","status": "DRAFT",    "description": "",    "language": "en",    ...   },   {...},   {...},   ...   ],  "count": 216 } ``` - query: ARCHIVED, COMPLETED, DRAFT, SENT, EXPIRED, OPTED_OUT, AND DECLINED. - startDate: Used for pagination. - endDate: Used for pagination. (Note: A maximum of 100 transactions can be returned) ### Retrieving a List of Transactions IDs The following code will do this. Note the following: - **fields:** The only available value is "id". #### HTTP Request `GET /api/packages?query={status}&startDate={date}&endDate={date}&fields=id` #### HTTP Headers ```http Accept: application/json Content-Type: application/json Authorization: Basic api_key ``` #### Response Payload ```json {    "results": [        {            "id": "uchWJej65gbJsVaWmibQHGc8_rA="        },        { "id": "jUfE05dJsa6d3A_oYxixt0gf2SI="        },        ...    ],"count": 216 } ``` ## APEX SDK To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/retrieve-packages-within-date-range-apex-sdk/) site. It is strongly recommended that you use a [Callback Listener](/v1/docs/creating-a-callback-notification-listener) instead of polling for transaction statuses. The use of polling may consume unnecessary resources on both your end, and on the OneSpan Sign service. ### Retrieving a List of Transactions You can retrieve a list of transaction by passing a map of query parameters. ```plaintext public List getPackages(Map queryParameters) ``` For example: ```plaintext List < ESignLiveAPIObjects.Package_x > packages = new TestRetrievePackagesWithinDateRanges().getPackages(new Map { 'lastUpdatedStartDate' => '2023-11-01', 'lastUpdatedEndDate' => '2023-11-10', 'from' => '1', 'to' => '100', 'query' => 'SENT' }); ``` **query:** ARCHIVED, COMPLETED, DRAFT, SENT, EXPIRED, OPTED_OUT, AND DECLINED. **from:** Used for pagination. **to:** Used for pagination. (Note: A maximum of 100 packages can be returned) **StartDate:** The date to begin retrieving transactions (for example, 2023-01-01) **EndDate:** The last date transactions are to be retrieved for example, 2023-12-31). **fields:** The only available value is id.