Skip to content

Exports

The Export object

object

Attributes

idstring

Export job ID

Other attributes
statusstring
progressnumber
total_docsnumbernullable
file_urlstringnullable
file_namestringnullable
errorstringnullable
resultobjectnullable
Examplejson
{
  "id": "expjob_clx1234567890",
  "status": "processing",
  "progress": 50,
  "total_docs": 25,
  "file_url": null,
  "file_name": "starward_documents_2024-06-01_2024-06-30.zip",
  "error": null,
  "result": null
}

Start bulk PDF export

POST/documents/export/pdf

Start a background job to export documents as a ZIP archive of PDFs.
Supports date range filtering (maximum 1 year) or specific document IDs.
When using a user access token, you will receive an email with a download link when the export is ready.
When using an API key, poll the job status endpoint for progress.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Body parameters

document_idsarray of stringsrequired

Specific document IDs to export. Types are inferred from ID prefixes.

Other parameters
localestringoptionalnullable
languagestringoptionalnullable
import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.exports.startPdfExport({
  types: [
    "invoice"
  ],
  date_from: "2024-01-01",
  date_to: "2024-12-31"
});

console.log(response);
Example:

Returns

idstring

Export job ID

Other parameters
statusstring
messagestring
json
{
  "id": "clx1234567890abcdef",
  "status": "pending",
  "message": "Export started. You will receive an email when ready."
}

Start bulk e-SLOG export

POST/documents/export/eslog

Start a background job to export valid e-SLOG XML documents as a ZIP archive.
Supports date range filtering (maximum 1 year) or specific document IDs.
Only available for Slovenian entities with e-SLOG support.
Documents without valid e-SLOG validation are skipped.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Body parameters

document_idsarray of stringsrequired

Specific document IDs to export as e-SLOG XML. Types are inferred from ID prefixes.

import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.exports.startEslogExport({
  types: [
    "invoice"
  ],
  date_from: "2024-01-01",
  date_to: "2024-12-31"
});

console.log(response);
Example:

Returns

idstring

Export job ID

Other parameters
statusstring
messagestring
json
{
  "id": "clx1234567890abcdef",
  "status": "pending",
  "message": "e-SLOG export started. Invalid or not-yet-validated documents are skipped and reported in the completed job status."
}

Export documents to Excel or CSV

GET/documents/export

Export filtered documents to Excel (XLSX) or CSV format.
Supports date range filtering (maximum 1 year) and the same query filters as list endpoints.
Returns a downloadable file with all base document fields including flattened customer/issuer data and tax breakdowns.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Query parameters

typestringoptional

Document type to export

Possible values: "invoice", "estimate", "credit_note", "advance_invoice", "delivery_note"

typesstringoptional

Comma-separated document types for a multi-sheet XLSX export. Only supported when format is xlsx.

formatstringrequired

Export format

Possible values: "xlsx", "csv"

date_fromstringoptional

Start date filter (ISO 8601 date). Date range cannot exceed 1 year.

date_tostringoptional

End date filter (ISO 8601 date). Date range cannot exceed 1 year.

languagestringoptionalnullable

Language for column headers. Defaults to the entity locale when omitted.

Possible values: "en", "de", "sl", "it", "fr", "es", "pt", "nl", "pl", "hr", "sv", "fi", "et", "bg", "cs", "sk", "nb", "is", "null"

querystringoptional

JSON query filter (same as list endpoints)

searchstringoptional

Full-text search

import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const blob = await sdk.exports.exportDocuments({
  format: "xlsx"
});

const arrayBuffer = await blob.arrayBuffer();
const { writeFile } = await import('node:fs/promises');
await writeFile('download.bin', Buffer.from(arrayBuffer));
console.log('Saved download.bin');

Export sales per item for a period

GET/documents/export/sales-per-item

Export aggregated sales data per item (product/service) for a given date range.
Includes quantities sold/returned, average price, and totals.
Aggregates across invoices, credit notes, and advance invoices.
Items are grouped by catalog item ID when available, or by exact name match.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Query parameters

formatstringrequired

Export format

Possible values: "xlsx", "csv"

date_fromstringrequired

Start date filter (ISO 8601 date). Required. Date range cannot exceed 1 year.

date_tostringrequired

End date filter (ISO 8601 date). Required. Date range cannot exceed 1 year.

