> ## Documentation Index
> Fetch the complete documentation index at: https://docs.voucherify.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Export Campaign Transactions

> 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.



## OpenAPI

````yaml /openapi/campaigns.json post /v1/campaigns/{campaignId}/transactions/export
openapi: 3.0.1
info:
  title: Voucherify API - Campaigns
  version: v2018-08-01
  description: >-
    Voucherify promotion engine REST API. Please see
    https://docs.voucherify.io/docs for more details.
  contact:
    name: Voucherify Team
    url: https://www.voucherify.io/contact-support
    email: support@voucherify.io
  termsOfService: https://www.voucherify.io/legal/subscription-agreement
  license:
    name: MIT
    url: https://github.com/voucherifyio/voucherify-js-sdk/blob/main/LICENSE
servers:
  - url: https://{cluster}.voucherify.io
    description: Base URL
    variables:
      cluster:
        default: api
        enum:
          - api
          - us1.api
          - as1.api
          - download
          - us1.download
          - as1.download
security: []
paths:
  /v1/campaigns/{campaignId}/transactions/export:
    parameters:
      - in: path
        name: campaignId
        description: >-
          You can either pass the campaign ID, which was assigned by Voucherify,
          or the name of the campaign as the path parameter value.
        schema:
          $ref: '#/components/schemas/ParameterCampaignId'
        required: true
    post:
      tags:
        - Campaigns
      summary: Export Campaign Transactions
      description: >-
        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.
      operationId: export-campaign-transactions
      parameters: []
      requestBody:
        description: Specify the parameters for the transaction export.
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/CampaignsTransactionsExportCreateRequestBody
            examples:
              Example:
                value:
                  order: '-created_at'
                  parameters:
                    fields:
                      - id
                      - type
                      - source_id
                      - created_at
                    filters:
                      created_at:
                        conditions:
                          $after:
                            - '2024-10-01T00:00:00.000Z'
        required: true
      responses:
        '200':
          description: An object representing an export.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/CampaignsTransactionsExportCreateResponseBody
              examples:
                Example:
                  value:
                    id: exp_KBunyG5vwkuF3jSWD03kmnLx
                    object: export
                    created_at: '2024-10-25T14:35:12.019Z'
                    status: SCHEDULED
                    channel: API
                    exported_object: voucher_transactions
                    parameters:
                      fields:
                        - id
                        - type
                        - source_id
                        - created_at
                      filters:
                        junction: AND
                        created_at:
                          conditions:
                            $after:
                              - '2024-10-01T00:00:00.000Z'
                        campaign_id:
                          conditions:
                            $in:
                              - camp_5pgKwSKsAeQtFkRz6mfKpxxD
                    result: null
                    user_id: null
                No request body:
                  value:
                    id: exp_FE04bvkl4J5GQCb99Q5o7Gxa
                    object: export
                    created_at: '2024-10-25T15:15:11.698Z'
                    status: SCHEDULED
                    channel: API
                    exported_object: voucher_transactions
                    parameters:
                      filters:
                        campaign_id:
                          conditions:
                            $in:
                              - camp_5pgKwSKsAeQtFkRz6mfKpxxD
                    result: null
                    user_id: null
        '403':
          description: Returns an error if an ID of a campaign with a wrong type is sent.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Example:
                  value:
                    code: 403
                    key: forbidden
                    message: Forbidden
                    details: >-
                      Transactions are allowed only for loyalty or gift
                      campaigns
                    request_id: v-0f92ce8ff74946d25f
        '404':
          description: Returns an error if the campaign does not exist or has been deleted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Not Found:
                  value:
                    code: 404
                    key: not_found
                    message: Resource not found
                    details: Cannot find campaign with id camp_5pgKwSKsAeQtFkRzmfKpxxD
                    request_id: v-0f92ccbb058946d005
                    resource_id: camp_5pgKwSKsAeQtFkRzmfKpxxD
                    resource_type: campaign
      security:
        - X-App-Id: []
          X-App-Token: []
        - X-Voucherify-OAuth:
            - api
            - campaigns
