---
title: "Export Campaign Transactions"
method: POST
path: "/v1/campaigns/{campaignId}/transactions/export"
tags: ["Campaigns"]
---

# Export Campaign Transactions

`POST /v1/campaigns/{campaignId}/transactions/export`

Export transactions is an asynchronous process that generates a CSV file with the data about credit movements on all gift cards or point movements on all loyalty cards in a given campaign.

To export transactions:
1. In the export request, use parameters to select which fields will be exported, in what order, and which data will be filtered.
2. Use the returned `id` to track the export status with the [GET Export](/api-reference/exports/get-export) method.
3. In the GET Export method, when the returned `status` field has the `DONE` value, the export file has been generated.
4. Use the URL in the `result` property to download the file. You must be logged to your Voucherify account on a given cluster in the browser to be able to download the file.

An export request will almost always result in a single file being generated by the system. However, when the data volume is large, the system may split the results into multiple files.

An example export file can look as follows:

| **Field** | **Definition** | **Example Export** |
|:---|:---|:---|
| `id` | Unique transaction ID. | `vtx_0cb7811f1c07765800` |
| `type` | Transaction type. |**Gift cards**:<br />- `CREDITS_REMOVAL`<br />- `CREDITS_ADDITION`<br />- `CREDITS_REFUND`<br />- `CREDITS_REDEMPTION`<br />**Loyalty cards**:<br />- `POINTS_ACCRUAL`<br />- `POINTS_REDEMPTION`<br />- `POINTS_REFUND`<br />- `POINTS_ADDITION`<br />- `POINTS_REMOVAL`<br />- `POINTS_EXPIRATION`<br />- `POINTS_TRANSFER_IN`<br />- `POINTS_TRANSFER_OUT` |
| `source_id` | Unique transaction source ID. Optional and only in manual operations: `CREDITS_ADDITION`, `CREDITS_REMOVAL`, `POINTS_ADDITION`, `POINTS_REMOVAL`, `POINTS_TRANSFER_OUT`. | 8638 |
| `reason` | Contains the reason for the transaction if one was included originally. Optional and only in the following manual operations: `CREDITS_ADDITION`, `CREDITS_REMOVAL`, `POINTS_ADDITION`, `POINTS_REMOVAL`, `POINTS_TRANSFER_OUT`, `POINTS_TRANSFER_IN`. | `Apology for sending a broken item` |
| `balance` | The gift card or loyalty card balance after the transaction. |  |
| `amount` | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. |  |
| `created_at` | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | `2024-10-09T09:16:32.521Z`  |
| `voucher_id` | Unique voucher ID. | `v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp` |
| `source`|  Channel through which the transaction was initiated. | `API` |
| `details` | More detailed information stored in the form of JSON. | Provides more details related to the transaction in the form of an object. |
| `related_transaction_id` | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | `vtx_0c9afe802593b34b80` |

> 👍 Export Loyalty Campaign Transactions
>
> For loyalty campaigns, this method works in the same way the [POST Export Loyalty Campaign Transactions](/api-reference/loyalties/export-loyalty-campaign-transactions) does.

## Request body

- CampaignsTransactionsExportCreateRequestBody — Request body schema for **POST** `v1/campaigns/{campaignId}/transactions/export`.
  - `parameters` object — List of available parameters containing fields and filters that can be exported for transactions in a gift card or loyalty card campaign, along with the sorting order of the returned data.
    - `order` '-created_at' | 'created_at' — How the export is ordered, where the dash `-` preceding a sorting option means sorting in a descending order.
    - `fields` string[] — Data fields that will be exported for the transactions that are associated with balance movements on cards in a campaign.
    - `filters` ExportCampaignTransactionsFilters — Data filters and their conditions to narrow down the returned data.
      - `junction` 'and' | 'or' — Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE.
      - `created_at` object
        - `conditions` FilterConditionsDateTime — Data filters used to narrow down the data records to be returned in the result.
          - `$after` string, date-time — Value is after this date. The value for this parameter is shown in the ISO 8601 format.
          - `$before` string, date-time — Value is before this date. The value for this parameter is shown in the ISO 8601 format.
          - `$has_value` string — Value is NOT null. The value for this parameter is an empty string.
          - `$is_unknown` string — Value is null. The value for this parameter is an empty string.
          - `$more_than` integer — Value is more days ago before the current date and time, e.g. more than `10` days ago.
          - `$less_than` integer — Value is less days before the current date and time, e.g. less than `10` days ago.
      - `voucher_id` object
        - `conditions` FilterConditionsString — Data filters used to narrow down the data records to be returned in the result.
          - `$in` string[] — Array of resource values that should be included in the results (multiple values).
          - `$not_in` string[] — Array of resource values that should be included in the results (multiple values).
          - `$is` string — Value is exactly this value (single value).
          - `$is_not` string — Results omit this value (single value).
          - `$has_value` string — Value is NOT null. The value for this parameter is an empty string.
          - `$is_unknown` string — Value is null. The value for this parameter is an empty string.
          - `$starts_with` string — Value starts with the specified string.
          - `$ends_with` string — Value ends with the specified string.
          - `$contains` string — Value includes the specified string.
          - `$not_contain` string — Value does NOT include the specified string.

