curl --request POST \
--url https://{cluster}.voucherify.io/v1/orders/export \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '
{
"parameters": {
"fields": [
"id",
"source_id",
"status",
"created_at",
"updated_at",
"amount",
"discount_amount",
"items_discount_amount",
"total_discount_amount",
"total_amount",
"customer_id",
"referrer_id",
"metadata.payment_mean"
]
}
}
'{
"id": "exp_pT2Y1mgYsAgRAqsWTGf7PQX7",
"object": "export",
"created_at": "2022-09-09T10:45:52.362Z",
"status": "SCHEDULED",
"channel": "API",
"exported_object": "order",
"parameters": {
"fields": [
"id",
"source_id",
"status",
"created_at",
"updated_at",
"amount",
"discount_amount",
"items_discount_amount",
"total_discount_amount",
"total_amount",
"customer_id",
"referrer_id",
"metadata.payment_mean"
]
},
"result": null,
"user_id": null
}Creates a downloadable CSV file containing a list of orders.
The parameters listed in the payload resembles headers in the CSV file. To include a parameter to the file, add it to the parameters.fields object in the request body.
The available filters are all order object attributes. Additionally, any metadata defined in the metadata schema can be exported.
Passing an empty JSON will generate a file containing three default fields: id, source_id, and status.
The fields array is an array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields:
| Field | Definition | Example Export |
|---|---|---|
id | Unique order ID. | ord_A69RIxEdRsPuC6i8gFGVHUft |
source_id | Unique order source ID. | 8638 |
created_at | Timestamp in ISO 8601 format representing the date and time when the order was created. | 2022-03-09T09:16:32.521Z |
updated_at | Timestamp in ISO 8601 format representing the date and time when the order was last updated. | 2022-03-09T09:16:33.331Z |
status | Order status. | PAID, CREATED, FULFILLED, CANCELED |
amount | Total amount of order items. | 7700 |
discount_amount | Represents total amount of the discount applied to whole cart. | 500 |
items_discount_amount | Represents total amount of the discount applied to order line items. | 100 |
total_discount_amount | All discounts applied to the order including discounts applied to particular order line items and discounts applied to the whole cart. | 600 |
total_amount | Total order amount after applying all discounts. | 7100 |
customer_id | Customer unique ID. | cust_2G4fUQdCXUqp35nXNleav7bO |
referrer_id | Referrer unique ID. | cust_IkrTR674vvQvr9a4rDMiqglY |
metadata | Returns all order metadata. | Response will include all order metadata. |
metadata.X | Where X is the name of a particular order metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Order. |
curl --request POST \
--url https://{cluster}.voucherify.io/v1/orders/export \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '
{
"parameters": {
"fields": [
"id",
"source_id",
"status",
"created_at",
"updated_at",
"amount",
"discount_amount",
"items_discount_amount",
"total_discount_amount",
"total_amount",
"customer_id",
"referrer_id",
"metadata.payment_mean"
]
}
}
'{
"id": "exp_pT2Y1mgYsAgRAqsWTGf7PQX7",
"object": "export",
"created_at": "2022-09-09T10:45:52.362Z",
"status": "SCHEDULED",
"channel": "API",
"exported_object": "order",
"parameters": {
"fields": [
"id",
"source_id",
"status",
"created_at",
"updated_at",
"amount",
"discount_amount",
"items_discount_amount",
"total_discount_amount",
"total_amount",
"customer_id",
"referrer_id",
"metadata.payment_mean"
]
},
"result": null,
"user_id": null
}The access token received from the authorization server in the OAuth 2.0 flow.
Specify which order parameters you would like to export.
Request body schema for POST v1/orders/export.
List of available fields and filters that can be exported with an order along with the sorting order of the returned data.
Show child attributes
How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.
-created_at, created_at, -updated_at, updated_at, -status, status Array of strings containing the data in the export. These fields define the headers in the CSV file.
id, source_id, created_at, updated_at, status, amount, discount_amount, items_discount_amount, total_discount_amount, total_amount, customer_id, referrer_id, metadata Filter conditions.
Show child attributes
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.
and, or Show child attributes
Show child attributes
Show child attributes
Data filters used to narrow down the data records to be returned in the result.
Show child attributes
Show child attributes
Data filters used to narrow down the data records to be returned in the result.
Show child attributes
Show child attributes
Data filters used to narrow down the data records to be returned in the result.
Show child attributes
Show child attributes
Data filters used to narrow down the data records to be returned in the result.
Show child attributes
Show child attributes
Data filters used to narrow down the data records to be returned in the result.
Show child attributes
Show child attributes
Data filters used to narrow down the data records to be returned in the result.
Show child attributes
Show child attributes
Data filters used to narrow down the data records to be returned in the result.
Show child attributes
Show child attributes
Data filters used to narrow down the data records to be returned in the result.
Show child attributes
Returns the id of the export object and status of the file generation process. The id is used in the Get Export method to generate the url for the downloadable CSV file or in the Download Export method to return the contents of the CSV file. The status indicates whether the file has been scheduled for creation.
Response body schema for POST v1/orders/export.
Unique export ID.
The type of object being represented. This object stores information about the export.
export Timestamp representing the date and time when the export was scheduled in ISO 8601 format.
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.
SCHEDULED Contains the URL of the CSV file.
Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE.
The type of object to be exported.
order The channel through which the export was triggered.
List of available fields and filters that can be exported with an order along with the sorting order of the returned data.
Show child attributes
How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.
-created_at, created_at, -updated_at, updated_at, -status, status Array of strings containing the data in the export. These fields define the headers in the CSV file.
id, source_id, created_at, updated_at, status, amount, discount_amount, items_discount_amount, total_discount_amount, total_amount, customer_id, referrer_id, metadata Filter conditions.
Show child attributes
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.
and, or Show child attributes
Show child attributes
Show child attributes
Data filters used to narrow down the data records to be returned in the result.
Show child attributes
Show child attributes
Data filters used to narrow down the data records to be returned in the result.
Show child attributes
Show child attributes
Data filters used to narrow down the data records to be returned in the result.
Show child attributes
Show child attributes
Data filters used to narrow down the data records to be returned in the result.
Show child attributes
Show child attributes
Data filters used to narrow down the data records to be returned in the result.
Show child attributes
Show child attributes
Data filters used to narrow down the data records to be returned in the result.
Show child attributes
Show child attributes
Data filters used to narrow down the data records to be returned in the result.
Show child attributes
Show child attributes
Data filters used to narrow down the data records to be returned in the result.
Show child attributes
Was this page helpful?