---
title: "Exports API — SpireStock REST API"
description: "Generate delivery challans, truck sheets, packing lists and sales reports as files, and download them once they are ready."
source: https://developers.spirestock.com/api-reference/exports
---

# Exports API

Generate delivery challans, truck sheets, packing lists and sales reports as files, and download them once they are ready.

Base URL: `https://api.spirestock.com/api/v1`. Every request needs an API key (`X-API-Key`) or a session token (`Authorization: Bearer`); see https://developers.spirestock.com/api-reference/auth.

## Endpoints

- [GET /exports/orders](https://developers.spirestock.com/api-reference/exports#get-exports-orders)
- [GET /exports/users](https://developers.spirestock.com/api-reference/exports#get-exports-users)
- [GET /exports/sales](https://developers.spirestock.com/api-reference/exports#get-exports-sales)
- [GET /exports/activity](https://developers.spirestock.com/api-reference/exports#get-exports-activity)
- [GET /exports/scan-logs](https://developers.spirestock.com/api-reference/exports#get-exports-scan-logs)

## GET /exports/orders

Export orders as XLSX or PDF. Supports status and date range filters.

Access: API key `read` scope; staff need Orders (8) — export.

**Parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `format` | string | no | Export format: xlsx (default) or pdf (default xlsx) |
| `status` | number | no | Filter by order status (1-4) |
| `date_from` | string | no | Start date (YYYY-MM-DD) |
| `date_to` | string | no | End date (YYYY-MM-DD) |
| `production_unit_id` | number | no | Filter by production unit |

**Example request**

```bash
curl "https://api.spirestock.com/api/v1/exports/orders?format=xlsx&date_from=2026-05-01&date_to=2026-05-31" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -o orders-export.xlsx
```

**Example response**

```
Binary file download (XLSX or PDF).
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Content-Disposition: attachment; filename="orders-2026-05.xlsx"
```

## GET /exports/users

Export user list as XLSX or PDF with optional type and status filters.

**Parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `format` | string | no | Export format: xlsx (default) or pdf (default xlsx) |
| `type` | string | no | Filter by user type: admin, employee, distributor |
| `status` | number | no | Filter by status: 1 (active), 0 (inactive) |

**Example request**

```bash
curl "https://api.spirestock.com/api/v1/exports/users?format=pdf&type=distributor" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -o users-export.pdf
```

**Example response**

```
Binary file download (XLSX or PDF).
Content-Type: application/pdf
Content-Disposition: attachment; filename="users-distributors.pdf"
```

## GET /exports/sales

Export sales report as XLSX or PDF. Includes revenue breakdown by product class and trends.

Access: API key `read` scope; staff need Sales Report (45) — export.

**Parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `format` | string | no | Export format: xlsx (default) or pdf (default xlsx) |
| `date_from` | string | no | Start date (YYYY-MM-DD) |
| `date_to` | string | no | End date (YYYY-MM-DD) |

**Example request**

```bash
curl "https://api.spirestock.com/api/v1/exports/sales?format=xlsx&date_from=2026-01-01&date_to=2026-05-31" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -o sales-report.xlsx
```

**Example response**

```
Binary file download (XLSX or PDF).
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Content-Disposition: attachment; filename="sales-report-2026.xlsx"
```

## GET /exports/activity

The activity log as XLSX (default) or PDF, newest first. At most 50,000 rows: when the cap is hit the response carries X-Export-Truncated: true and X-Export-Row-Cap: 50000, so narrow the range and export again. date_from and date_to are compared as UTC days.

Access: API key `read` scope; staff need Log In Activity Log Report (53) — export.

**Parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `format` | string | no | xlsx or pdf (default xlsx) |
| `date_from` | string | no | YYYY-MM-DD |
| `date_to` | string | no | YYYY-MM-DD (inclusive) |

**Example request**

```bash
curl -OJ "https://api.spirestock.com/api/v1/exports/activity?date_from=2024-06-01&date_to=2024-06-30" \
  -H "X-API-Key: YOUR_API_KEY"
```

**Example response**

```
HTTP/1.1 200 OK
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
X-Export-Truncated: true
X-Export-Row-Cap: 50000

(binary file; the two X-Export headers appear only when the 50,000-row cap was reached)
```

## GET /exports/scan-logs

QR scan logs as XLSX (default) or PDF, newest first, with scan type, result and who scanned. At most 50,000 rows, flagged with X-Export-Truncated: true and X-Export-Row-Cap: 50000 when the cap is hit.

Access: API key `read` scope; staff need any report sub-module (the /reports/* catch-all) — export.

**Parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `format` | string | no | xlsx or pdf (default xlsx) |
| `scan_type` | string | no | Scan type |
| `scan_result` | string | no | Scan result |
| `from` | string | no | Start date/time (ISO 8601) |
| `to` | string | no | End date/time (ISO 8601) |

**Example request**

```bash
curl -OJ "https://api.spirestock.com/api/v1/exports/scan-logs?from=2024-06-01" \
  -H "X-API-Key: YOUR_API_KEY"
```

**Example response**

```
HTTP/1.1 200 OK
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

(binary file; X-Export-Truncated: true and X-Export-Row-Cap: 50000 are added when the cap was reached)
```