## Response `200`

An object representing an export.

- CampaignsTransactionsExportCreateResponseBody — This is an object representing an export.
  - `id` string, required — Unique export ID.
  - `object` 'export', required — The type of object being represented. This object stores information about the `export`.
  - `created_at` string, date-time, required — Timestamp representing the date and time when the export was scheduled in ISO 8601 format.
  - `status` 'SCHEDULED', required — Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.
  - `channel` 'API', required — The channel through which the export was triggered.
  - `exported_object` 'voucher_transactions', required — The type of exported object.
  - `parameters` object, required
    - `order` '-created_at' | 'created_at' — How the export is ordered, where the dash `-` preceding a sorting option means sorting in a descending order.
    - `fields` string[] — Data fields that will be exported for the transactions that are associated with balance movements on cards in a campaign.
    - `filters` object — Filter condition.
      - `junction` 'and' | 'or' — Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE.
      - `created_at` object
        - `conditions` FilterConditionsDateTime — Data filters used to narrow down the data records to be returned in the result.
          - `$after` string, date-time — Value is after this date. The value for this parameter is shown in the ISO 8601 format.
          - `$before` string, date-time — Value is before this date. The value for this parameter is shown in the ISO 8601 format.
          - `$has_value` string — Value is NOT null. The value for this parameter is an empty string.
          - `$is_unknown` string — Value is null. The value for this parameter is an empty string.
          - `$more_than` integer — Value is more days ago before the current date and time, e.g. more than `10` days ago.
          - `$less_than` integer — Value is less days before the current date and time, e.g. less than `10` days ago.
      - `voucher_id` object
        - `conditions` FilterConditionsString — Data filters used to narrow down the data records to be returned in the result.
          - `$in` string[] — Array of resource values that should be included in the results (multiple values).
          - `$not_in` string[] — Array of resource values that should be included in the results (multiple values).
          - `$is` string — Value is exactly this value (single value).
          - `$is_not` string — Results omit this value (single value).
          - `$has_value` string — Value is NOT null. The value for this parameter is an empty string.
          - `$is_unknown` string — Value is null. The value for this parameter is an empty string.
          - `$starts_with` string — Value starts with the specified string.
          - `$ends_with` string — Value ends with the specified string.
          - `$contains` string — Value includes the specified string.
          - `$not_contain` string — Value does NOT include the specified string.
      - `campaign_id` object, required — Data filters used to narrow down the data records to be returned in the result.
        - `conditions` object, required — Data filters used to narrow down the data records to be returned in the result.
          - `$in` string[], required
  - `result` object, nullable, required — Contains the URL of the CSV file.
    - `url` string, required — URL of the CSV file location. It contains the `token` used for authorization in the [Download export](/api-reference/exports/download-export) method.
  - `user_id` string, nullable, required — Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`.

## Other responses

- `403` — Returns an error if an ID of a campaign with a wrong type is sent.
- `404` — Returns an error if the campaign does not exist or has been deleted.

---

[API](https://skmtc.net/voucherifyio/apis/voucherify-api-async-actions.md) · [All operations](https://skmtc.net/voucherifyio/apis/voucherify-api-async-actions/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/voucherifyio/voucherify-api-async-actions/revisions/4982266e0494/schema)