languagestringoptionalnullable

Language for column headers. Defaults to the entity locale when omitted.

Possible values: "en", "de", "sl", "it", "fr", "es", "pt", "nl", "pl", "hr", "sv", "fi", "et", "bg", "cs", "sk", "nb", "is", "null"

import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const blob = await sdk.exports.exportSalesPerItem({
  format: "xlsx",
  date_from: "2024-01-01",
  date_to: "2024-12-31"
});

const arrayBuffer = await blob.arrayBuffer();
const { writeFile } = await import('node:fs/promises');
await writeFile('download.bin', Buffer.from(arrayBuffer));
console.log('Saved download.bin');

Export accrued revenue by category for a period

GET/documents/export/revenue-by-category

Export accrued revenue grouped by financial category for a given date range.
Includes invoices, standalone advance invoices, and credit notes.
Credit notes are subtracted and uncategorized lines are grouped into an 'Uncategorized' bucket.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Query parameters

formatstringrequired

Export format

Possible values: "xlsx", "csv"

date_fromstringrequired

Start date filter (ISO 8601 date). Required. Date range cannot exceed 1 year.

date_tostringrequired

End date filter (ISO 8601 date). Required. Date range cannot exceed 1 year.

languagestringoptionalnullable

Language for column headers. Defaults to the entity locale when omitted.

Possible values: "en", "de", "sl", "it", "fr", "es", "pt", "nl", "pl", "hr", "sv", "fi", "et", "bg", "cs", "sk", "nb", "is", "null"

import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const blob = await sdk.exports.exportRevenueByCategory({
  format: "xlsx",
  date_from: "2024-01-01",
  date_to: "2024-12-31"
});

const arrayBuffer = await blob.arrayBuffer();
const { writeFile } = await import('node:fs/promises');
await writeFile('download.bin', Buffer.from(arrayBuffer));
console.log('Saved download.bin');

Get PDF export job status

GET/documents/export/pdf/{jobId}

Check the status and progress of a bulk PDF export job.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Path parameters

jobIdstringrequired

Export job ID

import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.exports.getPdfStatus("expjob_clx1234567890");

console.log(response);

Returns

idstring

Export job ID

Other parameters
statusstring
progressnumber
total_docsnumbernullable
file_urlstringnullable
file_namestringnullable
errorstringnullable
resultobjectnullable
json
{
  "id": "expjob_clx1234567890",
  "status": "processing",
  "progress": 50,
  "total_docs": 25,
  "file_url": null,
  "file_name": "starward_documents_2024-06-01_2024-06-30.zip",
  "error": null,
  "result": null
}
Example:

Get e-SLOG export job status

GET/documents/export/eslog/{jobId}

Check the status and progress of a bulk e-SLOG export job.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Path parameters

jobIdstringrequired

Export job ID

import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.exports.getEslogStatus("expjob_clx1234567890");

console.log(response);

Returns

idstring

Export job ID

Other parameters
statusstring
progressnumber
total_docsnumbernullable
file_urlstringnullable
file_namestringnullable
errorstringnullable
resultobjectnullable
json
{
  "id": "expjob_clx1234567890",
  "status": "processing",
  "progress": 50,
  "total_docs": 25,
  "file_url": null,
  "file_name": "starward_documents_2024-06-01_2024-06-30.zip",
  "error": null,
  "result": null
}
Example:

Download completed PDF export archive

GET/documents/export/pdf/{jobId}/download

Download a completed PDF export ZIP archive through the authenticated API.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Path parameters

jobIdstringrequired

Export job ID

import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const blob = await sdk.exports.downloadPdfExport("expjob_clx1234567890");

const arrayBuffer = await blob.arrayBuffer();
const { writeFile } = await import('node:fs/promises');
await writeFile('download.bin', Buffer.from(arrayBuffer));
console.log('Saved download.bin');

Download completed e-SLOG export archive

GET/documents/export/eslog/{jobId}/download

Download a completed e-SLOG export ZIP archive through the authenticated API.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Path parameters

jobIdstringrequired

Export job ID

import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const blob = await sdk.exports.downloadEslogExport("expjob_clx1234567890");

const arrayBuffer = await blob.arrayBuffer();
const { writeFile } = await import('node:fs/promises');
await writeFile('download.bin', Buffer.from(arrayBuffer));
console.log('Saved download.bin');