---
updatedAt: 2025-10-05T10:01:24.000Z
agentTools:
  projectIndex: https://developers.tap.company/llms.txt
---

# Download Charges

This endpoint allows you to retrieve a list of charges with detailed information for each charge. The response returned can be saved in a CSV file. Each row represents a charge with its respective details, and the first row contains the headers describing each field.

# Handling Large Datasets (with Pagination)

The download API has been enhanced to support pagination for merchants needing to retrieve more than 100,000 records. This section outlines the process to fetch large datasets efficiently using the limit and last\_charge\_id parameters.

## Process

### Initial Request:

Set limit to 100,000 (the maximum allowed value).
Set last\_charge\_id to an empty string ("") for the first request.
Send the request to the API endpoint (<https://api.tap.company/v2/charges/download>) with the required authorization token and payload (e.g., period, merchants, metadata, reference).

### Response Headers:

has\_more: Indicates if additional records are available (true or false).
page\_size: The number of records per page (matches the limit, e.g., 100,000).
number\_of\_pages: The total number of pages to iterate through to retrieve all records.
total\_count: The total number of available records (calculated as page\_size \* number\_of\_pages if has\_more is false).
last\_charge\_id: The ID of the last retrieved charge, used to fetch the next page.

### Iteration Logic:

Loop through the API number\_of\_pages times.

For each iteration:

Call the API with limit set to 100,000 and starting\_after set to the value from the previous response's last\_charge\_id.
Update last\_charge\_id with the new value from the response headers.
Continue until has\_more is false or all number\_of\_pages are processed.

### Example Based on Response

#### From the provided API response:

has\_more: true (indicating more records exist beyond the first page).
page\_size: 100,000 (matches the limit set in the request).
number\_of\_pages: 4 (total pages to fetch all records).
total\_count: Not explicitly provided but can be inferred as page\_size *number\_of\_pages (e.g., 100,000* 4 = 400,000 records, though has\_more suggests additional pages may exist).
last\_charge\_id: Not shown but will be included in the response headers for the next request.

## Step-by-Step Implementation

## First Request:

limit: 100,000
starting\_after: ""

Use the following curl command, updating the payload as needed:

```json
curl --request POST \
     --url https://api.tap.company/v2/charges/download \
     --header 'Authorization: Bearer sk_test_XKokBfNWv6FIYuTMg5sLPjhJ' \
     --header 'accept: text/plain' \
     --header 'content-type: application/json' \
     --data '
{
  "period": {
    "date": {
      "from": "1751457690000",
      "to": "1751901168712"
    },
    "type": "1"
  },
  "merchants": [
    "560208"
  ],
  "limit": 100000,
  "starting_after": ""
}
'
```

### Process Response:

Extract last\_charge\_id from the headers.
Note number\_of\_pages (e.g., 4) and has\_more (e.g., true).

**Loop Through Pages:**

* For each page up to number\_of\_pages:
* Call the API with limit: 100000 and starting\_after with the last\_charge\_id value from the previous response.
* Update starting\_after with the new value from the response headers.
* Collect the records.

**Completion:**

* Stop when has\_more is false or all number\_of\_pages are processed.
* Ensure all records are retrieved based on total\_count (if provided) or page\_size \* number\_of\_pages.

## Subsequent Request Example

For the next page:

```json
curl --request POST \
     --url https://api.tap.company/v2/charges/download \
     --header 'Authorization: Bearer sk_test_XKokBfNWv6FIYuTMg5sLPjhJ' \
     --header 'accept: text/plain' \
     --header 'content-type: application/json' \
     --data '
{
  "period": {
    "date": {
      "from": "1751457690000",
      "to": "1751901168712"
    },
    "type": "1"
  },
  "merchants": [
    "560208"
  ],
  "limit": 100000,
  "starting_after": "<value_from_previous_response>"
}
'
```

(Replace \<value\_from\_previous\_response> with the actual last\_charge\_id from the response headers.)

Notes

<Callout icon="📘" theme="info">
  * Ensure limit and starting_after are included in the payload for all requests after the first.
  * The total_count may need to be tracked across pages if not provided in the initial response, especially if has_more remains true beyond number_of_pages.
  * Verify the payload structure with the API provider, as the example omits some fields (e.g., metadata, reference) that may be required.
  * Test with a smaller dataset to validate the logic before handling large volumes.
</Callout>

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "charges.",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.tap.company/v2/charges"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "x-bearer-format": "bearer",
        "x-default": "sk_test_XKokBfNWv6FIYuTMg5sLPjhJ"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/download": {
      "post": {
        "summary": "Download Charges",
        "description": "This endpoint allows you to retrieve a list of charges with detailed information for each charge. The response returned can be saved in a CSV file. Each row represents a charge with its respective details, and the first row contains the headers describing each field.",
        "operationId": "download-charges",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "period": {
                    "type": "object",
                    "description": "Retrieve charges for a selected period",
                    "properties": {
                      "date": {
                        "type": "object",
                        "description": "From and to date range (charge created date), Measured in Unix epoch time (milliseconds).",
                        "properties": {
                          "from": {
                            "type": "string",
                            "description": "From date (charge created date), Measured in Unix Epoch Timestamp (milliseconds).",
                            "default": "1662190768000"
                          },
                          "to": {
                            "type": "string",
                            "description": "To date (charge created date), Measured in Unix Epoch Timestamp (milliseconds).",
                            "default": "1662536368000"
                          }
                        }
                      },
                      "type": {
                        "type": "string",
                        "description": "This parameter defines the different transaction states or statuses that can be queried or filtered within the system. The following are the accepted values and their corresponding meanings:  CHARGE: When this value is used, the API will retrieve all charges that have been initiated or requested by the user.  POST: Selecting this value will fetch charges that have been successfully posted or processed to the Settlement system for further processing.  SETTLED: This value will retrieve matured transactions, where the transaction amount has been settled and credited to the Tap wallet.  PAID_OUT: When using this value, the API will return charges that have been successfully paid out to the respective bank or financial institution.  By specifying one of these accepted values as a parameter, the API can be used to fetch specific sets of transactions based on their current state or status in the system.",
                        "default": "1"
                      }
                    }
                  },
                  "merchants": {
                    "type": "array",
                    "description": "List of merchant IDs for which the charges are being queried",
                    "default": [
                      "599242"
                    ],
                    "items": {
                      "type": "string"
                    }
                  },
                  "payouts": {
                    "type": "object",
                    "description": "Retrieve charges based on payouts",
                    "properties": {
                      "payout_id": {
                        "type": "array",
                        "description": "Array of payouts (you can specify the list of Payouts ID's to retrieve).",
                        "items": {
                          "type": "string"
                        }
                      },
                      "payout_reference": {
                        "type": "array",
                        "description": "Array of payouts references(you can specify the list of Payouts references's to retrieve).",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "status": {
                    "type": "string",
                    "description": "Retrieve the selected list of charges info by charge status. Values can be: INITIATED, IN_PROGRESS, ABANDONED, CANCELLED, FAILED, DECLINED, RESTRICTED, CAPTURED, VOID, TIMEDOUT or UNKNOWN"
                  },
                  "sources": {
                    "type": "array",
                    "description": "Array of sources (you can specify the list of Source ID's to retrieve).",
                    "items": {
                      "type": "string"
                    }
                  },
                  "payment_methods": {
                    "type": "array",
                    "description": "Array of payment methods (you can specify the list of payment method Source ID's to retrieve).",
                    "items": {
                      "type": "string"
                    }
                  },
                  "customers": {
                    "type": "array",
                    "description": "Array of customers (you can specify the list of Customer ID's to retrieve).",
                    "items": {
                      "type": "string"
                    }
                  },
                  "charges": {
                    "type": "array",
                    "description": "Array of charges (you can specify the list of Source ID's to retrieve).",
                    "items": {
                      "type": "string"
                    }
                  },
                  "starting_after": {
                    "type": "string",
                    "description": "A cursor for use in pagination. The starting_after parameter takes a charge ID that determines your position in the list. For example, if your list request returns 50 charges that end with cus_foo, you can use starting_after=cus_foo in your next call to retrieve the next page of the list."
                  },
                  "charge_created": {
                    "type": "string",
                    "description": "Created date (charge created date), Measured in Unix Epoch Timestamp (milliseconds)."
                  },
                  "mobile": {
                    "type": "string",
                    "description": "Filter the results based on customer mobile number"
                  },
                  "email": {
                    "type": "string",
                    "description": "filter the results based on customer email"
                  },
                  "limit": {
                    "type": "string",
                    "description": "The maximum number of charges to return in a single call. Default: 25; Maximum: 50."
                  },
                  "order": {
                    "type": "string",
                    "description": "Sort the results Ascending or Descending by date"
                  },
                  "order_by": {
                    "type": "string",
                    "description": "Defaults to date"
                  },
                  "metadata": {
                    "type": "object",
                    "description": "Filter the results based on meta data values",
                    "properties": {
                      "udf1": {
                        "type": "string",
                        "description": "Merchant can define new parameters (key/value pairs) within this metadata object.",
                        "default": "Metadata 1"
                      }
                    }
                  },
                  "currency": {
                    "type": "string",
                    "description": "Filter the charges based on charge currency"
                  },
                  "reference": {
                    "type": "object",
                    "properties": {
                      "transaction": {
                        "type": "string",
                        "description": "The transaction reference number provided by the Merchant.",
                        "default": "txn_01"
                      },
                      "order": {
                        "type": "string",
                        "description": "The order reference number provided by the Merchant.",
                        "default": "ord_01"
                      },
                      "idempotent": {
                        "type": "string",
                        "description": "The idempotent string to restrict duplicate payments. If the same idempotent string is passed, a new charge will not be initiated, whereas the response of the first charge will be returned. Read more: https://developers.tap.company/docs/idempotency"
                      }
                    }
                  },
                  "additional_fields": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "default": "",
                    "description": "additional fields can be returned in the report, for the marketplace you can get the `destination_id` and the `destination_amount`"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "text/plain": {
                "examples": {
                  "Result": {
                    "value": "payout_id,settlement_id,charge_id,currency,amount,status,authorization_id,status_code,status_message,gateway_code,gateway_message,issuer_code,issuer_message,charge_date,capture_date,post_date,settlement_date,payout_date,track_id,reference_gateway,reference_acquirer,reference_transaction,reference_order,receipt,customer_id,customer_name,customer_phone_code,customer_phone,customer_email,first_eight,last_four,issuer_country,payment_method,payment_scheme,payment_type,merchant_id,product,post_currency,post_amount,fee,fee_vat,net_amount,metadata_1,metadata_2,metadata_3,metadata_4,metadata_5\npayout_xxxx,settlement_xxxx,chg_xxxx,AED,200.000,CAPTURED,xxxx,\"000 \",Captured,\"0 \",Transaction Approved,\"00 \",Approved,28/07/2024 12:43 AM,28/07/2024 12:44 AM,28/07/2024,04/08/2024,04/08/2024,tck_xxxx,\"xxxx\",xxxx,\"xxxx-xxxx-xxxx-xxx\",\"xxxx-xxxx-xxxx-xxxx\",\"xxxx\",cus_xxxx,John Doe,965,\"xxxxx\",test@hotmail.com,xxxxxx,xxxx,QA,APPLE_PAY,VISA,CREDIT,599242,GOSELL,AED,200.000,xxx,0.000,xxx,,,,,\npayout_xxxx,settlement_xxxx,chg_xxxx,AED,200.000,CAPTURED,xxxx,\"000 \",Captured,\"0 \",Transaction Approved,\"00 \",Approved,28/07/2024 10:33 AM,28/07/2024 10:35 AM,28/07/2024,04/08/2024,04/08/2024,tck_xxxx,\"xxxx\",xxxx,\"xxxx-xxxx-xxxx-xxx\",\"xxxx-xxxx-xxxx-xxxx\",\"xxxx\",cus_xxxx,John Doe,965,\"xxxxx\",test@hotmail.com,xxxxxx,xxxx,QA,MASTERCARD,MASTERCARD,CREDIT,599242,GOSELL,AED,200.000,xxx,0.000,xxx,,,,,\npayout_xxxx,settlement_xxxx,chg_xxxx,AED,200.000,CAPTURED,xxxx,\"000 \",Captured,\"0 \",Transaction Approved,\"00 \",Approved,28/07/2024 11:50 AM,28/07/2024 11:52 AM,28/07/2024,04/08/2024,04/08/2024,tck_xxxx,\"xxxx\",xxxx,\"xxxx-xxxx-xxxx-xxx\",\"xxxx-xxxx-xxxx-xxxx\",\"xxxx\",cus_xxxx,John Doe,965,\"xxxxx\",test@hotmail.com,xxxxxx,xxxx,QA,APPLE_PAY,MASTERCARD,DEBIT,599242,GOSELL,AED,200.000,xxx,0.000,xxx,,,,,\npayout_xxxx,settlement_xxxx,chg_xxxx,AED,200.000,CAPTURED,xxxx,\"000 \",Captured,\"0 \",Transaction Approved,\"00 \",Approved,28/07/2024 11:58 AM,28/07/2024 11:59 AM,28/07/2024,04/08/2024,04/08/2024,tck_xxxx,\"xxxx\",xxxx,\"xxxx-xxxx-xxxx-xxx\",\"xxxx-xxxx-xxxx-xxxx\",\"xxxx\",cus_xxxx,John Doe,965,\"xxxxx\",test@hotmail.com,xxxxxx,xxxx,QA,VISA,VISA,CREDIT,599242,GOSELL,AED,200.000,xxx,0.000,xxx,,,,,\npayout_xxxx,settlement_xxxx,chg_xxxx,AED,200.000,CAPTURED,xxxx,\"000 \",Captured,\"0 \",Transaction Approved,\"00 \",Approved,28/07/2024 12:02 PM,28/07/2024 12:03 PM,28/07/2024,04/08/2024,04/08/2024,tck_xxxx,\"xxxx\",xxxx,\"xxxx-xxxx-xxxx-xxx\",\"xxxx-xxxx-xxxx-xxxx\",\"xxxx\",cus_xxxx,John Doe,965,\"xxxxx\",test@hotmail.com,xxxxxx,xxxx,QA,APPLE_PAY,VISA,DEBIT,599242,GOSELL,AED,200.000,xxx,0.000,xxx,,,,,\npayout_xxxx,settlement_xxxx,chg_xxxx,AED,200.000,CAPTURED,xxxx,\"000 \",Captured,\"0 \",Transaction Approved,\"00 \",Approved,28/07/2024 12:12 PM,28/07/2024 12:13 PM,28/07/2024,04/08/2024,04/08/2024,tck_xxxx,\"xxxx\",xxxx,\"xxxx-xxxx-xxxx-xxx\",\"xxxx-xxxx-xxxx-xxxx\",\"xxxx\",cus_xxxx,John Doe,965,\"xxxxx\",test@hotmail.com,xxxxxx,xxxx,QA,APPLE_PAY,VISA,CREDIT,599242,GOSELL,AED,200.000,xxx,0.000,xxx,,,,,\npayout_xxxx,settlement_xxxx,chg_xxxx,AED,200.000,CAPTURED,xxxx,\"000 \",Captured,\"0 \",Transaction Approved,\"00 \",Approved,28/07/2024 12:16 PM,28/07/2024 12:16 PM,28/07/2024,04/08/2024,04/08/2024,tck_xxxx,\"xxxx\",xxxx,\"xxxx-xxxx-xxxx-xxx\",\"xxxx-xxxx-xxxx-xxxx\",\"xxxx\",cus_xxxx,John Doe,965,\"xxxxx\",test@hotmail.com,xxxxxx,xxxx,QA,APPLE_PAY,VISA,DEBIT,599242,GOSELL,AED,200.000,xxx,0.000,xxx,,,,,\npayout_xxxx,settlement_xxxx,chg_xxxx,AED,200.000,CAPTURED,xxxx,\"000 \",Captured,\"0 \",Transaction Approved,\"00 \",Approved,28/07/2024 01:38 PM,28/07/2024 01:38 PM,28/07/2024,04/08/2024,04/08/2024,tck_xxxx,\"xxxx\",xxxx,\"xxxx-xxxx-xxxx-xxx\",\"xxxx-xxxx-xxxx-xxxx\",\"xxxx\",cus_xxxx,John Doe,965,\"xxxxx\",test@hotmail.com,xxxxxx,xxxx,QA,APPLE_PAY,VISA,CREDIT,599242,GOSELL,AED,200.000,xxx,0.000,xxx,,,,,\npayout_xxxx,settlement_xxxx,chg_xxxx,AED,200.000,CAPTURED,xxxx,\"000 \",Captured,\"0 \",Transaction Approved,\"00 \",Approved,28/07/2024 02:50 PM,28/07/2024 02:50 PM,28/07/2024,04/08/2024,04/08/2024,tck_xxxx,\"xxxx\",xxxx,\"xxxx-xxxx-xxxx-xxx\",\"xxxx-xxxx-xxxx-xxxx\",\"xxxx\",cus_xxxx,John Doe,965,\"xxxxx\",test@hotmail.com,xxxxxx,xxxx,QA,APPLE_PAY,MASTERCARD,DEBIT,599242,GOSELL,AED,200.000,xxx,0.000,xxx,,,,,\npayout_xxxx,settlement_xxxx,chg_xxxx,AED,200.000,CAPTURED,xxxx,\"000 \",Captured,\"0 \",Transaction Approved,\"00 \",Approved,28/07/2024 02:57 PM,28/07/2024 02:57 PM,28/07/2024,04/08/2024,04/08/2024,tck_xxxx,\"xxxx\",xxxx,\"xxxx-xxxx-xxxx-xxx\",\"xxxx-xxxx-xxxx-xxxx\",\"xxxx\",cus_xxxx,John Doe,965,\"xxxxx\",test@hotmail.com,xxxxxx,xxxx,QA,APPLE_PAY,VISA,CREDIT,599242,GOSELL,AED,200.000,xxx,0.000,xxx,,,,,\npayout_xxxx,settlement_xxxx,chg_xxxx,AED,160.000,CAPTURED,xxxx,\"000 \",Captured,\"0 \",Transaction Approved,\"00 \",Approved,28/07/2024 03:00 PM,28/07/2024 03:00 PM,28/07/2024,04/08/2024,04/08/2024,tck_xxxx,\"xxxx\",xxxx,\"xxxx-xxxx-xxxx-xxx\",\"xxxx-xxxx-xxxx-xxxx\",\"xxxx\",cus_xxxx,John Doe,965,\"xxxxx\",test@hotmail.com,xxxxxx,xxxx,QA,APPLE_PAY,VISA,CREDIT,599242,GOSELL,AED,160.000,xxx,0.000,xxx,,,,,\npayout_xxxx,settlement_xxxx,chg_xxxx,AED,200.000,CAPTURED,xxxx,\"000 \",Captured,\"0 \",Transaction Approved,\"00 \",Approved,28/07/2024 06:25 PM,28/07/2024 06:26 PM,28/07/2024,04/08/2024,04/08/2024,tck_xxxx,\"xxxx\",xxxx,\"xxxx-xxxx-xxxx-xxx\",\"xxxx-xxxx-xxxx-xxxx\",\"xxxx\",cus_xxxx,John Doe,965,\"xxxxx\",test@hotmail.com,xxxxxx,xxxx,QA,APPLE_PAY,VISA,DEBIT,599242,GOSELL,AED,200.000,xxx,0.000,xxx,,,,,\npayout_xxxx,settlement_xxxx,chg_xxxx,AED,950.000,CAPTURED,xxxx,\"000 \",Captured,\"0 \",Transaction Approved,\"00 \",Approved,28/07/2024 06:28 PM,28/07/2024 06:28 PM,28/07/2024,04/08/2024,04/08/2024,tck_xxxx,\"xxxx\",xxxx,\"xxxx-xxxx-xxxx-xxx\",\"xxxx-xxxx-xxxx-xxxx\",\"xxxx\",cus_xxxx,John Doe,965,\"xxxxx\",test@hotmail.com,xxxxxx,xxxx,QA,APPLE_PAY,VISA,CREDIT,599242,GOSELL,AED,950.000,xxx,0.000,xxx,,,,,\npayout_xxxx,settlement_xxxx,chg_xxxx,AED,160.000,CAPTURED,xxxx,\"000 \",Captured,\"0 \",Transaction Approved,\"00 \",Approved,28/07/2024 07:39 PM,28/07/2024 07:39 PM,28/07/2024,04/08/2024,04/08/2024,tck_xxxx,\"xxxx\",xxxx,\"xxxx-xxxx-xxxx-xxx\",\"xxxx-xxxx-xxxx-xxxx\",\"xxxx\",cus_xxxx,John Doe,965,\"xxxxx\",test@hotmail.com,xxxxxx,xxxx,QA,APPLE_PAY,MASTERCARD,DEBIT,599242,GOSELL,AED,160.000,xxx,0.000,xxx,,,,,\npayout_xxxx,settlement_xxxx,chg_xxxx,AED,160.000,CAPTURED,xxxx,\"000 \",Captured,\"0 \",Transaction Approved,\"00 \",Approved,28/07/2024 07:41 PM,28/07/2024 07:42 PM,28/07/2024,04/08/2024,04/08/2024,tck_xxxx,\"xxxx\",xxxx,\"xxxx-xxxx-xxxx-xxx\",\"xxxx-xxxx-xxxx-xxxx\",\"xxxx\",cus_xxxx,John Doe,965,\"xxxxx\",test@hotmail.com,xxxxxx,xxxx,QA,APPLE_PAY,MASTERCARD,DEBIT,599242,GOSELL,AED,160.000,xxx,0.000,xxx,,,,,"
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```