Invoices
Invoices
Invoice management operations.
Create, retrieve, and list invoices with flexible querying.
Invoices are issued by Entities to Customers and contain line items with optional taxes.
The Invoice object
Attributes
Date the invoice was created (ISO 8601 datetime at midnight UTC)
Date the invoice is due (ISO 8601 datetime at midnight UTC)
Service date in YYYY-MM-DD format. For invoices and credit notes. When it (or date_service_to, if later) falls on or before date, foreign-currency conversion uses it as the exchange-rate reference date instead of date.
Document issuer (entity) information
Customer information snapshot stored on the document. Null means no customer. When present, known customer fields are returned with null for omitted values.
Note for the document. If not provided, defaults to entity's document-type-specific note setting. Pass empty string to explicitly set no note.
Document total before tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.
Document total after tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.
Applied taxes summary
Custom string key-value data for your own use, with up to 50 properties. Keys are opaque and may contain periods. Useful for storing external IDs, tags, or integration data.
{
"id": "inv_6595a27b5d35015c3ef0c402",
"entity_id": "ent_6595a27b5d35015c3ef0c3fd",
"number": "DOC-2025-001",
"date": "2025-03-15T00:00:00.000Z",
"currency_code": "USD",
"issuer": {
"name": "Starward Equipment Co.",
"address": "1 Launchpad Way",
"city": "Cape Canaveral",
"state": "FL",
"post_code": "32920",
"country": "USA",
"country_code": "US",
"tax_number": "59-8765432"
},
"customer_id": "cus_6595a27b5d35015c3ef0c403",
"customer": {
"name": "Horizon Launch Systems Inc.",
"address": "100 Rocket Row",
"city": "Houston",
"state": "TX",
"post_code": "77058",
"country": "USA",
"country_code": "US",
"tax_number": "74-1234567"
},
"items": [
{
"id": "inv_item_6595a27b5d35015c3ef0c402",
"invoice_id": "inv_6595a27b5d35015c3ef0c402",
"advance_invoice_id": null,
"expense_id": null,
"item_id": null,
"name": "Ground Station Antenna Array",
"description": "Deep space tracking antenna with 12m dish",
"translations": {
"name": {
"de-DE": "Bodenstations-Antennenanlage"
},
"description": {
"de-DE": "Tiefraum-Tracking-Antenne mit 12-m-Parabolspiegel"
}
},
"quantity": 2,
"price": 12500,
"gross_price": null,
"taxes": [
{
"rate": 22,
"tax_id": "tax_6595a27b5d35015c3ef0c402"
}
],
"discounts": [],
"type": null,
"unit": null,
"total": 25000,
"total_with_tax": 30500,
"total_converted": null,
"total_with_tax_converted": null,
"metadata": {
"project_code": "MSN-2025-001",
"department": "Ground Operations"
},
"created_at": "2025-03-15T00:00:00.000Z",
"updated_at": "2025-03-15T00:00:00.000Z"
},
{
"id": "inv_item_6595a27b5d35015c3ef0c403",
"invoice_id": "inv_6595a27b5d35015c3ef0c402",
"advance_invoice_id": null,
"expense_id": null,
"item_id": null,
"name": "Orbital Navigation License",
"description": "Annual software license for orbital trajectory planning",
"translations": {
"name": {
"de-DE": "Orbitale Navigationslizenz"
},
"description": {
"de-DE": "Jaehrliche Softwarelizenz fuer die Planung von Orbitaltrajektorien"
}
},
"quantity": 1,
"price": 5000,
"gross_price": null,
"taxes": [
{
"rate": 22,
"tax_id": "tax_6595a27b5d35015c3ef0c402"
}
],
"discounts": [],
"type": null,
"unit": null,
"total": 5000,
"total_with_tax": 6100,
"total_converted": null,
"total_with_tax_converted": null,
"metadata": {
"license_type": "enterprise",
"seats": "50"
},
"created_at": "2025-03-15T00:00:00.000Z",
"updated_at": "2025-03-15T00:00:00.000Z"
}
],
"note": "Thank you for your order. Equipment ships within 5 business days.",
"translations": {
"note": {
"de-DE": "Vielen Dank fuer Ihre Bestellung. Die Ausruestung wird innerhalb von 5 Werktagen versendet."
},
"payment_terms": {
"de-DE": "Zahlbar innerhalb von 30 Tagen."
},
"footer": {
"de-DE": "Fragen? Kontaktieren Sie billing@starward.example."
},
"signature": {
"de-DE": "Starward Equipment Team"
}
},
"reference": "PO-2025-001",
"total": 30000,
"total_with_tax": 36600,
"total_discount": 0,
"total_converted": null,
"total_with_tax_converted": null,
"shareable_id": null,
"taxes": [
{
"base": 30000,
"rate": 22,
"amount": 6600,
"reverse_charge": false,
"tax_id": null
}
],
"date_year": 2025,
"metadata": {
"project_id": "MSN-2025-001",
"contract_id": "ORB-2024-789"
},
"created_at": "2025-03-15T00:00:00.000Z",
"updated_at": "2025-03-15T00:00:00.000Z",
"voided_at": null,
"deleted_at": null,
"exchange_rate": null,
"crypto_equivalents": null,
"rounding_correction": null,
"transaction_type": "domestic",
"tax_clause": null,
"signature": "{entity_name}",
"payment_terms": null,
"date_due": "2025-04-15T00:00:00.000Z",
"total_paid": 0,
"total_due": 36600,
"paid_in_full": false
}Create a new invoice
/invoicesCreate a new invoice with line items.
This is the recommended endpoint for normal invoice creation. Use it when Space Invoices should calculate line totals, taxes, discounts, document totals, numbering, fiscalization, customer handling, payments, and lifecycle hooks from the supplied business inputs.
Customer is optional - can be omitted for retail/convenience store sales where customer information isn't needed, or added inline without referencing a customer_id.
The invoice number is auto-generated based on the entity's number format settings.
Taxes are calculated automatically based on the tax rates provided.
For a Hungarian entity with NAV dispatch enabled, creating a non-draft invoice maps it to a NAV Online Számla submission; data that cannot be mapped responds 422 NAV_INVOICE_DATA_INVALID with an issues array.
Polish B2B issuance returns 422 KSEF_AUTH_FAILED when KSeF rejects the entity's KSeF token; no number is used.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Body parameters
Line items for the invoice. At least one item is required.
Document date in YYYY-MM-DD format
Document due date in YYYY-MM-DD format
Service date in YYYY-MM-DD format. For invoices and credit notes. When it (or date_service_to, if later) falls on or before date, foreign-currency conversion uses it as the exchange-rate reference date instead of date.
Document issuer (entity) information
Referenced Customer ID. Required if customer is not provided.
Customer recipient of the document.
Both customer and customer_id are optional - documents can be created without customer information.
If only customer_id is provided, the document customer snapshot is populated from the saved customer.
If customer is provided, the document customer snapshot is built from the explicit payload; saved customer fields are not backfilled into omitted snapshot fields.
If both customer_id and customer are provided with save_customer=true, the existing customer will be updated from explicit customer fields only. Omitted fields remain unchanged on the saved customer, and explicit null clears nullable saved customer fields.
If only customer is provided with save_customer=true (or by default), the system checks for duplicate customers using customer identifiers and reuses the existing customer if found, otherwise creates a new customer.
Note for the document. If not provided, defaults to entity settings. Pass empty string to explicitly set no note.
Custom string key-value data for your own use, with up to 50 properties. Keys are opaque and may contain periods. Useful for storing external IDs, tags, or integration data.
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.invoices.create({
items: [
{
name: "Satellite Communication Module",
quantity: 1,
price: 1500
}
]
}, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
Date the invoice was created (ISO 8601 datetime at midnight UTC)
Date the invoice is due (ISO 8601 datetime at midnight UTC)
Service date in YYYY-MM-DD format. For invoices and credit notes. When it (or date_service_to, if later) falls on or before date, foreign-currency conversion uses it as the exchange-rate reference date instead of date.
Document issuer (entity) information
Customer information snapshot stored on the document. Null means no customer. When present, known customer fields are returned with null for omitted values.
Note for the document. If not provided, defaults to entity's document-type-specific note setting. Pass empty string to explicitly set no note.
Document total before tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.
Document total after tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.
Applied taxes summary
Custom string key-value data for your own use, with up to 50 properties. Keys are opaque and may contain periods. Useful for storing external IDs, tags, or integration data.
{
"id": "inv_6595a27b5d35015c3ef0c3fd",
"entity_id": "ent_6595a27b5d35015c3ef0c3fd",
"number": "2026-00001",
"date": "2026-01-01T00:00:00.000Z",
"currency_code": "USD",
"issuer": {
"name": "Starward Equipment Co.",
"country": "United States",
"country_code": "US"
},
"customer_id": null,
"customer": null,
"items": [
{
"id": "inv_item_6595a27b5d35015c3ef0c3fd",
"invoice_id": "inv_6595a27b5d35015c3ef0c3fd",
"advance_invoice_id": null,
"expense_id": null,
"item_id": null,
"name": "Satellite Communication Module",
"description": null,
"translations": {},
"quantity": 1,
"price": 1500,
"gross_price": null,
"taxes": [],
"discounts": [],
"type": null,
"unit": null,
"total": 1500,
"total_with_tax": 1500,
"total_converted": null,
"total_with_tax_converted": null,
"metadata": {},
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}
],
"note": null,
"translations": {},
"reference": null,
"total": 1500,
"total_with_tax": 1500,
"total_discount": 0,
"total_converted": null,
"total_with_tax_converted": null,
"shareable_id": null,
"taxes": [
{
"rate": null,
"tax_id": null,
"base": 1500,
"amount": 0,
"reverse_charge": false
}
],
"date_year": 2026,
"metadata": {},
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z",
"voided_at": null,
"deleted_at": null,
"exchange_rate": null,
"crypto_equivalents": null,
"rounding_correction": null,
"transaction_type": "domestic",
"tax_clause": null,
"signature": "{entity_name}",
"payment_terms": null,
"date_due": "2026-02-01T00:00:00.000Z",
"total_paid": 0,
"total_due": 1500,
"paid_in_full": false
}Create invoice with pre-calculated totals
/invoices/customUnavailable for Spanish entities, including drafts; use the standard document routes. Spanish fiscalization input is not accepted. Advanced endpoint for importing invoices that already have authoritative pre-calculated totals. Do not use this for normal invoice creation. Prefer the standard create endpoint unless your integration must preserve exact external totals from an ERP, OCR, migration, or accounting system.
The caller provides total, total_with_tax, total_discount, and taxes at the document level, and total/total_with_tax on each line item.
When calculation_mode is omitted, Space Invoices preserves pass-through behavior and accepts the supplied totals as-is.
When calculation_mode is provided, Space Invoices validates the supplied totals against that calculation mode before creating the document.
Portugal: ordinary custom creation is unavailable (422). Dedicated manual recovery requires pt.manual: true, an active manual series, and the original paper-document reference; the manual flag alone is insufficient. This does not enable importing invoices issued by another invoicing system.
All other logic (numbering, fiscalization, customer handling, payments, lifecycle hooks) is identical to the standard create endpoint.
For a Hungarian entity with NAV dispatch enabled, creating a non-draft invoice maps it to a NAV Online Számla submission; data that cannot be mapped responds 422 NAV_INVOICE_DATA_INVALID with an issues array.
Polish B2B issuance returns 422 KSEF_AUTH_FAILED when KSeF rejects the entity's KSeF token; no number is used.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Body parameters
Line items with pre-calculated totals. At least one item is required.
Document party snapshot accepted on create and update requests. Same shape as DocumentEntity; an explicit null bank account type is treated as omitted.
Referenced Customer ID.
Customer recipient of the document.
Both customer and customer_id are optional - documents can be created without customer information.
If only customer_id is provided, the document customer snapshot is populated from the saved customer.
If customer is provided, the document customer snapshot is built from the explicit payload; saved customer fields are not backfilled into omitted snapshot fields.
If both customer_id and customer are provided with save_customer=true, the existing customer will be updated from explicit customer fields only. Omitted fields remain unchanged on the saved customer, and explicit null clears nullable saved customer fields.
If only customer is provided with save_customer=true (or by default), the system checks for duplicate customers using customer identifiers and reuses the existing customer if found, otherwise creates a new customer.
Note for the document. If not provided, defaults to entity settings. Pass empty string to explicitly set no note.
Pre-calculated document total (before tax).
Pre-calculated document total (after tax).
Custom string key-value data for your own use, with up to 50 properties. Keys are opaque and may contain periods. Useful for storing external IDs, tags, or integration data.
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.invoices.createCustom({
total: 1500,
total_with_tax: 1830,
taxes: [
{
rate: 22,
base: 1500,
amount: 330
}
],
items: [
{
name: "Imported Service",
quantity: 1,
price: 1500,
total: 1500,
total_with_tax: 1830,
taxes: [
{
rate: 22
}
]
}
]
}, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
Date the invoice was created (ISO 8601 datetime at midnight UTC)
Date the invoice is due (ISO 8601 datetime at midnight UTC)
Service date in YYYY-MM-DD format. For invoices and credit notes. When it (or date_service_to, if later) falls on or before date, foreign-currency conversion uses it as the exchange-rate reference date instead of date.
Document issuer (entity) information
Customer information snapshot stored on the document. Null means no customer. When present, known customer fields are returned with null for omitted values.
Note for the document. If not provided, defaults to entity's document-type-specific note setting. Pass empty string to explicitly set no note.
Document total before tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.
Document total after tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.
Applied taxes summary
Custom string key-value data for your own use, with up to 50 properties. Keys are opaque and may contain periods. Useful for storing external IDs, tags, or integration data.
{
"id": "inv_6595a27b5d35015c3ef0c3fd",
"entity_id": "ent_6595a27b5d35015c3ef0c3fd",
"number": "2026-00001",
"date": "2026-01-01T00:00:00.000Z",
"currency_code": "USD",
"issuer": {
"name": "Starward Equipment Co.",
"country": "United States",
"country_code": "US"
},
"customer_id": null,
"customer": null,
"items": [
{
"id": "inv_item_6595a27b5d35015c3ef0c3fd",
"invoice_id": "inv_6595a27b5d35015c3ef0c3fd",
"advance_invoice_id": null,
"expense_id": null,
"item_id": null,
"name": "Satellite Communication Module",
"description": null,
"translations": {},
"quantity": 1,
"price": 1500,
"gross_price": null,
"taxes": [],
"discounts": [],
"type": null,
"unit": null,
"total": 1500,
"total_with_tax": 1500,
"total_converted": null,
"total_with_tax_converted": null,
"metadata": {},
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}
],
"note": null,
"translations": {},
"reference": null,
"total": 1500,
"total_with_tax": 1500,
"total_discount": 0,
"total_converted": null,
"total_with_tax_converted": null,
"shareable_id": null,
"taxes": [
{
"rate": null,
"tax_id": null,
"base": 1500,
"amount": 0,
"reverse_charge": false
}
],
"date_year": 2026,
"metadata": {},
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z",
"voided_at": null,
"deleted_at": null,
"exchange_rate": null,
"crypto_equivalents": null,
"rounding_correction": null,
"transaction_type": "domestic",
"tax_clause": null,
"signature": "{entity_name}",
"payment_terms": null,
"date_due": "2026-02-01T00:00:00.000Z",
"total_paid": 0,
"total_due": 1500,
"paid_in_full": false
}List all invoices
/invoicesRetrieve a paginated list of invoices with optional filtering and sorting.
Supports cursor-based pagination, flexible JSON querying with MongoDB-style operators, full-text search, and sorting. Filter invoices that contain a saved catalog item with {"items.item_id":"item_..."}.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Query parameters
Number of results per request.
Default: 10
Opaque cursor to fetch the next page of results. Reuse only with the same effective ordering. Use the value from pagination.next_cursor in the previous response.
Opaque cursor to fetch the previous page of results. Reuse only with the same effective ordering. Use the value from pagination.prev_cursor in the previous response.
Whether to include the total count of items in pagination.total.
Default is true.
When false, pagination.total returns -1 for better performance.
Sort invoices by one field or provide a repeated array for multi-column ordering. Use total_due for the smallest outstanding amount first or -total_due for the largest outstanding amount first. Prefix any supported field with - for descending order. When paginating, reuse cursors only with the same effective ordering.
JSON query object for filtering results. Supports MongoDB-style operators.
Array columns (such as an item's categories) compare as sets: a direct value asks whether the list contains it, contains takes an array and requires all of them, in matches any of them, and notIn matches none. Scalar operators such as gt do not apply and are ignored.
Supported operators:
- equals or direct value - Exact match (default)
- gte - Greater than or equal
- lte - Less than or equal
- gt - Greater than
- lt - Less than
- in - Value in array
- notIn - Value not in array
- contains - String contains (case-insensitive)
- startsWith - String starts with
- endsWith - String ends with
- between - Value between two numbers/dates [min, max]
Allowed fields: id, number, customer_id, date, customer, customer.name, customer.email, customer.address, customer.city, customer.country, total, total_with_tax, items.name, items.description, payments.type, payments.date, document_relations.relation_type, document_relations.target_type, metadata, created_at, updated_at, paid_in_full, voided_at, is_draft, date_due, paid_in_full, total_due, total_paid, voided_at, items.item_id
Examples:
- {"total": {"gte": 1000}} - Invoices over 1000
- {"customer.name": {"contains": "Acme"}} - Customer name contains "Acme"
- {"date": {"between": ["2025-01-01", "2025-12-31"]}} - Date range
Full-text search query to filter results across multiple fields.
Searches are case-insensitive and match partial strings.
Searches across all text fields including names, descriptions, addresses, and metadata values.
Comma-separated list of relations to include in the response.
Available relations:
- payments - Payment records linked to this invoice
- document_relations - Linked documents (credit notes, advance invoices, etc.)
Usage:?include=payments?include=payments,document_relations
When true, returns only soft-deleted (trashed) items. Default false excludes deleted items.
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.invoices.list({
limit: 20,
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
Pagination metadata including cursors and result counts
{
"data": [
{
"id": "inv_6595a27b5d35015c3ef0c402",
"entity_id": "ent_6595a27b5d35015c3ef0c3fd",
"number": "DOC-2025-001",
"date": "2025-03-15T00:00:00.000Z",
"currency_code": "USD",
"issuer": {
"name": "Starward Equipment Co.",
"address": "1 Launchpad Way",
"city": "Cape Canaveral",
"state": "FL",
"post_code": "32920",
"country": "USA",
"country_code": "US",
"tax_number": "59-8765432"
},
"customer_id": "cus_6595a27b5d35015c3ef0c403",
"customer": {
"name": "Horizon Launch Systems Inc.",
"address": "100 Rocket Row",
"city": "Houston",
"state": "TX",
"post_code": "77058",
"country": "USA",
"country_code": "US",
"tax_number": "74-1234567"
},
"items": [
{
"id": "inv_item_6595a27b5d35015c3ef0c402",
"invoice_id": "inv_6595a27b5d35015c3ef0c402",
"advance_invoice_id": null,
"expense_id": null,
"item_id": null,
"name": "Ground Station Antenna Array",
"description": "Deep space tracking antenna with 12m dish",
"translations": {
"name": {
"de-DE": "Bodenstations-Antennenanlage"
},
"description": {
"de-DE": "Tiefraum-Tracking-Antenne mit 12-m-Parabolspiegel"
}
},
"quantity": 2,
"price": 12500,
"gross_price": null,
"taxes": [
{
"rate": 22,
"tax_id": "tax_6595a27b5d35015c3ef0c402"
}
],
"discounts": [],
"type": null,
"unit": null,
"total": 25000,
"total_with_tax": 30500,
"total_converted": null,
"total_with_tax_converted": null,
"metadata": {
"project_code": "MSN-2025-001",
"department": "Ground Operations"
},
"created_at": "2025-03-15T00:00:00.000Z",
"updated_at": "2025-03-15T00:00:00.000Z"
},
{
"id": "inv_item_6595a27b5d35015c3ef0c403",
"invoice_id": "inv_6595a27b5d35015c3ef0c402",
"advance_invoice_id": null,
"expense_id": null,
"item_id": null,
"name": "Orbital Navigation License",
"description": "Annual software license for orbital trajectory planning",
"translations": {
"name": {
"de-DE": "Orbitale Navigationslizenz"
},
"description": {
"de-DE": "Jaehrliche Softwarelizenz fuer die Planung von Orbitaltrajektorien"
}
},
"quantity": 1,
"price": 5000,
"gross_price": null,
"taxes": [
{
"rate": 22,
"tax_id": "tax_6595a27b5d35015c3ef0c402"
}
],
"discounts": [],
"type": null,
"unit": null,
"total": 5000,
"total_with_tax": 6100,
"total_converted": null,
"total_with_tax_converted": null,
"metadata": {
"license_type": "enterprise",
"seats": "50"
},
"created_at": "2025-03-15T00:00:00.000Z",
"updated_at": "2025-03-15T00:00:00.000Z"
}
],
"note": "Thank you for your order. Equipment ships within 5 business days.",
"translations": {
"note": {
"de-DE": "Vielen Dank fuer Ihre Bestellung. Die Ausruestung wird innerhalb von 5 Werktagen versendet."
},
"payment_terms": {
"de-DE": "Zahlbar innerhalb von 30 Tagen."
},
"footer": {
"de-DE": "Fragen? Kontaktieren Sie billing@starward.example."
},
"signature": {
"de-DE": "Starward Equipment Team"
}
},
"reference": "PO-2025-001",
"total": 30000,
"total_with_tax": 36600,
"total_discount": 0,
"total_converted": null,
"total_with_tax_converted": null,
"shareable_id": null,
"taxes": [
{
"base": 30000,
"rate": 22,
"amount": 6600,
"reverse_charge": false,
"tax_id": null
}
],
"date_year": 2025,
"metadata": {
"project_id": "MSN-2025-001",
"contract_id": "ORB-2024-789"
},
"created_at": "2025-03-15T00:00:00.000Z",
"updated_at": "2025-03-15T00:00:00.000Z",
"voided_at": null,
"deleted_at": null,
"exchange_rate": null,
"crypto_equivalents": null,
"rounding_correction": null,
"transaction_type": "domestic",
"tax_clause": null,
"signature": "{entity_name}",
"payment_terms": null,
"date_due": "2025-04-15T00:00:00.000Z",
"total_paid": 0,
"total_due": 36600,
"paid_in_full": false
}
],
"pagination": {
"total": 1,
"next_cursor": null,
"prev_cursor": null,
"has_more": false
}
}Get invoice by ID
/invoices/{id}Retrieve a single invoice by its unique identifier. Returns the complete invoice details including all line items, customer information, and calculated totals.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Unique resource identifier. Prefix depends on the resource, for example inv_, cus_, or ent_.
Query parameters
Comma-separated list of relations to include in the response.
Available relations:
- payments - Payment records linked to this invoice
- document_relations - Linked documents (credit notes, advance invoices, etc.)
Usage:?include=payments?include=payments,document_relations
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.invoices.get('inv_6595a27b5d35015c3ef0c3fd', undefined, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
Date the invoice was created (ISO 8601 datetime at midnight UTC)
Date the invoice is due (ISO 8601 datetime at midnight UTC)
Service date in YYYY-MM-DD format. For invoices and credit notes. When it (or date_service_to, if later) falls on or before date, foreign-currency conversion uses it as the exchange-rate reference date instead of date.
Document issuer (entity) information
Customer information snapshot stored on the document. Null means no customer. When present, known customer fields are returned with null for omitted values.
Note for the document. If not provided, defaults to entity's document-type-specific note setting. Pass empty string to explicitly set no note.
Document total before tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.
Document total after tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.
Applied taxes summary
Custom string key-value data for your own use, with up to 50 properties. Keys are opaque and may contain periods. Useful for storing external IDs, tags, or integration data.
{
"id": "inv_6595a27b5d35015c3ef0c402",
"entity_id": "ent_6595a27b5d35015c3ef0c3fd",
"number": "DOC-2025-001",
"date": "2025-03-15T00:00:00.000Z",
"currency_code": "USD",
"issuer": {
"name": "Starward Equipment Co.",
"address": "1 Launchpad Way",
"city": "Cape Canaveral",
"state": "FL",
"post_code": "32920",
"country": "USA",
"country_code": "US",
"tax_number": "59-8765432"
},
"customer_id": "cus_6595a27b5d35015c3ef0c403",
"customer": {
"name": "Horizon Launch Systems Inc.",
"address": "100 Rocket Row",
"city": "Houston",
"state": "TX",
"post_code": "77058",
"country": "USA",
"country_code": "US",
"tax_number": "74-1234567"
},
"items": [
{
"id": "inv_item_6595a27b5d35015c3ef0c402",
"invoice_id": "inv_6595a27b5d35015c3ef0c402",
"advance_invoice_id": null,
"expense_id": null,
"item_id": null,
"name": "Ground Station Antenna Array",
"description": "Deep space tracking antenna with 12m dish",
"translations": {
"name": {
"de-DE": "Bodenstations-Antennenanlage"
},
"description": {
"de-DE": "Tiefraum-Tracking-Antenne mit 12-m-Parabolspiegel"
}
},
"quantity": 2,
"price": 12500,
"gross_price": null,
"taxes": [
{
"rate": 22,
"tax_id": "tax_6595a27b5d35015c3ef0c402"
}
],
"discounts": [],
"type": null,
"unit": null,
"total": 25000,
"total_with_tax": 30500,
"total_converted": null,
"total_with_tax_converted": null,
"metadata": {
"project_code": "MSN-2025-001",
"department": "Ground Operations"
},
"created_at": "2025-03-15T00:00:00.000Z",
"updated_at": "2025-03-15T00:00:00.000Z"
},
{
"id": "inv_item_6595a27b5d35015c3ef0c403",
"invoice_id": "inv_6595a27b5d35015c3ef0c402",
"advance_invoice_id": null,
"expense_id": null,
"item_id": null,
"name": "Orbital Navigation License",
"description": "Annual software license for orbital trajectory planning",
"translations": {
"name": {
"de-DE": "Orbitale Navigationslizenz"
},
"description": {
"de-DE": "Jaehrliche Softwarelizenz fuer die Planung von Orbitaltrajektorien"
}
},
"quantity": 1,
"price": 5000,
"gross_price": null,
"taxes": [
{
"rate": 22,
"tax_id": "tax_6595a27b5d35015c3ef0c402"
}
],
"discounts": [],
"type": null,
"unit": null,
"total": 5000,
"total_with_tax": 6100,
"total_converted": null,
"total_with_tax_converted": null,
"metadata": {
"license_type": "enterprise",
"seats": "50"
},
"created_at": "2025-03-15T00:00:00.000Z",
"updated_at": "2025-03-15T00:00:00.000Z"
}
],
"note": "Thank you for your order. Equipment ships within 5 business days.",
"translations": {
"note": {
"de-DE": "Vielen Dank fuer Ihre Bestellung. Die Ausruestung wird innerhalb von 5 Werktagen versendet."
},
"payment_terms": {
"de-DE": "Zahlbar innerhalb von 30 Tagen."
},
"footer": {
"de-DE": "Fragen? Kontaktieren Sie billing@starward.example."
},
"signature": {
"de-DE": "Starward Equipment Team"
}
},
"reference": "PO-2025-001",
"total": 30000,
"total_with_tax": 36600,
"total_discount": 0,
"total_converted": null,
"total_with_tax_converted": null,
"shareable_id": null,
"taxes": [
{
"base": 30000,
"rate": 22,
"amount": 6600,
"reverse_charge": false,
"tax_id": null
}
],
"date_year": 2025,
"metadata": {
"project_id": "MSN-2025-001",
"contract_id": "ORB-2024-789"
},
"created_at": "2025-03-15T00:00:00.000Z",
"updated_at": "2025-03-15T00:00:00.000Z",
"voided_at": null,
"deleted_at": null,
"exchange_rate": null,
"crypto_equivalents": null,
"rounding_correction": null,
"transaction_type": "domestic",
"tax_clause": null,
"signature": "{entity_name}",
"payment_terms": null,
"date_due": "2025-04-15T00:00:00.000Z",
"total_paid": 0,
"total_due": 36600,
"paid_in_full": false
}Update an invoice
/invoices/{id}Update an existing invoice.
Creates a version snapshot before applying changes.
Cannot update voided or FURS-fiscalized invoices. Italian invoices and credit notes are immutable once issued, including pending or rejected SdI submissions; use the supported correction flow. Draft item edits use rate-level VAT rounding, and edits or finalization based on a concurrently changed Italian draft fail with 422 until reloaded.
If items are provided, they replace all existing items.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Unique resource identifier. Prefix depends on the resource, for example inv_, cus_, or ent_.
Body parameters
Payment due date (YYYY-MM-DD or ISO datetime format). Set to null to clear.
Service/work date or start of service period. Set to null to clear. When it (or date_service_to, if later) falls on or before date, foreign-currency conversion uses it as the exchange-rate reference date instead of date. Changing it re-derives the rate on drafts and estimates; issued documents and manual rates keep their stored rate.
Document party snapshot accepted on create and update requests. Same shape as DocumentEntity; an explicit null bank account type is treated as omitted.
Referenced Customer ID. Set to null to remove customer reference.
Customer recipient of the document.
Both customer and customer_id are optional - documents can be created without customer information.
If only customer_id is provided, the document customer snapshot is populated from the saved customer.
If customer is provided, the document customer snapshot is built from the explicit payload; saved customer fields are not backfilled into omitted snapshot fields.
If both customer_id and customer are provided with save_customer=true, the existing customer will be updated from explicit customer fields only. Omitted fields remain unchanged on the saved customer, and explicit null clears nullable saved customer fields.
If only customer is provided with save_customer=true (or by default), the system checks for duplicate customers using customer identifiers and reuses the existing customer if found, otherwise creates a new customer.
Document note/memo. Set to null to clear.
Custom metadata object. Set to null to clear.
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.invoices.update('inv_6595a27b5d35015c3ef0c3fd', {
note: "Payment received. Thank you!",
change_reason: "Added thank you note after payment"
}, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
Date the invoice was created (ISO 8601 datetime at midnight UTC)
Date the invoice is due (ISO 8601 datetime at midnight UTC)
Service date in YYYY-MM-DD format. For invoices and credit notes. When it (or date_service_to, if later) falls on or before date, foreign-currency conversion uses it as the exchange-rate reference date instead of date.
Document issuer (entity) information
Customer information snapshot stored on the document. Null means no customer. When present, known customer fields are returned with null for omitted values.
Note for the document. If not provided, defaults to entity's document-type-specific note setting. Pass empty string to explicitly set no note.
Document total before tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.
Document total after tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.
Applied taxes summary
Custom string key-value data for your own use, with up to 50 properties. Keys are opaque and may contain periods. Useful for storing external IDs, tags, or integration data.
{
"id": "inv_6595a27b5d35015c3ef0c402",
"entity_id": "ent_6595a27b5d35015c3ef0c3fd",
"number": "DOC-2025-001",
"date": "2025-03-15T00:00:00.000Z",
"currency_code": "USD",
"issuer": {
"name": "Starward Equipment Co.",
"address": "1 Launchpad Way",
"city": "Cape Canaveral",
"state": "FL",
"post_code": "32920",
"country": "USA",
"country_code": "US",
"tax_number": "59-8765432"
},
"customer_id": "cus_6595a27b5d35015c3ef0c403",
"customer": {
"name": "Horizon Launch Systems Inc.",
"address": "100 Rocket Row",
"city": "Houston",
"state": "TX",
"post_code": "77058",
"country": "USA",
"country_code": "US",
"tax_number": "74-1234567"
},
"items": [
{
"id": "inv_item_6595a27b5d35015c3ef0c402",
"invoice_id": "inv_6595a27b5d35015c3ef0c402",
"advance_invoice_id": null,
"expense_id": null,
"item_id": null,
"name": "Ground Station Antenna Array",
"description": "Deep space tracking antenna with 12m dish",
"translations": {
"name": {
"de-DE": "Bodenstations-Antennenanlage"
},
"description": {
"de-DE": "Tiefraum-Tracking-Antenne mit 12-m-Parabolspiegel"
}
},
"quantity": 2,
"price": 12500,
"gross_price": null,
"taxes": [
{
"rate": 22,
"tax_id": "tax_6595a27b5d35015c3ef0c402"
}
],
"discounts": [],
"type": null,
"unit": null,
"total": 25000,
"total_with_tax": 30500,
"total_converted": null,
"total_with_tax_converted": null,
"metadata": {
"project_code": "MSN-2025-001",
"department": "Ground Operations"
},
"created_at": "2025-03-15T00:00:00.000Z",
"updated_at": "2025-03-15T00:00:00.000Z"
},
{
"id": "inv_item_6595a27b5d35015c3ef0c403",
"invoice_id": "inv_6595a27b5d35015c3ef0c402",
"advance_invoice_id": null,
"expense_id": null,
"item_id": null,
"name": "Orbital Navigation License",
"description": "Annual software license for orbital trajectory planning",
"translations": {
"name": {
"de-DE": "Orbitale Navigationslizenz"
},
"description": {
"de-DE": "Jaehrliche Softwarelizenz fuer die Planung von Orbitaltrajektorien"
}
},
"quantity": 1,
"price": 5000,
"gross_price": null,
"taxes": [
{
"rate": 22,
"tax_id": "tax_6595a27b5d35015c3ef0c402"
}
],
"discounts": [],
"type": null,
"unit": null,
"total": 5000,
"total_with_tax": 6100,
"total_converted": null,
"total_with_tax_converted": null,
"metadata": {
"license_type": "enterprise",
"seats": "50"
},
"created_at": "2025-03-15T00:00:00.000Z",
"updated_at": "2025-03-15T00:00:00.000Z"
}
],
"note": "Thank you for your order. Equipment ships within 5 business days.",
"translations": {
"note": {
"de-DE": "Vielen Dank fuer Ihre Bestellung. Die Ausruestung wird innerhalb von 5 Werktagen versendet."
},
"payment_terms": {
"de-DE": "Zahlbar innerhalb von 30 Tagen."
},
"footer": {
"de-DE": "Fragen? Kontaktieren Sie billing@starward.example."
},
"signature": {
"de-DE": "Starward Equipment Team"
}
},
"reference": "PO-2025-001",
"total": 30000,
"total_with_tax": 36600,
"total_discount": 0,
"total_converted": null,
"total_with_tax_converted": null,
"shareable_id": null,
"taxes": [
{
"base": 30000,
"rate": 22,
"amount": 6600,
"reverse_charge": false,
"tax_id": null
}
],
"date_year": 2025,
"metadata": {
"project_id": "MSN-2025-001",
"contract_id": "ORB-2024-789"
},
"created_at": "2025-03-15T00:00:00.000Z",
"updated_at": "2025-03-15T00:00:00.000Z",
"voided_at": null,
"deleted_at": null,
"exchange_rate": null,
"crypto_equivalents": null,
"rounding_correction": null,
"transaction_type": "domestic",
"tax_clause": null,
"signature": "{entity_name}",
"payment_terms": null,
"date_due": "2025-04-15T00:00:00.000Z",
"total_paid": 0,
"total_due": 36600,
"paid_in_full": false
}Void an invoice
/invoices/{id}/voidVoid an invoice for technical reasons (duplicate, error, etc.). For FURS-fiscalized invoices, automatically submits technical cancellation to FURS and creates a credit note. For TicketBAI, requires a reason and retains a signed annulment for an eligible unpaid ordinary invoice with confirmed delivery. Returns the invoice with ticketbai.cancellation status; repeated calls reuse the cancellation. Uncertain original delivery returns 409; ineligible invoices return 422. For business corrections, create a credit note instead.
Polish B2B issuance returns 422 KSEF_AUTH_FAILED when KSeF rejects the entity's KSeF token; no number is used.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Unique resource identifier. Prefix depends on the resource, for example inv_, cus_, or ent_.
Body parameters
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.invoices.void('inv_6595a27b5d35015c3ef0c3fd', {
reason: "Duplicate invoice created by mistake"
}, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
Date the invoice was created (ISO 8601 datetime at midnight UTC)
Date the invoice is due (ISO 8601 datetime at midnight UTC)
Service date in YYYY-MM-DD format. For invoices and credit notes. When it (or date_service_to, if later) falls on or before date, foreign-currency conversion uses it as the exchange-rate reference date instead of date.
Document issuer (entity) information
Customer information snapshot stored on the document. Null means no customer. When present, known customer fields are returned with null for omitted values.
Note for the document. If not provided, defaults to entity's document-type-specific note setting. Pass empty string to explicitly set no note.
Document total before tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.
Document total after tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.
Applied taxes summary
Custom string key-value data for your own use, with up to 50 properties. Keys are opaque and may contain periods. Useful for storing external IDs, tags, or integration data.
{
"id": "inv_abc123",
"voided_at": "2026-01-20T12:00:00.000Z"
}Get invoice version history
/invoices/{id}/versionsRetrieve the version history for an invoice. Each version represents the document state before an update was applied.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Unique resource identifier. Prefix depends on the resource, for example inv_, cus_, or ent_.
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.invoices.getVersions('inv_6595a27b5d35015c3ef0c3fd', {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
{
"versions": [
{
"id": "ver_abc123",
"document_type": "invoice",
"document_id": "inv_6595a27b5d35015c3ef0c3fd",
"version": 2,
"snapshot": {
"id": "inv_6595a27b5d35015c3ef0c3fd",
"entity_id": "ent_6595a27b5d35015c3ef0c3fd",
"number": "2026-00001",
"date": "2026-01-01T00:00:00.000Z",
"currency_code": "USD",
"issuer": {
"name": "Starward Equipment Co.",
"country": "United States",
"country_code": "US"
},
"customer_id": null,
"customer": null,
"items": [
{
"id": "inv_item_6595a27b5d35015c3ef0c3fd",
"invoice_id": "inv_6595a27b5d35015c3ef0c3fd",
"advance_invoice_id": null,
"expense_id": null,
"item_id": null,
"name": "Satellite Communication Module",
"description": null,
"translations": {},
"quantity": 1,
"price": 1500,
"gross_price": null,
"taxes": [],
"discounts": [],
"type": null,
"unit": null,
"total": 1500,
"total_with_tax": 1500,
"total_converted": null,
"total_with_tax_converted": null,
"metadata": {},
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}
],
"note": null,
"translations": {},
"reference": null,
"total": 1500,
"total_with_tax": 1500,
"total_discount": 0,
"total_converted": null,
"total_with_tax_converted": null,
"shareable_id": null,
"taxes": [
{
"rate": null,
"tax_id": null,
"base": 1500,
"amount": 0,
"reverse_charge": false
}
],
"date_year": 2026,
"metadata": {},
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z",
"voided_at": null,
"deleted_at": null,
"exchange_rate": null,
"crypto_equivalents": null,
"rounding_correction": null,
"transaction_type": "domestic",
"vies": null,
"tax_clause": null,
"signature": "{entity_name}",
"payment_terms": null,
"date_due": "2026-02-01T00:00:00.000Z",
"total_paid": 0,
"total_due": 1500,
"paid_in_full": false,
"furs": null,
"fina": null
},
"changed_fields": [
"note"
],
"user": {
"id": "usr_123",
"name": "Alex Carter",
"email": "alex.carter@starward.example"
},
"reason": "Added payment confirmation",
"created_at": "2025-01-15T10:30:00.000Z"
},
{
"id": "ver_xyz789",
"document_type": "invoice",
"document_id": "inv_6595a27b5d35015c3ef0c3fd",
"version": 1,
"snapshot": {
"id": "inv_6595a27b5d35015c3ef0c3fd",
"entity_id": "ent_6595a27b5d35015c3ef0c3fd",
"number": "2026-00001",
"date": "2026-01-01T00:00:00.000Z",
"currency_code": "USD",
"issuer": {
"name": "Starward Equipment Co.",
"country": "United States",
"country_code": "US"
},
"customer_id": null,
"customer": null,
"items": [
{
"id": "inv_item_6595a27b5d35015c3ef0c3fd",
"invoice_id": "inv_6595a27b5d35015c3ef0c3fd",
"advance_invoice_id": null,
"expense_id": null,
"item_id": null,
"name": "Satellite Communication Module",
"description": null,
"translations": {},
"quantity": 1,
"price": 1500,
"gross_price": null,
"taxes": [],
"discounts": [],
"type": null,
"unit": null,
"total": 1500,
"total_with_tax": 1500,
"total_converted": null,
"total_with_tax_converted": null,
"metadata": {},
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}
],
"note": null,
"translations": {},
"reference": null,
"total": 1500,
"total_with_tax": 1500,
"total_discount": 0,
"total_converted": null,
"total_with_tax_converted": null,
"shareable_id": null,
"taxes": [
{
"rate": null,
"tax_id": null,
"base": 1500,
"amount": 0,
"reverse_charge": false
}
],
"date_year": 2026,
"metadata": {},
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z",
"voided_at": null,
"deleted_at": null,
"exchange_rate": null,
"crypto_equivalents": null,
"rounding_correction": null,
"transaction_type": "domestic",
"vies": null,
"tax_clause": null,
"signature": "{entity_name}",
"payment_terms": null,
"date_due": "2026-02-01T00:00:00.000Z",
"total_paid": 0,
"total_due": 1500,
"paid_in_full": false,
"furs": null,
"fina": null
},
"changed_fields": [
"items"
],
"user": {
"id": "usr_123",
"name": "Alex Carter",
"email": "alex.carter@starward.example"
},
"reason": "Corrected line items",
"created_at": "2025-01-14T15:00:00.000Z"
}
],
"count": 2
}Get specific invoice version
/invoices/{id}/versions/{version}Retrieve a specific version snapshot of an invoice.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Invoice ID
Version number
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.invoices.getVersion('inv_6595a27b5d35015c3ef0c3fd', 1, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
Version record ID
{
"id": "ver_abc123",
"document_type": "invoice",
"document_id": "inv_6595a27b5d35015c3ef0c3fd",
"version": 1,
"snapshot": {
"id": "inv_6595a27b5d35015c3ef0c3fd",
"entity_id": "ent_6595a27b5d35015c3ef0c3fd",
"number": "2026-00001",
"date": "2026-01-01T00:00:00.000Z",
"currency_code": "USD",
"issuer": {
"name": "Starward Equipment Co.",
"country": "United States",
"country_code": "US"
},
"customer_id": null,
"customer": null,
"items": [
{
"id": "inv_item_6595a27b5d35015c3ef0c3fd",
"invoice_id": "inv_6595a27b5d35015c3ef0c3fd",
"advance_invoice_id": null,
"expense_id": null,
"item_id": null,
"name": "Satellite Communication Module",
"description": null,
"translations": {},
"quantity": 1,
"price": 1500,
"gross_price": null,
"taxes": [],
"discounts": [],
"type": null,
"unit": null,
"total": 1500,
"total_with_tax": 1500,
"total_converted": null,
"total_with_tax_converted": null,
"metadata": {},
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}
],
"note": null,
"translations": {},
"reference": null,
"total": 1500,
"total_with_tax": 1500,
"total_discount": 0,
"total_converted": null,
"total_with_tax_converted": null,
"shareable_id": null,
"taxes": [
{
"rate": null,
"tax_id": null,
"base": 1500,
"amount": 0,
"reverse_charge": false
}
],
"date_year": 2026,
"metadata": {},
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z",
"voided_at": null,
"deleted_at": null,
"exchange_rate": null,
"crypto_equivalents": null,
"rounding_correction": null,
"transaction_type": "domestic",
"vies": null,
"tax_clause": null,
"signature": "{entity_name}",
"payment_terms": null,
"date_due": "2026-02-01T00:00:00.000Z",
"total_paid": 0,
"total_due": 1500,
"paid_in_full": false,
"furs": null,
"fina": null
},
"changed_fields": [
"items"
],
"user": {
"id": "usr_123",
"name": "Alex Carter",
"email": "alex.carter@starward.example"
},
"reason": "Corrected line items",
"created_at": "2025-01-14T15:00:00.000Z"
}Preview next document number
/documents/next-numberPreview the next auto-generated document number for the specified type without incrementing the sequence. Useful for showing users what number will be assigned before creating a document.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Query parameters
Document type
Possible values: "invoice", "estimate", "credit_note", "advance_invoice", "delivery_note", "purchase_order"
Optional business unit scope for unit-specific numbering sequences.
Business premise name (FURS or FINA). If provided with electronic_device_name, returns fiscalization-format number.
Electronic device name (FURS or FINA). Required if business_premise_name is provided. When provided, returns fiscalization-format number.
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.documents.getNextNumber({
type: "invoice"
}, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
{
"number": "2026-00042"
}Render invoice preview
/invoices/renderRender an HTML preview of an invoice without saving to the database. Perfect for displaying live previews in invoice creation/edit forms. Supports both partial mode (allows incomplete data for drafts) and complete mode (validates all required fields).
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Query parameters
Document template design to use. When not specified, uses the entity's configured template.
Possible values: "modern", "classic", "condensed", "minimal", "fashion"
Locale for number and date formatting (decimal separators, date order). When not specified, uses the entity's configured locale. For example, 'sl-SI' formats decimals with commas (5,5%) and dates as DD. MM. YYYY.
Language for document labels and translations (e.g., 'Invoice', 'Tax', 'Total'). When not specified, uses the same value as locale. Use this to get entity-locale formatting with different-language labels — for example, a Slovenian entity (sl-SI formatting with commas) but English labels.
Whether to treat the document as partial (allows incomplete data) or complete (validates all required fields)
Possible values: "true", "false"
Default: "true"
Override UPN QR enabled setting for preview
Possible values: "true", "false"
Override UPN QR display mode for preview
Possible values: "qr_only", "full_slip"
Override EPC QR enabled setting for preview
Possible values: "true", "false"
Override Croatian HUB3 PDF417 barcode enabled setting for preview
Possible values: "true", "false"
Override HUB3 purpose code for preview
Override HUB3 Croatian reference model for preview
Override Swiss QR-bill enabled setting for preview
Possible values: "true", "false"
Body parameters
Preview only: id of the stored document being edited. The preview shows that document's stored number (and reuses its issued snapshot where supported). Omit when creating.
Document date in YYYY-MM-DD format
Document due date in YYYY-MM-DD format
Service date in YYYY-MM-DD format. For invoices and credit notes. When it (or date_service_to, if later) falls on or before date, foreign-currency conversion uses it as the exchange-rate reference date instead of date.
Document issuer (entity) information
Referenced Customer ID. Required if customer is not provided.
Customer recipient of the document.
Both customer and customer_id are optional - documents can be created without customer information.
If only customer_id is provided, the document customer snapshot is populated from the saved customer.
If customer is provided, the document customer snapshot is built from the explicit payload; saved customer fields are not backfilled into omitted snapshot fields.
If both customer_id and customer are provided with save_customer=true, the existing customer will be updated from explicit customer fields only. Omitted fields remain unchanged on the saved customer, and explicit null clears nullable saved customer fields.
If only customer is provided with save_customer=true (or by default), the system checks for duplicate customers using customer identifiers and reuses the existing customer if found, otherwise creates a new customer.
Note for the document. If not provided, defaults to entity settings. Pass empty string to explicitly set no note.
Custom string key-value data for your own use, with up to 50 properties. Keys are opaque and may contain periods. Useful for storing external IDs, tags, or integration data.
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.invoices.renderInvoicePreview({
items: [
{
name: "Mission Planning Services",
quantity: 5,
price: 150
}
],
customer: {
name: "Nebula Propulsion Labs"
}
}, undefined, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Preview document calculation
/documents/calculateCalculate document totals, taxes, and transaction type without creating the document. Useful for showing live totals in forms or validating data before submission.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Query parameters
Document type
Possible values: "invoice", "estimate", "credit_note", "advance_invoice", "delivery_note", "purchase_order"
Body parameters
Document line items to calculate. At least one item is required.
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.documents.calculateDocumentPreview({
items: [
{
name: "Mission Planning Services",
quantity: 10,
price: 100,
taxes: [
{
rate: 22
}
]
}
]
}, {
type: "invoice"
}, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
{
"items": [
{
"name": "Mission Planning Services",
"description": null,
"type": null,
"price": 100,
"gross_price": null,
"quantity": 10,
"unit": null,
"taxes": [
{
"name": "VAT",
"rate": 22,
"base": 1000,
"amount": 220
}
],
"discounts": [],
"total": 1000,
"total_with_tax": 1220,
"total_converted": null,
"total_with_tax_converted": null
}
],
"total": 1000,
"total_with_tax": 1220,
"total_discount": 0,
"taxes": [
{
"name": "VAT",
"rate": 22,
"base": 1000,
"amount": 220,
"reverse_charge": false
}
],
"transaction_type": "domestic",
"currency_code": "EUR",
"exchange_rate": null,
"total_converted": null,
"total_with_tax_converted": null,
"rounding_correction": null
}Render HTML
/documents/{id}/htmlRender a saved document by its ID as HTML. The document type is automatically detected from the ID prefix (inv_, est_, cre_, adv_). The output is styled for professional presentation and optimized for display in web applications.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Document identifier. Prefix depends on the document type: inv_, est_, crn_, adv_, dln_ or po_ (purchase order).
Query parameters
Document template design to use. When not specified, uses the entity's configured template.
Possible values: "modern", "classic", "condensed", "minimal", "fashion"
Locale for number and date formatting (decimal separators, date order). When not specified, uses the entity's configured locale. For example, 'sl-SI' formats decimals with commas (5,5%) and dates as DD. MM. YYYY.
Language for document labels and translations (e.g., 'Invoice', 'Tax', 'Total'). When not specified, uses the same value as locale. Use this to get entity-locale formatting with different-language labels — for example, a Slovenian entity (sl-SI formatting with commas) but English labels.
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.invoices.renderHtml('inv_6595a27b5d35015c3ef0c3fd', undefined, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Render PDF
/documents/{id}/pdfRender a saved document by its ID as PDF. The document type is automatically detected from the ID prefix (inv_, est_, cre_, adv_). The output is styled for professional presentation and optimized for printing. Ideal for downloads and archival.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Document identifier. Prefix depends on the document type: inv_, est_, crn_, adv_, dln_ or po_ (purchase order).
Query parameters
Document template design to use. When not specified, uses the entity's configured template.
Possible values: "modern", "classic", "condensed", "minimal", "fashion"
Locale for number and date formatting (decimal separators, date order). When not specified, uses the entity's configured locale. For example, 'sl-SI' formats decimals with commas (5,5%) and dates as DD. MM. YYYY.
Language for document labels and translations (e.g., 'Invoice', 'Tax', 'Total'). When not specified, uses the same value as locale. Use this to get entity-locale formatting with different-language labels — for example, a Slovenian entity (sl-SI formatting with commas) but English labels.
Finalize a draft document
/documents/{id}/finalizeFinalize a draft document by assigning a document number, running fiscalization (if applicable), and optionally sending it electronically. Only draft documents can be finalized. Draft advance invoices must first have payments covering their full total. After finalization, the document cannot be deleted. For a Hungarian invoice, credit note or advance invoice whose entity has NAV dispatch enabled, finalizing maps it to a NAV Online Számla submission; data that cannot be mapped responds 422 NAV_INVOICE_DATA_INVALID with an issues array.
Polish B2B issuance returns 422 KSEF_AUTH_FAILED when KSeF rejects the entity's KSeF token; no number is used.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Document ID
Query parameters
Document type. Optional — automatically inferred from the document ID prefix.
Possible values: "invoice", "estimate", "credit_note", "advance_invoice", "delivery_note", "purchase_order"
Body parameters
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.documents.finalizeDocument("inv_clx1234567890", {
e_invoicing: {
send_enabled: true
}
}, undefined, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);nullDelete a draft document
/documents/{id}Delete a draft document. Only draft documents can be deleted. Finalized documents cannot be deleted - use void instead.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Document ID
Query parameters
Document type. Optional — automatically inferred from the document ID prefix.
Possible values: "invoice", "estimate", "credit_note", "advance_invoice", "delivery_note", "purchase_order"
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
await sdk.documents.delete("inv_clx1234567890", undefined, {
entity_id: "YOUR_ENTITY_ID"
});
console.log('Deleted successfully');Permanently delete a document
/documents/{id}/permanentPermanently delete a soft-deleted document. Only documents in the trash can be permanently deleted. Only draft documents and estimates can be permanently deleted.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Document ID
Query parameters
Document type. Optional — automatically inferred from the document ID prefix.
Possible values: "invoice", "estimate", "credit_note", "advance_invoice", "delivery_note", "purchase_order"
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
await sdk.documents.permanentDeleteDocument("inv_clx1234567890", undefined, {
entity_id: "YOUR_ENTITY_ID"
});
console.log('Deleted successfully');Return an unaccepted KSeF document to draft
/invoices/{id}/ksef/recoverNo request body. Archives the previous attempt and returns the document to draft only after definitive authority rejection, no dispatch, or verified empty cancelled session. Accepted, duplicate and unresolved ambiguous submissions remain immutable. Repeated completed recovery is idempotent. Returns 422 KSEF_AUTH_FAILED if KSeF rejects the entity's token.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Space Invoices resource identifier (format: {prefix}_{hex24})
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.invoices.recoverInvoiceFromKsef("inv_6595a27b5d35015c3ef0c3fd", {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
{
"submission_id": "submission-id",
"status": "reserved",
"revision": 0,
"error_code": "error-code",
"error_message": "error-message",
"ksef_number": "ksef-number",
"invoice_hash": "invoice-hash",
"upo_available": true,
"recovery_available": true
}Get KSeF submission status
/invoices/{id}/ksefRead persisted KSeF lifecycle state and reconcile pending authority results. Polling is rate limited. This does not resend invoices. When KSeF rejects the entity's token or is unavailable, this read returns the stored state (error_code KSEF_AUTH_FAILED for a rejected token) instead of failing.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Space Invoices resource identifier (format: {prefix}_{hex24})
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.invoices.getInvoiceKsefState("inv_6595a27b5d35015c3ef0c3fd", {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
{
"submission_id": "submission-id",
"status": "reserved",
"revision": 0,
"error_code": "error-code",
"error_message": "error-message",
"ksef_number": "ksef-number",
"invoice_hash": "invoice-hash",
"upo_available": true,
"recovery_available": true
}Submit or resume a KSeF invoice
/invoices/{id}/ksef/submitSubmit an issued Polish B2B invoice or credit note within the supported KSeF scope: standard online documents from active-VAT sellers, or documents from VAT-exempt (art. 113) sellers: domestic invoices, and cross-border invoices to business buyers, meaning documents whose transaction_type is intra_eu_b2b (an EU buyer with a VAT number that VIES did not reject) or 3w_b2b (a non-EU buyer with a tax number), where every line has classification product or service. The invoice tax clause, stating the exemption's legal basis, is required when the document has exempt (zw) lines: every domestic document and any cross-border goods line; a cross-border services-only document needs none (services are reported as outside Polish VAT). A clause longer than 256 characters is always refused. Exempt sellers cannot submit invoices to consumers abroad or to buyers whose EU VAT number VIES rejected (intra_eu_b2c, 3w_b2c). See the Poland compliance guide for currency and scope rules. Advances, offline24 and domestic totals above PLN 15,000 are outside this route. KSeF is required unless an explicit exemption reason is configured; disabling KSeF does not bypass that obligation. Uses the existing reservation on repeat calls. Ambiguous dispatches reconcile without resending; rejected invoices are terminal. Returns 422 with code KSEF_AUTH_FAILED when KSeF rejects the entity's KSeF token; the submission stays queued with error_code KSEF_AUTH_FAILED and resumes automatically once the token is replaced. No request body.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Space Invoices resource identifier (format: {prefix}_{hex24})
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.invoices.submitInvoiceToKsef("inv_6595a27b5d35015c3ef0c3fd", {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
{
"submission_id": "submission-id",
"status": "reserved",
"revision": 0,
"error_code": "error-code",
"error_message": "error-message",
"ksef_number": "ksef-number",
"invoice_hash": "invoice-hash",
"upo_available": true,
"recovery_available": true
}Download verified KSeF UPO
/invoices/{id}/ksef/upoDownload the authority receipt after verified acceptance. Returns 409 while the receipt is pending.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Space Invoices resource identifier (format: {prefix}_{hex24})
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const blob = await sdk.invoices.getInvoiceKsefUpo("inv_6595a27b5d35015c3ef0c3fd", {
entity_id: "YOUR_ENTITY_ID"
});
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 remaining Portuguese invoice quantities for a credit note
/invoices/{id}/credit-optionsReturns remaining uncredited line quantities for an active issued Portuguese invoice. Excludes voided credits and accounts for prior partial corrections. This is a read-only preparation snapshot, not a reservation: credit-note creation validates and reserves the balance again. Returns 422 for non-Portuguese entities, ineligible originals, or historical credits requiring reconciliation.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Unique resource identifier. Prefix depends on the resource, for example inv_, cus_, or ent_.
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.invoices.getCreditOptions('inv_6595a27b5d35015c3ef0c3fd', {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
{
"items": [
{
"invoice_item_id": "invoice-item-id",
"remaining_quantity": 0
}
],
"fully_credited": true
}Download invoice as XRechnung XML
/invoices/{id}/xrechnungDownload a finalized German invoice as XRechnung XML. Requires a German entity with XRechnung enabled. The stored validation result is used when it is still current for the document; otherwise the current document is re-validated at export time.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Unique resource identifier. Prefix depends on the resource, for example inv_, cus_, or ent_.
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.invoices.downloadInvoiceXRechnung('inv_6595a27b5d35015c3ef0c3fd', {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Download invoice as ZUGFeRD PDF
/invoices/{id}/zugferdDownload a finalized German invoice as a ZUGFeRD/Factur-X PDF with embedded CII XML. Requires a German entity with ZUGFeRD enabled. The stored validation result is used when it is still current for the document; otherwise the current document is re-validated at export time.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Unique resource identifier. Prefix depends on the resource, for example inv_, cus_, or ent_.
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const blob = await sdk.invoices.downloadInvoiceZugferd('inv_6595a27b5d35015c3ef0c3fd', {
entity_id: "YOUR_ENTITY_ID"
});
const arrayBuffer = await blob.arrayBuffer();
const { writeFile } = await import('node:fs/promises');
await writeFile('download.bin', Buffer.from(arrayBuffer));
console.log('Saved download.bin');Fiscalize an old invoice (deprecated)
/invoices/{id}/fiscalizeDeprecated. Use POST /documents/{id}/fiscalize instead. Manually fiscalize an invoice that was created before FURS was enabled. Creates or reuses a dedicated "OLD" device under an existing active FURS premise, assigns a new sequential FURS number (Premise-OLD-N), and submits to FURS with SubsequentSubmit=true and SpecialNotes=#OLDINV;. The original invoice number remains unchanged.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Unique resource identifier. Prefix depends on the resource, for example inv_, cus_, or ent_.
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.invoices.fiscalizeInvoice('inv_6595a27b5d35015c3ef0c3fd', {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
Date the invoice was created (ISO 8601 datetime at midnight UTC)
Date the invoice is due (ISO 8601 datetime at midnight UTC)
Service date in YYYY-MM-DD format. For invoices and credit notes. When it (or date_service_to, if later) falls on or before date, foreign-currency conversion uses it as the exchange-rate reference date instead of date.
Document issuer (entity) information
Customer information snapshot stored on the document. Null means no customer. When present, known customer fields are returned with null for omitted values.
Note for the document. If not provided, defaults to entity's document-type-specific note setting. Pass empty string to explicitly set no note.
Document total before tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.
Document total after tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.
Applied taxes summary
Custom string key-value data for your own use, with up to 50 properties. Keys are opaque and may contain periods. Useful for storing external IDs, tags, or integration data.
{
"id": "inv_abc123",
"furs": {
"country_code": "SI",
"status": "success",
"fiscalized_at": "2026-01-20T12:00:00.000Z",
"data": {
"zoi": "a1b2c3d4e5f6...",
"eor": "EOR-12345",
"business_premise_name": "P1",
"electronic_device_name": "OLD",
"invoice_number": "1"
}
}
}Change the buyer OIB of a fiscalized Croatian invoice
/invoices/{id}/change-buyer-oibCroatia (FINA/CIS) only. Reports a new buyer OIB for an issued, fiscalized invoice to CIS with promijeniPodatkeRacuna, or deletes it (fina.buyer_oib: null), and updates the invoice's customer snapshot tax_number to match. The fiscal record that was originally submitted (fina.data.cis_record) is never rewritten; the latest buyer OIB reported to CIS is kept in fina.data.buyer_oib. The saved customer record is not changed.
CIS accepts this only on the day the invoice was issued, before midnight in Europe/Zagreb. After that, issue a credit note and a corrected invoice instead. The last accepted message wins. Setting the OIB the invoice already carries is a no-op: 200, with no call to CIS and nothing written.
A buyer OIB is lawful only on a business-to-business invoice settled by exactly one cash or card payment covering the full total. Setting one requires that; a removed OIB makes the invoice an ordinary consumer invoice again.422 refusals carry a stable cause.code:
- fina_buyer_oib_invalid — fina.buyer_oib is not a valid 11-digit OIB (checksum included).
- fina_buyer_oib_change_unavailable — the entity is not Croatian or has FINA disabled, or the document is a draft, voided, or not successfully fiscalized.
- fina_cis_record_unavailable — the invoice was fiscalized before its CIS record was retained, so it cannot be changed.
- fina_payment_change_window_expired — the issue day has passed.
- fina_buyer_oib_not_allowed — the customer is a consumer or foreign, so no buyer OIB may be reported.
- fina_b2b_payment_type_not_allowed — setting an OIB requires exactly one cash or card payment, matching the reported payment method, covering the full total.
- fiscalization_provider_error — CIS refused the change; nothing was changed.
A 503 with cause.code fina_unreachable means CIS could not be reached; the invoice is unchanged. CIS may nevertheless hold the change, so it is recorded on the invoice (fina.data.payment_change_unconfirmed): retry the same request, which clears it once CIS answers. A different change to this invoice, including a payment-method change, is refused with 409 fina_payment_change_unconfirmed until then. A 500 with cause.code fina_payment_change_unrecorded means CIS accepted the change but it could not be recorded locally; retry the same request. Changes to one invoice are serialized.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Unique resource identifier. Prefix depends on the resource, for example inv_, cus_, or ent_.
Body parameters
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.invoices.changeInvoiceBuyerOib('inv_6595a27b5d35015c3ef0c3fd', {
fina: {
buyer_oib: "12345678903"
}
}, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
Date the invoice was created (ISO 8601 datetime at midnight UTC)
Date the invoice is due (ISO 8601 datetime at midnight UTC)
Service date in YYYY-MM-DD format. For invoices and credit notes. When it (or date_service_to, if later) falls on or before date, foreign-currency conversion uses it as the exchange-rate reference date instead of date.
Document issuer (entity) information
Customer information snapshot stored on the document. Null means no customer. When present, known customer fields are returned with null for omitted values.
Note for the document. If not provided, defaults to entity's document-type-specific note setting. Pass empty string to explicitly set no note.
Document total before tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.
Document total after tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.
Applied taxes summary
Custom string key-value data for your own use, with up to 50 properties. Keys are opaque and may contain periods. Useful for storing external IDs, tags, or integration data.
{
"id": "inv_abc123",
"customer": {
"name": "Acme d.o.o.",
"country_code": "HR",
"tax_number": "HR12345678903"
},
"fina": {
"status": "success",
"data": {
"zki": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6",
"jir": "11111111-2222-3333-4444-555555555555",
"business_premise_name": "POSL1",
"electronic_device_name": "1",
"invoice_number": "1/POSL1/1",
"payment_type": "K",
"buyer_oib": "12345678903",
"payload": {}
}
}
}Fiscalize a document or retry fiscalization
/documents/{id}/fiscalizeManually fiscalize a document. Retries failed FURS/FINA fiscalization, submits Slovenian FURS documents that were intentionally skipped and now need late fiscalization, or uses the old-FURS flow for no-status pre-FURS documents. For first FURS submission, payment_amount overrides only PaymentAmount; invoice totals and taxes are unchanged. On retries with stored payloads, repeat the same amount or omit it; a different resolved FURS amount is rejected.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Document ID
Query parameters
Document type. Optional — automatically inferred from the document ID prefix.
Possible values: "invoice", "estimate", "credit_note", "advance_invoice", "delivery_note", "purchase_order"
Body parameters
nullRegister fiscalized document output
/documents/{id}/register-outputAtomically reserve the next output number for a successfully FURS- or FINA-fiscalized document. The first output is the unmarked original; output two and later are rendered with their number. Preview operations must not call this endpoint.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Document ID
Query parameters
Document type. Optional — automatically inferred from the document ID prefix.
Possible values: "invoice", "estimate", "credit_note", "advance_invoice", "delivery_note", "purchase_order"
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.documents.registerDocumentOutput("inv_clx1234567890", undefined, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
{
"print_count": 2,
"fiscalization_provider": "furs"
}Restore a deleted document
/documents/{id}/restoreRestore a soft-deleted document from the trash. The document will be returned to its original state.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Document ID
Query parameters
Document type. Optional — automatically inferred from the document ID prefix.
Possible values: "invoice", "estimate", "credit_note", "advance_invoice", "delivery_note", "purchase_order"
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.documents.restoreDocument("inv_clx1234567890", undefined, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);null