Export orders and order lines

For the general submit-and-poll flow, see Exports overview.

Request

Pass UTC dates to define the change window. Only orders with actions modified in that window will be included.

POST https://api.maestra.io/v3/operations/sync?endpointId={endpointId}&operation={operation}
Accept: application/json
Content-Type: application/json
Authorization: SecretKey {Secret key}

{
  "exportId": "<Export ID>",
  "sinceDateTimeUtc": "<Earliest order change datetime — UTC, YYYY-MM-DD hh:mm>",
  "tillDateTimeUtc": "<Latest order change datetime, exclusive — UTC, YYYY-MM-DD hh:mm>",
  "exportOutput": {
    "type": "<Export type: FTP/SFTP>",
    "directory": "<Destination folder>",
    "credentials": {
      "userName": "<Username>",
      "password": "<Password>",
      "sshPrivateKey": "<Base64-encoded SSH private key>"
    },
    "server": {
      "url": "<Server URL>",
      "port": "<Server port>"
    }
  }
}

Response

{
  "status": "<Request result: Success on success, ValidationError on user error, ProtocolError on integration error, InternalServerError when the server is unavailable>",
  "exportId": "<Export ID — pass this to the next request>",
  "isDuplicate": "<A duplicate request was detected. An export with the same settings is already running.>",
  "exportResult": {
    "processingStatus": "<File readiness status>",
    "cancellationReason": "<Cancellation reason>",
    "urls": [
      "<Result file URL>"
    ]
  }
}

File format

