Skip to content

Export Data

POST /api/export-data

Authentication required. Privilege requirement varies by view_name.

Exports any table view to a downloadable Excel (XLSX) file. Supports all filters, sorting, and pagination applied to the source view.


Request Body

{
  "view_name": "purchase_order_list",
  "filters": {},
  "sort": { "key": "PO List Order Date", "type": "Descending" },
  "index": { "limit": 10000, "offset": 0 }
}
Field Type Required Description
view_name string Yes The view to export - see supported views below
filters object No Filter conditions (same format as list endpoints)
sort object No Sort configuration
index object No Pagination - limit and offset

Supported View Names

Purchase Orders

purchase_order_list · purchase_order_details · purchase_order_item

Sales Orders

sales_order_list · sales_order_details · sales_order_item

Manufacturing Orders

manufacturing_order_list · manufacturing_order_details · manufacturing_order_item

Forecasts

forecast_list · forecast_details · forecast_item · forecast_over_time · forecast_vs_sales

Inventory

inventory_list · inventory_item · inventory_planning · inventory_analysis

Master Data

item_master · sub_item_master · customer_master · ship_to_master · supplier_master · ship_from_master · warehouse_master · unit_master

Other

bill_of_materials · asn_list · supplier_allocation · issue_tracker_tickets · log_list

Dashboard / Analytics

dashboard_statistics · dashboard_revenue_by_customer · dashboard_spend_by_supplier · (and others)


Response

HTTP/1.1 200 OK
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Content-Disposition: attachment; filename="export.xlsx"

<binary XLSX data>

Code Example

CSRF=$(grep csrf_access_token cookies.txt | awk '{print $NF}')

curl -b cookies.txt -X POST https://acme.knosc.com/api/export-data \
  -H "Content-Type: application/json" \
  -H "X-XSRF-TOKEN: $CSRF" \
  -o "purchase-orders.xlsx" \
  -d '{
    "view_name": "purchase_order_list",
    "sort": {"key": "PO List Order Date", "type": "Descending"}
  }'
csrf = session.cookies.get("csrf_access_token")

r = session.post(
    "https://acme.knosc.com/api/export-data",
    headers={"X-XSRF-TOKEN": csrf},
    json={
        "view_name": "purchase_order_list",
        "filters": {"PO List Document Status": "Open"}
    }
)

with open("purchase-orders.xlsx", "wb") as f:
    f.write(r.content)
print("Export saved.")

Errors

Status Code Description
400 ExcelExportWithoutExtra Export not available for this view
400 CouldNotConstructExportData Data could not be assembled for export
403 User.NotPrivileged Insufficient privilege for the view