components:
  schemas:
    ParameterCampaignId:
      type: string
      example: camp_rRsfatlwN7unSeUIJDCYedal
    CampaignsTransactionsExportCreateRequestBody:
      title: Campaign Transactions Export Create Request Body
      description: >-
        Request body schema for **POST**
        `v1/campaigns/{campaignId}/transactions/export`.
      type: object
      properties:
        parameters:
          description: >-
            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.
          allOf:
            - $ref: '#/components/schemas/CampaignsTransactionsExportParameters'
            - type: object
              properties:
                filters:
                  $ref: '#/components/schemas/ExportCampaignTransactionsFilters'
    CampaignsTransactionsExportCreateResponseBody:
      type: object
      title: Campaigns Transactions Export Create Response Body
      description: >-
        Response body schema for **POST**
        `v1/campaigns/{campaignId}/transactions/export`.
      allOf:
        - $ref: '#/components/schemas/CampaignsTransactionsExport'
    Error:
      title: Error Object
      type: object
      description: Error details
      properties:
        code:
          type: integer
          description: Error's HTTP status code.
        key:
          type: string
          description: Short string describing the kind of error which occurred.
        message:
          type: string
          description: A human-readable message providing a short description of the error.
        details:
          type: string
          description: A human-readable message providing more details about the error.
        request_id:
          type: string
          example: v-0a885062c80375740f
          description: >-
            This ID is useful when troubleshooting and/or finding the root cause
            of an error response by our support team.
        resource_id:
          type: string
          description: >-
            Unique resource ID that can be used in another endpoint to get more
            details.
          example: rf_0c5d710a87c8a31f86
        resource_type:
          type: string
          description: The resource type.
          example: voucher
        error:
          type: object
          description: Includes additional information about the error.
          properties:
            message:
              type: string
              description: The message configured by the user in a validation rule.
      required:
        - code
        - message
    CampaignsTransactionsExportParameters:
      title: Export Campaign Transactions
      type: object
      properties:
        order:
          type: string
          description: >-
            How the export is ordered, where the dash `-` preceding a sorting
            option means sorting in a descending order.
          enum:
            - '-created_at'
            - created_at
        fields:
          type: array
          description: >-
            Data fields that will be exported for the transactions that are
            associated with balance movements on cards in a campaign.
          items:
            type: string
            enum:
              - id
              - type
              - source_id
              - reason
              - balance
              - amount
              - created_at
              - voucher_id
              - source
              - details
              - related_transaction_id
    ExportCampaignTransactionsFilters:
      title: Export Campaign Transactions Filters
      description: Data filters and their conditions to narrow down the returned data.
      type: object
      properties:
        junction:
          $ref: '#/components/schemas/Junction'
        created_at:
          $ref: '#/components/schemas/FilterConditionsDateTime'
        voucher_id:
          $ref: '#/components/schemas/FilterConditionsString'
    CampaignsTransactionsExport:
      title: Campaigns Transactions Export
      type: object
      description: This is an object representing an export.
      properties:
        id:
          type: string
          description: Unique export ID.
          example: exp_FFfp9o7daWuJqJCKp5xqqli4
        object:
          type: string
          default: export
          description: >-
            The type of object being represented. This object stores information
            about the `export`.
          enum:
            - export
        created_at:
          type: string
          example: '2022-04-28T11:23:20.922Z'
          description: >-
            Timestamp representing the date and time when the export was
            scheduled in ISO 8601 format.
          format: date-time
        status:
          type: string
          description: >-
            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.
          default: SCHEDULED
          enum:
            - SCHEDULED
        channel:
          type: string
          description: The channel through which the export was triggered.
          default: API
          enum:
            - API
        exported_object:
          type: string
          description: The type of exported object.
          default: voucher_transactions
          enum:
            - voucher_transactions
        parameters:
          allOf:
            - $ref: '#/components/schemas/CampaignsTransactionsExportParameters'
            - type: object
              properties:
                filters:
                  allOf:
                    - $ref: '#/components/schemas/ExportCampaignTransactionsFilters'
                    - $ref: >-
                        #/components/schemas/TransactionsExportFilterConditionsWithCampaign
        result:
          type: object
          nullable: true
          description: Contains the URL of the CSV file.
          required:
            - url
          properties:
            url:
              type: string
              description: >-
                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:
          type: string
          nullable: true
          description: >-
            Identifies the specific user who initiated the export through the
            Voucherify Dashboard; returned when the `channel` value is
            `WEBSITE`.
          example: user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH
      required:
        - id
        - object
        - created_at
        - status
        - channel
        - exported_object
        - parameters
        - result
        - user_id
    Junction:
      title: Junction
      description: >-
        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.
      enum:
        - and
        - or
      type: string
    FilterConditionsDateTime:
      title: Filter by conditions
      type: object
      description: >-
        Data filters used to narrow down the data records to be returned in the
        result.
      properties:
        $after:
          type: string
          description: >-
            Value is after this date. The value for this parameter is shown in
            the ISO 8601 format.
          format: date-time
          example: '2024-01-01T00:00:00.000Z'
        $before:
          type: string
          description: >-
            Value is before this date. The value for this parameter is shown in
            the ISO 8601 format.
          format: date-time
          example: '2024-01-01T00:00:00.000Z'
        $has_value:
          type: string
          description: Value is NOT null. The value for this parameter is an empty string.
        $is_unknown:
          type: string
          description: Value is null. The value for this parameter is an empty string.
        $more_than:
          type: integer
          description: >-
            Value is more days ago before the current date and time, e.g. more
            than `10` days ago.
        $less_than:
          type: integer
          description: >-
            Value is less days before the current date and time, e.g. less than
            `10` days ago.
    FilterConditionsString:
      title: Filter by conditions
      type: object
      description: >-
        Data filters used to narrow down the data records to be returned in the
        result.
      properties:
        $in:
          type: array
          description: >-
            Array of resource values that should be included in the results
            (multiple values).
          items:
            type: string
        $not_in:
          type: array
          description: >-
            Array of resource values that should be included in the results
            (multiple values).
          items:
            type: string
        $is:
          type: string
          description: Value is exactly this value (single value).
        $is_not:
          type: string
          description: Results omit this value (single value).
        $has_value:
          type: string
          description: Value is NOT null. The value for this parameter is an empty string.
        $is_unknown:
          type: string
          description: Value is null. The value for this parameter is an empty string.
        $starts_with:
          type: string
          description: Value starts with the specified string.
        $ends_with:
          type: string
          description: Value ends with the specified string.
        $contains:
          type: string
          description: Value includes the specified string.
        $not_contain:
          type: string
          description: Value does NOT include the specified string.
    TransactionsExportFilterConditionsWithCampaign:
      description: Filter condition.
      title: Filter by Campaign ID
      type: object
      required:
        - campaign_id
      properties:
        campaign_id:
          type: object
          required:
            - conditions
          description: >-
            Data filters used to narrow down the data records to be returned in
            the result.
          properties:
            conditions:
              type: object
              required:
                - $in
              description: >-
                Data filters used to narrow down the data records to be returned
                in the result.
              properties:
                $in:
                  type: array
                  minItems: 1
                  maxItems: 1
                  items:
                    type: string
                    minLength: 1
                    maxLength: 1
  securitySchemes:
    X-App-Id:
      type: apiKey
      name: X-App-Id
      in: header
    X-App-Token:
      type: apiKey
      name: X-App-Token
      in: header
    X-Voucherify-OAuth:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: https://api.voucherify.io/v1/oauth/token
          scopes:
            api: Gives access to whole server-side API.
            vouchers: >-
              Gives access to all endpoints and methods starting with
              `v1/vouchers`.
            client_api: Gives access to whole client-side API.
            client_vouchers: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/vouchers`.
            promotions: >-
              Gives access to all endpoints and methods starting with
              `/v1/promotions`.
            client_promotions: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/promotions`
            campaigns: >-
              Gives access to all endpoints and methods starting with
              `v1/campaigns`.
            client_publish: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/publish`.
            exports: >-
              Gives access to all endpoints and methods starting with
              `/v1/exports`.
            publications: >-
              Gives access to all endpoints and methods starting with
              `/v1/publications`.
            client_validate: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/validate`.
            validations: >-
              Gives access to all endpoints and methods starting with
              `/v1/validations`.
            client_validations: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/validations`.
            qualifications: >-
              Gives access to all endpoints and methods starting with
              `/v1/qualifications`.
            client_qualifications: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/qualifications`.
            client_redeem: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/redeem
            redemptions: >-
              Gives access to all endpoints and methods starting with
              `/v1/redemptions`.
            client_redemptions: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/redemptions`
            customers: >-
              Gives access to all endpoints and methods starting with
              `/v1/customers`.
            client_customers: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/customers`.
            orders: >-
              Gives access to all endpoints and methods starting with
              `/v1/orders`.
            products: >-
              Gives access to all endpoints and methods starting with
              `/v1/products`.
            skus: >-
              Gives access to all endpoints and methods starting with
              `/v1/SKUs`.
            validation-rules: >-
              Gives access to all endpoints and methods starting with
              `/v1/validation-rules`.
            validation-rules-assignments: >-
              Gives access to all endpoints and methods starting with
              `/v1/validation-rules-assignments
            segments: >-
              Gives access to all endpoints and methods starting with
              `/v1/segments`.
            events: >-
              Gives access to all endpoints and methods starting with
              `/v1/events`.
            client_events: >-
              Gives access to all endpoints and methods starting with
              `client/v1/events`.
            rewards: >-
              Gives access to all endpoints and methods starting with
              `/v1/rewards`.
            assets: >-
              Gives access to all endpoints and methods starting with
              `/v1/assets`.
            task-results: >-
              Gives access to all endpoints and methods starting with
              `/v1/task-results`.
            loyalties: >-
              Gives access to all endpoints and methods starting with
              `/v1/loyalties`.
            client_consents: >-
              Gives access to all endpoints and methods starting with
              `client/v1/consents`.
            consents: >-
              Gives access to all endpoints and methods starting with
              `/v1/consents`.
            async-actions: >-
              Gives access to all endpoints and methods starting with
              `/v1/async-actions`.
            product-collections: >-
              Gives access to all endpoints and methods starting with
              `/v1/product-collections`.
            categories: >-
              Gives access to all endpoints and methods starting with
              `/v1/categories`.
            metadata-schemas: >-
              Gives access to all endpoints and methods starting with
              `/v1/metadata-schemas`.
            locations: >-
              Gives access to all endpoints and methods starting with
              `/v1/locations`.
            referrals: >-
              Gives access to all endpoints and methods starting with
              `/v1/referrals`.
            trash-bin: >-
              Gives access to all endpoints and methods starting with
              `/v1/trash-bin`.
            templates: >-
              Gives access to all endpoints and methods starting with
              `/v1/templates`.

````