{
    "orders": [
        {
            "deliveryCost": "<Delivery cost>",
            "totalPrice": "<Order total with discounts>",
            "ids": {
                "externalId": "<Order external ID>"
            },
            "firstAction": {
                "dateTimeUtc": "<Order placement datetime (UTC)>",
                "ids": {
                    "mindboxId": "<Maestra ID>"
                },
                "channel": {
                    "name": "<Touchpoint name>",
                    "ids": {
                        "mindboxId": "<Maestra ID>",
                        "externalId": "<Touchpoint external ID>"
                    }
                }
            },
            "customFields": {
                "customField1": "<Order custom field>"
            },
            "customer": {
                "email": "<Email address>",
                "mobilePhone": "<Mobile phone number>",
                "pendingEmail": "<Email address pending confirmation after change>",
                "pendingMobilePhone": "<Mobile phone number pending confirmation after change>",
                "ids": {
                    "externalId": "<Customer external ID>"
                }
            },
            "area": {
                "ids": {
                    "externalId": "<Customer's geographic zone ID>"
                }
            },
            "transaction": {
                "ids": {
                    "externalId": "<Transaction ID>"
                }
            },
            "appliedPromotions": [
                {
                    "type": "<Applied promotion type>",
                    "groupingKey": "<Grouping key for applied promotions>",
                    "amount": "<Applied discount or bonus amount>",
                    "expirationDateTimeUtc": "<Points expiration datetime>",
                    "promotion": {
                        "name": "<Promotion name>",
                        "type": "<Promotion type>",
                        "ids": {
                            "mindboxId": "<Maestra ID>",
                            "externalId": "<Promotion external ID>"
                        }
                    },
                    "balanceType": {
                        "name": "<Balance name>",
                        "ids": {
                            "systemName": "<Balance system name>"
                        }
                    },
                    "coupon": {
                        "ids": {
                            "code": "<Promo code>"
                        },
                        "pool": {
                            "name": "<Promo code pool name>",
                            "description": "<Promo code pool description>",
                            "ids": {
                                "mindboxId": "<Maestra ID>",
                                "externalId": "<Promo code pool external ID>"
                            }
                        }
                    },
                    "limits": [
                        {
                            "type": "<Aggregation mode: per promotion or per customer>",
                            "untilDateTimeUtc": "<Limit expiration datetime>",
                            "amount": {
                                "type": "<Limit value type: usage count or discount amount>",
                                "value": "<Limit value>"
                            },
                            "used": {
                                "usageServiceStatus": "<Limit usage>",
                                "amount": "<Limit usage>"
                            }
                        },
                        {
                            "type": "<Aggregation mode: per promotion or per customer>",
                            "untilDateTimeUtc": "<Limit expiration datetime>",
                            "amount": {
                                "type": "<Limit value type: usage count or discount amount>",
                                "value": "<Limit value>"
                            },
                            "used": {
                                "usageServiceStatus": "<Limit usage>",
                                "amount": "<Limit usage>"
                            }
                        }
                    ]
                }
            ],
            "lines": [
                {
                    "quantity": "<Product quantity>",
                    "basePricePerItem": "<Base price per unit>",
                    "priceOfLine": "<Final line total>",
                    "number": "<Order line number>",
                    "id": "<Order line ID>",
                    "product": {
                        "name": "<Product technical name>",
                        "ids": {
                            "externalId": "<Product external ID>"
                        }
                    },
                    "giftCard": {
                        "amount": "<Face value>",
                        "status": {
                            "ids": {
                                "systemName": "<Card status system name>"
                            }
                        }
                    },
                    "customFields": {
                        "customField1": "<Line custom field>"
                    },
                    "status": {
                        "ids": {
                            "externalId": "<Order line status ID>"
                        }
                    },
                    "appliedPromotions": [
                        {
                            "type": "<Applied promotion type>",
                            "groupingKey": "<Grouping key for applied promotions>",
                            "amount": "<Applied discount or bonus amount>",
                            "expirationDateTimeUtc": "<Points expiration datetime>",
                            "promotion": {
                                "name": "<Promotion name>",
                                "type": "<Promotion type>",
                                "ids": {
                                    "mindboxId": "<Maestra ID>",
                                    "externalId": "<Promotion external ID>"
                                }
                            },
                            "balanceType": {
                                "name": "<Balance name>",
                                "ids": {
                                    "systemName": "<Balance system name>"
                                }
                            },
                            "coupon": {
                                "ids": {
                                    "code": "<Promo code>"
                                },
                                "pool": {
                                    "name": "<Promo code pool name>",
                                    "description": "<Promo code pool description>",
                                    "ids": {
                                        "mindboxId": "<Maestra ID>",
                                        "externalId": "<Promo code pool external ID>"
                                    }
                                }
                            },
                            "limits": [
                                {
                                    "type": "<Aggregation mode: per promotion or per customer>",
                                    "untilDateTimeUtc": "<Limit expiration datetime>",
                                    "amount": {
                                        "type": "<Limit value type: usage count or discount amount>",
                                        "value": "<Limit value>"
                                    },
                                    "used": {
                                        "usageServiceStatus": "<Limit usage>",
                                        "amount": "<Limit usage>"
                                    }
                                },
                                {
                                    "type": "<Aggregation mode: per promotion or per customer>",
                                    "untilDateTimeUtc": "<Limit expiration datetime>",
                                    "amount": {
                                        "type": "<Limit value type: usage count or discount amount>",
                                        "value": "<Limit value>"
                                    },
                                    "used": {
                                        "usageServiceStatus": "<Limit usage>",
                                        "amount": "<Limit usage>"
                                    }
                                }
                            ]
                        }
                    ]
                },
                {
                    "quantity": "<Product quantity>",
                    "basePricePerItem": "<Base price per unit>",
                    "priceOfLine": "<Final line total>",
                    "number": "<Order line number>",
                    "id": "<Order line ID>",
                    "product": {
                        "name": "<Product technical name>",
                        "ids": {
                            "externalId": "<Product external ID>"
                        }
                    },
                    "giftCard": {
                        "amount": "<Face value>",
                        "status": {
                            "ids": {
                                "systemName": "<Card status system name>"
                            }
                        }
                    },
                    "customFields": {
                        "coolness": "<Coolness>",
                        "ntcn": "<Ntcn>",
                        "test123": "<test123>"
                    },
                    "status": {
                        "ids": {
                            "externalId": "<Order line status ID>"
                        }
                    },
                    "appliedPromotions": [
                        {
                            "type": "<Applied promotion type>",
                            "groupingKey": "<Grouping key for applied promotions>",
                            "amount": "<Applied discount or bonus amount>",
                            "expirationDateTimeUtc": "<Points expiration datetime>",
                            "promotion": {
                                "name": "<Promotion name>",
                                "type": "<Promotion type>",
                                "ids": {
                                    "mindboxId": "<Maestra ID>",
                                    "externalId": "<Promotion external ID>"
                                }
                            },
                            "balanceType": {
                                "name": "<Balance name>",
                                "ids": {
                                    "systemName": "<Balance system name>"
                                }
                            },
                            "coupon": {
                                "ids": {
                                    "code": "<Promo code>"
                                },
                                "pool": {
                                    "name": "<Promo code pool name>",
                                    "description": "<Promo code pool description>",
                                    "ids": {
                                        "mindboxId": "<Maestra ID>",
                                        "externalId": "<Promo code pool external ID>"
                                    }
                                }
                            },
                            "limits": [
                                {
                                    "type": "<Aggregation mode: per promotion or per customer>",
                                    "untilDateTimeUtc": "<Limit expiration datetime>",
                                    "amount": {
                                        "type": "<Limit value type: usage count or discount amount>",
                                        "value": "<Limit value>"
                                    },
                                    "used": {
                                        "usageServiceStatus": "<Limit usage>",
                                        "amount": "<Limit usage>"
                                    }
                                },
                                {
                                    "type": "<Aggregation mode: per promotion or per customer>",
                                    "untilDateTimeUtc": "<Limit expiration datetime>",
                                    "amount": {
                                        "type": "<Limit value type: usage count or discount amount>",
                                        "value": "<Limit value>"
                                    },
                                    "used": {
                                        "usageServiceStatus": "<Limit usage>",
                                        "amount": "<Limit usage>"
                                    }
                                }
                            ]
                        },
                        {
                            "type": "<Applied promotion type>",
                            "groupingKey": "<Grouping key for applied promotions>",
                            "spentBonusPointsAmount": "<Points spent by the applied promotion>",
                            "amount": "<Applied discount or bonus amount>",
                            "promotion": {
                                "name": "<Promotion name>",
                                "type": "<Promotion type>",
                                "ids": {
                                    "mindboxId": "<Maestra ID>",
                                    "externalId": "<Promotion external ID>"
                                }
                            },
                            "balanceType": {
                                "name": "<Balance name>",
                                "ids": {
                                    "systemName": "<Balance system name>"
                                }
                            },
                            "coupon": {
                                "ids": {
                                    "code": "<Promo code>"
                                },
                                "pool": {
                                    "name": "<Promo code pool name>",
                                    "description": "<Promo code pool description>",
                                    "ids": {
                                        "mindboxId": "<Maestra ID>",
                                        "externalId": "<Promo code pool external ID>"
                                    }
                                }
                            },
                            "limits": [
                                {
                                    "type": "<Aggregation mode: per promotion or per customer>",
                                    "untilDateTimeUtc": "<Limit expiration datetime>",
                                    "amount": {
                                        "type": "<Limit value type: usage count or discount amount>",
                                        "value": "<Limit value>"
                                    },
                                    "used": {
                                        "usageServiceStatus": "<Limit usage>",
                                        "amount": "<Limit usage>"
                                    }
                                },
                                {
                                    "type": "<Aggregation mode: per promotion or per customer>",
                                    "untilDateTimeUtc": "<Limit expiration datetime>",
                                    "amount": {
                                        "type": "<Limit value type: usage count or discount amount>",
                                        "value": "<Limit value>"
                                    },
                                    "used": {
                                        "usageServiceStatus": "<Limit usage>",
                                        "amount": "<Limit usage>"
                                    }
                                }
                            ]
                        },
                        {
                            "type": "<Applied promotion type>",
                            "amount": "<Applied discount or bonus amount>",
                            "coupon": {
                                "ids": {
                                    "code": "<Promo code>"
                                },
                                "pool": {
                                    "name": "<Promo code pool name>",
                                    "description": "<Promo code pool description>",
                                    "ids": {
                                        "mindboxId": "<Maestra ID>",
                                        "externalId": "<Promo code pool external ID>"
                                    }
                                }
                            }
                        },
                        {
                            "type": "<Applied promotion type>",
                            "groupingKey": "<Grouping key for applied promotions>",
                            "amount": "<Applied discount or bonus amount>",
                            "promotion": {
                                "name": "<Promotion name>",
                                "type": "<Promotion type>",
                                "ids": {
                                    "mindboxId": "<Maestra ID>",
                                    "externalId": "<Promotion external ID>"
                                }
                            },
                            "coupon": {
                                "ids": {
                                    "code": "<Promo code>"
                                },
                                "pool": {
                                    "name": "<Promo code pool name>",
                                    "description": "<Promo code pool description>",
                                    "ids": {
                                        "mindboxId": "<Maestra ID>",
                                        "externalId": "<Promo code pool external ID>"
                                    }
                                }
                            },
                            "limits": [
                                {
                                    "type": "<Aggregation mode: per promotion or per customer>",
                                    "untilDateTimeUtc": "<Limit expiration datetime>",
                                    "amount": {
                                        "type": "<Limit value type: usage count or discount amount>",
                                        "value": "<Limit value>"
                                    },
                                    "used": {
                                        "usageServiceStatus": "<Limit usage>",
                                        "amount": "<Limit usage>"
                                    }
                                },
                                {
                                    "type": "<Aggregation mode: per promotion or per customer>",
                                    "untilDateTimeUtc": "<Limit expiration datetime>",
                                    "amount": {
                                        "type": "<Limit value type: usage count or discount amount>",
                                        "value": "<Limit value>"
                                    },
                                    "used": {
                                        "usageServiceStatus": "<Limit usage>",
                                        "amount": "<Limit usage>"
                                    }
                                }
                            ]
                        },
                        {
                            "type": "<Applied promotion type>",
                            "groupingKey": "<Grouping key for applied promotions>",
                            "amount": "<Applied discount or bonus amount>",
                            "promotion": {
                                "name": "<Promotion name>",
                                "type": "<Promotion type>",
                                "ids": {
                                    "mindboxId": "<Maestra ID>",
                                    "externalId": "<Promotion external ID>"
                                }
                            },
                            "coupon": {
                                "ids": {
                                    "code": "<Promo code>"
                                },
                                "pool": {
                                    "name": "<Promo code pool name>",
                                    "description": "<Promo code pool description>",
                                    "ids": {
                                        "mindboxId": "<Maestra ID>",
                                        "externalId": "<Promo code pool external ID>"
                                    }
                                }
                            },
                            "limits": [
                                {
                                    "type": "<Aggregation mode: per promotion or per customer>",
                                    "untilDateTimeUtc": "<Limit expiration datetime>",
                                    "amount": {
                                        "type": "<Limit value type: usage count or discount amount>",
                                        "value": "<Limit value>"
                                    },
                                    "used": {
                                        "usageServiceStatus": "<Limit usage>",
                                        "amount": "<Limit usage>"
                                    }
                                },
                                {
                                    "type": "<Aggregation mode: per promotion or per customer>",
                                    "untilDateTimeUtc": "<Limit expiration datetime>",
                                    "amount": {
                                        "type": "<Limit value type: usage count or discount amount>",
                                        "value": "<Limit value>"
                                    },
                                    "used": {
                                        "usageServiceStatus": "<Limit usage>",
                                        "amount": "<Limit usage>"
                                    }
                                }
                            ]
                        },
                        {
                            "type": "<Applied promotion type>",
                            "groupingKey": "<Grouping key for applied promotions>",
                            "promotion": {
                                "name": "<Promotion name>",
                                "type": "<Promotion type>",
                                "ids": {
                                    "mindboxId": "<Maestra ID>",
                                    "externalId": "<Promotion external ID>"
                                }
                            },
                            "coupon": {
                                "ids": {
                                    "code": "<Promo code>"
                                },
                                "pool": {
                                    "name": "<Promo code pool name>",
                                    "description": "<Promo code pool description>",
                                    "ids": {
                                        "mindboxId": "<Maestra ID>",
                                        "externalId": "<Promo code pool external ID>"
                                    }
                                }
                            },
                            "limits": [
                                {
                                    "type": "<Aggregation mode: per promotion or per customer>",
                                    "untilDateTimeUtc": "<Limit expiration datetime>",
                                    "amount": {
                                        "type": "<Limit value type: usage count or discount amount>",
                                        "value": "<Limit value>"
                                    },
                                    "used": {
                                        "usageServiceStatus": "<Limit usage>",
                                        "amount": "<Limit usage>"
                                    }
                                },
                                {
                                    "type": "<Aggregation mode: per promotion or per customer>",
                                    "untilDateTimeUtc": "<Limit expiration datetime>",
                                    "amount": {
                                        "type": "<Limit value type: usage count or discount amount>",
                                        "value": "<Limit value>"
                                    },
                                    "used": {
                                        "usageServiceStatus": "<Limit usage>",
                                        "amount": "<Limit usage>"
                                    }
                                }
                            ]
                        },
                        {
                            "type": "<Applied promotion type>",
                            "groupingKey": "<Grouping key for applied promotions>",
                            "promotion": {
                                "name": "<Promotion name>",
                                "type": "<Promotion type>",
                                "ids": {
                                    "mindboxId": "<Maestra ID>",
                                    "externalId": "<Promotion external ID>"
                                }
                            },
                            "coupon": {
                                "ids": {
                                    "code": "<Promo code>"
                                },
                                "pool": {
                                    "name": "<Promo code pool name>",
                                    "description": "<Promo code pool description>",
                                    "ids": {
                                        "mindboxId": "<Maestra ID>",
                                        "externalId": "<Promo code pool external ID>"
                                    }
                                }
                            },
                            "limits": [
                                {
                                    "type": "<Aggregation mode: per promotion or per customer>",
                                    "untilDateTimeUtc": "<Limit expiration datetime>",
                                    "amount": {
                                        "type": "<Limit value type: usage count or discount amount>",
                                        "value": "<Limit value>"
                                    },
                                    "used": {
                                        "usageServiceStatus": "<Limit usage>",
                                        "amount": "<Limit usage>"
                                    }
                                },
                                {
                                    "type": "<Aggregation mode: per promotion or per customer>",
                                    "untilDateTimeUtc": "<Limit expiration datetime>",
                                    "amount": {
                                        "type": "<Limit value type: usage count or discount amount>",
                                        "value": "<Limit value>"
                                    },
                                    "used": {
                                        "usageServiceStatus": "<Limit usage>",
                                        "amount": "<Limit usage>"
                                    }
                                }
                            ]
                        },
                        {
                            "type": "<Applied promotion type>",
                            "groupingKey": "<Grouping key for applied promotions>",
                            "promotion": {
                                "name": "<Promotion name>",
                                "type": "<Promotion type>",
                                "ids": {
                                    "mindboxId": "<Maestra ID>",
                                    "externalId": "<Promotion external ID>"
                                }
                            },
                            "coupon": {
                                "ids": {
                                    "code": "<Promo code>"
                                },
                                "pool": {
                                    "name": "<Promo code pool name>",
                                    "description": "<Promo code pool description>",
                                    "ids": {
                                        "mindboxId": "<Maestra ID>",
                                        "externalId": "<Promo code pool external ID>"
                                    }
                                }
                            },
                            "issuedCoupon": {
                                "ids": {
                                    "code": "<Promo code>"
                                },
                                "pool": {
                                    "name": "<Promo code pool name>",
                                    "description": "<Promo code pool description>",
                                    "ids": {
                                        "mindboxId": "<Maestra ID>",
                                        "externalId": "<Promo code pool external ID>"
                                    }
                                }
                            },
                            "limits": [
                                {
                                    "type": "<Aggregation mode: per promotion or per customer>",
                                    "untilDateTimeUtc": "<Limit expiration datetime>",
                                    "amount": {
                                        "type": "<Limit value type: usage count or discount amount>",
                                        "value": "<Limit value>"
                                    },
                                    "used": {
                                        "usageServiceStatus": "<Limit usage>",
                                        "amount": "<Limit usage>"
                                    }
                                },
                                {
                                    "type": "<Aggregation mode: per promotion or per customer>",
                                    "untilDateTimeUtc": "<Limit expiration datetime>",
                                    "amount": {
                                        "type": "<Limit value type: usage count or discount amount>",
                                        "value": "<Limit value>"
                                    },
                                    "used": {
                                        "usageServiceStatus": "<Limit usage>",
                                        "amount": "<Limit usage>"
                                    }
                                }
                            ]
                        },
                        {
                            "type": "<Applied promotion type>",
                            "amount": "<Applied discount or bonus amount>",
                            "promotion": {
                                "name": "<Promotion name>",
                                "type": "<Promotion type>",
                                "ids": {
                                    "mindboxId": "<Maestra ID>",
                                    "externalId": "<Promotion external ID>"
                                }
                            },
                            "coupon": {
                                "ids": {
                                    "code": "<Promo code>"
                                },
                                "pool": {
                                    "name": "<Promo code pool name>",
                                    "description": "<Promo code pool description>",
                                    "ids": {
                                        "mindboxId": "<Maestra ID>",
                                        "externalId": "<Promo code pool external ID>"
                                    }
                                }
                            }
                        },
                        {
                            "type": "<Applied promotion type>",
                            "amount": "<Applied discount or bonus amount>",
                            "promotion": {
                                "name": "<Promotion name>",
                                "type": "<Promotion type>",
                                "ids": {
                                    "mindboxId": "<Maestra ID>",
                                    "externalId": "<Promotion external ID>"
                                }
                            }
                        },
                        {
                            "type": "<Applied promotion type>",
                            "amount": "<Applied discount or bonus amount>",
                            "promotion": {
                                "name": "<Promotion name>",
                                "type": "<Promotion type>",
                                "ids": {
                                    "mindboxId": "<Maestra ID>",
                                    "externalId": "<Promotion external ID>"
                                }
                            }
                        }
                    ]
                }
            ],
            "bonusPointsInfoPerBalanceType": [
                {
                    "spentAmount": "<Points spent from this balance on the order so far>",
                    "earnedAmount": "<Points earned on this balance from the order so far>",
                    "balanceType": {
                        "name": "<Balance name>",
                        "ids": {
                            "systemName": "<Balance system name>"
                        }
                    }
                }
            ],
            "payments": [
                {
                    "type": "<Payment type>",
                    "id": "<Payment ID>",
                    "amount": "<Payment amount applied to the order>",
                    "creditCard": {
                        "hash": "<Card hash>"
                    }
                },
                {
                    "type": "<Payment type>",
                    "id": "<Payment ID>",
                    "amount": "<Payment amount applied to the order>",
                    "creditCard": {
                        "hash": "<Card hash>"
                    }
                }
            ]
        }
    ]
}
📘

The bonusPointsInfoPerBalanceType node only lists balances with non-zero totals for points spent or earned by promotions on this order.

If a balance had points spent or earned in one order action but those changes were later reversed (for example, on a line return), the balance won't appear in this node with zero totals.

In appliedPromotions, the type node identifies the applied promotion type.

If the applied promotion has a promo code attached, it comes back in the response. For external promo codes processed outside Maestra, the promotion node is omitted.

Supported types:

  • discount — discount, applied only at the order line level
  • deliveryDiscount — discount, applied only at the order level
  • earnedBonusPoints — bonus points earned on the order
  • spentBonusPoints — bonus points spent to pay for the order
  • issuedCoupon — coupon issued for the order
  • message — message to the customer