Skip to main content

ordersExport Mutation

Description​

Exports orders to a file format (e.g., CSV, PDF) based on the provided filters. Creates a background job to process the export: poll jobs until its status is complete, then request the file with jobDownloadUrl. Only accessible to admin users. For PDF exports, limited to 100 documents, delivered as a ZIP of invoices.

mutation ordersExport(
$format: String
$exportFormat: OrdersExportFormat
$ordersFiltersInput: OrdersFiltersInput!
) {
ordersExport(
format: $format
exportFormat: $exportFormat
ordersFiltersInput: $ordersFiltersInput
) {
_id
type
created
user {
type
name
email
ref
}
task {
path
name
}
options
optionsAsString
status
hidden
results {
uri
key
message
fileSizeString
fileSize
logs
}
completion
}
}

Variables​

{
"format": "format",
"exportFormat": "csv",
"ordersFiltersInput": {
"page": 1,
"limit": 20,
"sort": "sort",
"order": -1,
"from": 1749791776178,
"to": 1772611813942,
"dateFilter": "dateFilter",
"origin": [
"origin"
],
"status": [
"status"
],
"billingStatus": [
"billingStatus"
],
"shippingStatus": [
"shippingStatus"
],
"shippingMethod": [
"shippingMethod"
],
"paymentMethods": [
"paymentMethods"
],
"itemRef": "f40615b6305c4e6d5c949140",
"preOrder": true,
"buyerRef": "36ec28b19c0779b5ce9cb5e0",
"couponRef": "9925013bdf1657c1d8addd3b",
"giftCardRef": "7d6b02e27237d1bcde3f3401",
"term": "term"
}
}

Response​

{
"ordersExport": {
"_id": "6538c0bea41a278e0d6cb891",
"type": "example",
"created": 1789077550117,
"user": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "49d22709397c6f6821e590c2"
},
"task": {
"path": "/release/1763553751/release-artist-release-name",
"name": "example"
},
"options": {},
"optionsAsString": "example",
"status": "pending",
"hidden": true,
"results": {
"uri": "https://www.my-common-ground-store.com/release/1763553751/release-artist-release-name",
"key": "example",
"message": "example",
"fileSizeString": "example",
"fileSize": 42,
"logs": [
"example"
]
},
"completion": 1.23
}
}

Arguments​

NameTypeDescription
format ⚠️StringExport file format, as a free string: "csv" or "pdf". Replaced by exportFormat. ⚠️ Deprecated: Use exportFormat.
exportFormatOrdersExportFormatExport file format: csv or pdf. Required unless the deprecated format is given.
ordersFiltersInputOrdersFiltersInput!Filters to apply when exporting orders.

Returns​

Job!