Skip to content

Advance Invoices

The Advance Invoice object

object

Attributes

idstring
numberstring
itemsarray of objects
datestring<date-time>

Date the advance invoice was created (ISO 8601 datetime at midnight UTC)

date_duestringnullable

Document due date in YYYY-MM-DD format

currency_codestring
issuerobject

Document issuer (entity) information

customer_idstringnullable
customerobjectnullable

Customer information snapshot stored on the document. Null means no customer. When present, known customer fields are returned with null for omitted values.

notestringnullable

Note for the document. If not provided, defaults to entity's document-type-specific note setting. Pass empty string to explicitly set no note.

totalnumber

Document total before tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.

total_with_taxnumber

Document total after tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.

taxesarray of objects

Applied taxes summary

metadataobjectnullable

Custom key-value data for your own use. Store any JSON object up to 50 properties. Values must be strings up to 250 characters. Useful for storing external IDs, tags, or integration data.

Other attributes
is_draftboolean
business_unit_idstringnullable
business_unitobjectnullable
tax_clausestringnullable
footerstringnullable
signaturestringnullable
translationsobject
total_discountnumber
creation_sourcestring
calculation_modestring
entity_idstring
date_yearinteger
shareable_idstringnullable
voided_atstring<date-time>nullable
transaction_typestringnullable
exchange_rateobjectnullable
total_convertednumbernullable
total_with_tax_convertednumbernullable
rounding_correctionnumbernullable
eslogobjectnullable
referencestringnullable
viesobjectnullable
deleted_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
total_paidnumber
total_duenumber
paid_in_fullboolean
fursobjectnullable
finaobjectnullable
ptstringnullable
date_servicestringnullable
date_service_tostringnullable
payment_termsstringnullable
document_relationsarray of objects
Examplejson
{
  "id": "adv_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": "adv_item_6595a27b5d35015c3ef0c402",
      "advance_invoice_id": "adv_6595a27b5d35015c3ef0c402",
      "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": "adv_item_6595a27b5d35015c3ef0c403",
      "advance_invoice_id": "adv_6595a27b5d35015c3ef0c402",
      "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,
  "rounding_correction": null,
  "transaction_type": "domestic",
  "vies": null,
  "tax_clause": null,
  "signature": "{entity_name}",
  "total_paid": 0,
  "total_due": 10370,
  "paid_in_full": false,
  "furs": null,
  "fina": null
}

Create a new advance invoice

POST/advance-invoices

Create a new advance invoice with line items.
This is the recommended endpoint for normal advance 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.
Advance invoices are issued before goods/services are delivered to collect prepayment. When payment is received, the advance can be linked to a final invoice to apply the prepaid amount.

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

itemsarray of objectsrequired

Line items for the advance invoice. At least one item is required.

datestringoptional

Document date in YYYY-MM-DD format

date_duestringoptionalnullable

Document due date in YYYY-MM-DD format

currency_codestringoptional
issuerobjectoptional

Document issuer (entity) information

customer_idstringoptionalnullable

Referenced Customer ID. Required if customer is not provided.

customerobjectoptionalnullable

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.

notestringoptionalnullable

Note for the document. If not provided, defaults to entity's document-type-specific note setting. Pass empty string to explicitly set no note.

metadataobjectoptionalnullable

Custom key-value data for your own use. Store any JSON object up to 50 properties. Values must be strings up to 250 characters. Useful for storing external IDs, tags, or integration data.

Other parameters
is_draftbooleanoptional
business_unit_idstringoptionalnullable
business_unitobjectoptionalnullable
tax_clausestringoptionalnullable
footerstringoptionalnullable
signaturestringoptionalnullable
translationsobjectoptionalnullable
calculation_modestringoptionalnullable
referencestringoptionalnullable
ptobjectoptionalnullable
date_servicestringoptionalnullable
date_service_tostringoptionalnullable
linked_documentsarray of stringsoptionalnullable
paymentsarray of objectsoptionalnullable
category_assignmentsarray of objectsoptionalnullable
fursobjectoptionalnullable
finaobjectoptionalnullable
eslogobjectoptionalnullable
expected_total_with_taxnumberoptionalnullable
import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.advanceInvoices.create({
  items: [
    {
      name: "Satellite Communication Module",
      quantity: 1,
      price: 1500
    }
  ],
  payments: [
    {
      type: "bank_transfer"
    }
  ]
});

console.log(response);
Example:

Returns

idstring
numberstring
itemsarray of objects
datestring<date-time>

Date the advance invoice was created (ISO 8601 datetime at midnight UTC)

date_duestringnullable

Document due date in YYYY-MM-DD format

currency_codestring
issuerobject

Document issuer (entity) information

customer_idstringnullable
customerobjectnullable

Customer information snapshot stored on the document. Null means no customer. When present, known customer fields are returned with null for omitted values.

notestringnullable

Note for the document. If not provided, defaults to entity's document-type-specific note setting. Pass empty string to explicitly set no note.

totalnumber

Document total before tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.

total_with_taxnumber

Document total after tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.

taxesarray of objects

Applied taxes summary

metadataobjectnullable

Custom key-value data for your own use. Store any JSON object up to 50 properties. Values must be strings up to 250 characters. Useful for storing external IDs, tags, or integration data.

Other parameters
is_draftboolean
business_unit_idstringnullable
business_unitobjectnullable
tax_clausestringnullable
footerstringnullable
signaturestringnullable
translationsobject
total_discountnumber
creation_sourcestring
calculation_modestring
entity_idstring
date_yearinteger
shareable_idstringnullable
voided_atstring<date-time>nullable
transaction_typestringnullable
exchange_rateobjectnullable
total_convertednumbernullable
total_with_tax_convertednumbernullable
rounding_correctionnumbernullable
eslogobjectnullable
referencestringnullable
viesobjectnullable
deleted_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
total_paidnumber
total_duenumber
paid_in_fullboolean
fursobjectnullable
finaobjectnullable
ptstringnullable
date_servicestringnullable
date_service_tostringnullable
payment_termsstringnullable
document_relationsarray of objects
json
{
  "id": "adv_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": "adv_item_6595a27b5d35015c3ef0c3fd",
      "advance_invoice_id": "adv_6595a27b5d35015c3ef0c3fd",
      "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,
  "rounding_correction": null,
  "transaction_type": "domestic",
  "vies": null,
  "tax_clause": null,
  "signature": "{entity_name}",
  "total_paid": 1500,
  "total_due": 0,
  "paid_in_full": true,
  "furs": null,
  "fina": null
}
Example:

Create advance invoice with pre-calculated totals

POST/advance-invoices/custom

Advanced endpoint for importing advance invoices that already have authoritative pre-calculated totals. Do not use this for normal advance 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.
All other logic (numbering, fiscalization, customer handling, payments, lifecycle hooks) is identical to the standard create endpoint.

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

itemsarray of objectsrequired

Line items with pre-calculated totals. At least one item is required.

datestringoptionalnullable
date_duestringoptionalnullable

Document due date in YYYY-MM-DD format

currency_codestringoptionalnullable
issuerobjectoptionalnullable

Document issuer (entity) information

customer_idstringoptionalnullable

Referenced Customer ID.

customerobjectoptionalnullable

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.

notestringoptionalnullable
totalnumberrequired

Pre-calculated document total (before tax).

total_with_taxnumberrequired

Pre-calculated document total (after tax).

taxesarray of objectsoptional

Pre-calculated tax summary. If not provided, defaults to empty array.

metadataobjectoptionalnullable

Custom key-value data for your own use. Store any JSON object up to 50 properties. Values must be strings up to 250 characters. Useful for storing external IDs, tags, or integration data.

Other parameters
is_draftbooleanoptionalnullable
business_unit_idstringoptionalnullable
business_unitobjectoptionalnullable
tax_clausestringoptionalnullable
footerstringoptionalnullable
signaturestringoptionalnullable
translationsobjectoptionalnullable
calculation_modestringoptionalnullable
referencestringoptionalnullable
ptstringoptionalnullable
date_servicestringoptionalnullable
date_service_tostringoptionalnullable
expected_total_with_taxnumberoptionalnullable
total_discountnumberoptionalnullable
linked_documentsarray of stringsoptionalnullable
paymentsarray of objectsoptionalnullable
category_assignmentsarray of objectsoptionalnullable
fursobjectoptionalnullable
finaobjectoptionalnullable
eslogobjectoptionalnullable
import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.advanceInvoices.createCustom({
  total: 5000,
  total_with_tax: 6100,
  taxes: [
    {
      rate: 22,
      base: 5000,
      amount: 1100
    }
  ],
  items: [
    {
      name: "Prepayment for Services",
      quantity: 1,
      price: 5000,
      total: 5000,
      total_with_tax: 6100,
      taxes: [
        {
          rate: 22
        }
      ]
    }
  ],
  payments: [
    {
      type: "bank_transfer"
    }
  ]
});

console.log(response);

Returns

idstring
numberstring
itemsarray of objects
datestring<date-time>

Date the advance invoice was created (ISO 8601 datetime at midnight UTC)

date_duestringnullable

Document due date in YYYY-MM-DD format

currency_codestring
issuerobject

Document issuer (entity) information

customer_idstringnullable
customerobjectnullable

Customer information snapshot stored on the document. Null means no customer. When present, known customer fields are returned with null for omitted values.

notestringnullable

Note for the document. If not provided, defaults to entity's document-type-specific note setting. Pass empty string to explicitly set no note.

totalnumber

Document total before tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.

total_with_taxnumber

Document total after tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.

taxesarray of objects

Applied taxes summary

metadataobjectnullable

Custom key-value data for your own use. Store any JSON object up to 50 properties. Values must be strings up to 250 characters. Useful for storing external IDs, tags, or integration data.

Other parameters
is_draftboolean
business_unit_idstringnullable
business_unitobjectnullable
tax_clausestringnullable
footerstringnullable
signaturestringnullable
translationsobject
total_discountnumber
creation_sourcestring
calculation_modestring
entity_idstring
date_yearinteger
shareable_idstringnullable
voided_atstring<date-time>nullable
transaction_typestringnullable
exchange_rateobjectnullable
total_convertednumbernullable
total_with_tax_convertednumbernullable
rounding_correctionnumbernullable
eslogobjectnullable
referencestringnullable
viesobjectnullable
deleted_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
total_paidnumber
total_duenumber
paid_in_fullboolean
fursobjectnullable
finaobjectnullable
ptstringnullable
date_servicestringnullable
date_service_tostringnullable
payment_termsstringnullable
document_relationsarray of objects
json
{
  "id": "adv_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": "adv_item_6595a27b5d35015c3ef0c3fd",
      "advance_invoice_id": "adv_6595a27b5d35015c3ef0c3fd",
      "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,
  "rounding_correction": null,
  "transaction_type": "domestic",
  "vies": null,
  "tax_clause": null,
  "signature": "{entity_name}",
  "total_paid": 1500,
  "total_due": 0,
  "paid_in_full": true,
  "furs": null,
  "fina": null
}
Example:

List all advance invoices

GET/advance-invoices

Retrieve a paginated list of advance invoices with optional filtering and sorting. Supports cursor-based pagination, JSON querying with MongoDB-style operators, full-text search, and sorting.

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

limitintegeroptional

Number of results per request.

Default: 10

next_cursorstringoptional

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.

prev_cursorstringoptional

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.

include_total_countbooleanoptional

Whether to include the total count of items in pagination.total.
Default is true.
When false, pagination.total returns -1 for better performance.

order_byoptional

Sort by one field or provide a repeated array for multi-column ordering. Prefix a field with - for descending order. When paginating, reuse cursors only with the same effective ordering.

querystring<json>optional

JSON query object for filtering results. Supports MongoDB-style operators.

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, paid_in_full, voided_at, total_paid

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

searchstringoptional

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.

includestringoptional

Comma-separated list of relations to include in the response.

Available relations:
- payments - Payment records linked to this advance invoice
- document_relations - Linked documents (invoices, credit notes, etc.)

Usage:
?include=payments
?include=payments,document_relations

deletedbooleanoptional

When true, returns only soft-deleted (trashed) items. Default false excludes deleted items.

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.advanceInvoices.list({ limit: 20 });

console.log(response);

Returns

dataarray of objects
paginationobject

Pagination metadata including cursors and result counts

json
{
  "data": [
    {
      "id": "adv_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": "adv_item_6595a27b5d35015c3ef0c402",
          "advance_invoice_id": "adv_6595a27b5d35015c3ef0c402",
          "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": "adv_item_6595a27b5d35015c3ef0c403",
          "advance_invoice_id": "adv_6595a27b5d35015c3ef0c402",
          "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,
      "rounding_correction": null,
      "transaction_type": "domestic",
      "vies": null,
      "tax_clause": null,
      "signature": "{entity_name}",
      "total_paid": 0,
      "total_due": 10370,
      "paid_in_full": false,
      "furs": null,
      "fina": null
    }
  ],
  "pagination": {
    "total": 1,
    "next_cursor": null,
    "prev_cursor": null,
    "has_more": false
  }
}

Get advance invoice by ID

GET/advance-invoices/{id}

Retrieve a single advance invoice by its unique identifier. Returns the complete advance invoice details including all line items, customer information, and calculated totals.

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

idstring<resource-id>required

Unique resource identifier

Query parameters

includestringoptional

Comma-separated list of relations to include in the response.

Available relations:
- payments - Payment records linked to this advance invoice
- document_relations - Linked documents (invoices, credit notes, etc.)

Usage:
?include=payments
?include=payments,document_relations

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.advanceInvoices.get("inv_6595a27b5d35015c3ef0c3fd");

console.log(response);

Returns

idstring
numberstring
itemsarray of objects
datestring<date-time>

Date the advance invoice was created (ISO 8601 datetime at midnight UTC)

date_duestringnullable

Document due date in YYYY-MM-DD format

currency_codestring
issuerobject

Document issuer (entity) information

customer_idstringnullable
customerobjectnullable

Customer information snapshot stored on the document. Null means no customer. When present, known customer fields are returned with null for omitted values.

notestringnullable

Note for the document. If not provided, defaults to entity's document-type-specific note setting. Pass empty string to explicitly set no note.

totalnumber

Document total before tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.

total_with_taxnumber

Document total after tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.

taxesarray of objects

Applied taxes summary

metadataobjectnullable

Custom key-value data for your own use. Store any JSON object up to 50 properties. Values must be strings up to 250 characters. Useful for storing external IDs, tags, or integration data.

Other parameters
is_draftboolean
business_unit_idstringnullable
business_unitobjectnullable
tax_clausestringnullable
footerstringnullable
signaturestringnullable
translationsobject
total_discountnumber
creation_sourcestring
calculation_modestring
entity_idstring
date_yearinteger
shareable_idstringnullable
voided_atstring<date-time>nullable
transaction_typestringnullable
exchange_rateobjectnullable
total_convertednumbernullable
total_with_tax_convertednumbernullable
rounding_correctionnumbernullable
eslogobjectnullable
referencestringnullable
viesobjectnullable
deleted_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
total_paidnumber
total_duenumber
paid_in_fullboolean
fursobjectnullable
finaobjectnullable
ptstringnullable
date_servicestringnullable
date_service_tostringnullable
payment_termsstringnullable
document_relationsarray of objects
json
{
  "id": "adv_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": "adv_item_6595a27b5d35015c3ef0c402",
      "advance_invoice_id": "adv_6595a27b5d35015c3ef0c402",
      "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": "adv_item_6595a27b5d35015c3ef0c403",
      "advance_invoice_id": "adv_6595a27b5d35015c3ef0c402",
      "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,
  "rounding_correction": null,
  "transaction_type": "domestic",
  "vies": null,
  "tax_clause": null,
  "signature": "{entity_name}",
  "total_paid": 0,
  "total_due": 10370,
  "paid_in_full": false,
  "furs": null,
  "fina": null
}

Update an advance invoice

PATCH/advance-invoices/{id}

Update an existing advance invoice.
Creates a version snapshot before applying changes.
Cannot update voided or FURS-fiscalized advance invoices.
If items are provided, they replace all existing items.

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

idstring<resource-id>required

Unique resource identifier

Body parameters

itemsarray of objectsoptional

Line items for the document. If provided, replaces ALL existing items. Standard documents recalculate totals. Custom documents created with pre-calculated totals preserve existing totals when item financial inputs are unchanged.

datestringoptional

Document date (YYYY-MM-DD or ISO datetime format).

currency_codestringoptional

Currency code (ISO 4217, 3 characters). Changing currency triggers exchange rate recalculation.

issuerobjectoptional

Issuer information snapshot.

customer_idstringoptionalnullable

Referenced Customer ID. Set to null to remove customer reference.

customerobjectoptionalnullable

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.

notestringoptionalnullable

Document note/memo. Set to null to clear.

metadataobjectoptionalnullable

Custom metadata object. Set to null to clear.

Other parameters
business_unit_idstringoptionalnullable
business_unitobjectoptionalnullable
tax_clausestringoptionalnullable
footerstringoptionalnullable
signaturestringoptionalnullable
translationsobjectoptionalnullable
referencestringoptionalnullable
change_reasonstringoptional
linked_documentsarray of stringsoptionalnullable
eslogobjectoptionalnullable
import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.advanceInvoices.update("inv_6595a27b5d35015c3ef0c3fd", {
  note: "Prepayment received. Thank you!",
  change_reason: "Added confirmation note"
});

console.log(response);
Example:

Returns

idstring
numberstring
itemsarray of objects
datestring<date-time>

Date the advance invoice was created (ISO 8601 datetime at midnight UTC)

date_duestringnullable

Document due date in YYYY-MM-DD format

currency_codestring
issuerobject

Document issuer (entity) information

customer_idstringnullable
customerobjectnullable

Customer information snapshot stored on the document. Null means no customer. When present, known customer fields are returned with null for omitted values.

notestringnullable

Note for the document. If not provided, defaults to entity's document-type-specific note setting. Pass empty string to explicitly set no note.

totalnumber

Document total before tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.

total_with_taxnumber

Document total after tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.

taxesarray of objects

Applied taxes summary

metadataobjectnullable

Custom key-value data for your own use. Store any JSON object up to 50 properties. Values must be strings up to 250 characters. Useful for storing external IDs, tags, or integration data.

Other parameters
is_draftboolean
business_unit_idstringnullable
business_unitobjectnullable
tax_clausestringnullable
footerstringnullable
signaturestringnullable
translationsobject
total_discountnumber
creation_sourcestring
calculation_modestring
entity_idstring
date_yearinteger
shareable_idstringnullable
voided_atstring<date-time>nullable
transaction_typestringnullable
exchange_rateobjectnullable
total_convertednumbernullable
total_with_tax_convertednumbernullable
rounding_correctionnumbernullable
eslogobjectnullable
referencestringnullable
viesobjectnullable
deleted_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
total_paidnumber
total_duenumber
paid_in_fullboolean
fursobjectnullable
finaobjectnullable
ptstringnullable
date_servicestringnullable
date_service_tostringnullable
payment_termsstringnullable
document_relationsarray of objects
json
{
  "id": "adv_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": "adv_item_6595a27b5d35015c3ef0c402",
      "advance_invoice_id": "adv_6595a27b5d35015c3ef0c402",
      "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": "adv_item_6595a27b5d35015c3ef0c403",
      "advance_invoice_id": "adv_6595a27b5d35015c3ef0c402",
      "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,
  "rounding_correction": null,
  "transaction_type": "domestic",
  "vies": null,
  "tax_clause": null,
  "signature": "{entity_name}",
  "total_paid": 0,
  "total_due": 10370,
  "paid_in_full": false,
  "furs": null,
  "fina": null
}

Void an advance invoice

POST/advance-invoices/{id}/void

Void an advance invoice for technical reasons (duplicate, error, etc.). For FURS-fiscalized advance invoices, automatically submits technical cancellation to FURS. All linked payments are soft-deleted, reversing their effect on invoice totals.

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

idstring<resource-id>required

Unique resource identifier

Body parameters

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.advanceInvoices.void("inv_6595a27b5d35015c3ef0c3fd", {
  reason: "Duplicate advance invoice created by mistake"
});

console.log(response);

Returns

idstring
numberstring
itemsarray of objects
datestring<date-time>

Date the advance invoice was created (ISO 8601 datetime at midnight UTC)

date_duestringnullable

Document due date in YYYY-MM-DD format

currency_codestring
issuerobject

Document issuer (entity) information

customer_idstringnullable
customerobjectnullable

Customer information snapshot stored on the document. Null means no customer. When present, known customer fields are returned with null for omitted values.

notestringnullable

Note for the document. If not provided, defaults to entity's document-type-specific note setting. Pass empty string to explicitly set no note.

totalnumber

Document total before tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.

total_with_taxnumber

Document total after tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.

taxesarray of objects

Applied taxes summary

metadataobjectnullable

Custom key-value data for your own use. Store any JSON object up to 50 properties. Values must be strings up to 250 characters. Useful for storing external IDs, tags, or integration data.

Other parameters
is_draftboolean
business_unit_idstringnullable
business_unitobjectnullable
tax_clausestringnullable
footerstringnullable
signaturestringnullable
translationsobject
total_discountnumber
creation_sourcestring
calculation_modestring
entity_idstring
date_yearinteger
shareable_idstringnullable
voided_atstring<date-time>nullable
transaction_typestringnullable
exchange_rateobjectnullable
total_convertednumbernullable
total_with_tax_convertednumbernullable
rounding_correctionnumbernullable
eslogobjectnullable
referencestringnullable
viesobjectnullable
deleted_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
total_paidnumber
total_duenumber
paid_in_fullboolean
fursobjectnullable
finaobjectnullable
ptstringnullable
date_servicestringnullable
date_service_tostringnullable
payment_termsstringnullable
document_relationsarray of objects
json
{
  "id": "ai_abc123",
  "voided_at": "2026-01-20T12:00:00.000Z"
}

Get advance invoice version history

GET/advance-invoices/{id}/versions

Retrieve the version history for an advance invoice. Each version represents the document state before an update was applied.

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

idstring<resource-id>required

Unique resource identifier

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.advanceInvoices.getVersions("inv_6595a27b5d35015c3ef0c3fd");

console.log(response);

Returns

versionsarray of objects
countinteger
json
{
  "versions": [
    {
      "id": "ver_abc123",
      "document_type": "advance_invoice",
      "document_id": "adv_6595a27b5d35015c3ef0c3fd",
      "version": 2,
      "snapshot": {
        "id": "adv_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": "adv_item_6595a27b5d35015c3ef0c3fd",
            "advance_invoice_id": "adv_6595a27b5d35015c3ef0c3fd",
            "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,
        "rounding_correction": null,
        "transaction_type": "domestic",
        "vies": null,
        "tax_clause": null,
        "signature": "{entity_name}",
        "total_paid": 1500,
        "total_due": 0,
        "paid_in_full": true,
        "furs": null,
        "fina": null
      },
      "changed_fields": [
        "note"
      ],
      "user": {
        "id": "usr_123",
        "name": "Alex Carter",
        "email": "alex.carter@starward.example"
      },
      "reason": "Added confirmation note",
      "created_at": "2025-01-15T10:30:00.000Z"
    },
    {
      "id": "ver_xyz789",
      "document_type": "advance_invoice",
      "document_id": "adv_6595a27b5d35015c3ef0c3fd",
      "version": 1,
      "snapshot": {
        "id": "adv_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": "adv_item_6595a27b5d35015c3ef0c3fd",
            "advance_invoice_id": "adv_6595a27b5d35015c3ef0c3fd",
            "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,
        "rounding_correction": null,
        "transaction_type": "domestic",
        "vies": null,
        "tax_clause": null,
        "signature": "{entity_name}",
        "total_paid": 1500,
        "total_due": 0,
        "paid_in_full": true,
        "furs": null,
        "fina": null
      },
      "changed_fields": [
        "items"
      ],
      "user": {
        "id": "usr_123",
        "name": "Alex Carter",
        "email": "alex.carter@starward.example"
      },
      "reason": "Corrected prepayment breakdown",
      "created_at": "2025-01-14T15:00:00.000Z"
    }
  ],
  "count": 2
}

Get specific advance invoice version

GET/advance-invoices/{id}/versions/{version}

Retrieve a specific version snapshot of an advance invoice.

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

idstringrequired

Advance Invoice ID

versionintegerrequired

Version number

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.advanceInvoices.getVersion('ADVANCEINVOICES_ID', 1);

console.log(response);

Returns

idstring

Version record ID

Other parameters
document_typestring
document_idstring
versioninteger
snapshotobject
changed_fieldsarray of strings
userobjectnullable
reasonstringnullable
created_atstring<date-time>
json
{
  "id": "ver_abc123",
  "document_type": "advance_invoice",
  "document_id": "adv_6595a27b5d35015c3ef0c3fd",
  "version": 1,
  "snapshot": {
    "id": "adv_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": "adv_item_6595a27b5d35015c3ef0c3fd",
        "advance_invoice_id": "adv_6595a27b5d35015c3ef0c3fd",
        "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,
    "rounding_correction": null,
    "transaction_type": "domestic",
    "vies": null,
    "tax_clause": null,
    "signature": "{entity_name}",
    "total_paid": 1500,
    "total_due": 0,
    "paid_in_full": true,
    "furs": null,
    "fina": null
  },
  "changed_fields": [
    "items"
  ],
  "user": {
    "id": "usr_123",
    "name": "Alex Carter",
    "email": "alex.carter@starward.example"
  },
  "reason": "Corrected prepayment breakdown",
  "created_at": "2025-01-14T15:00:00.000Z"
}

Preview next document number

GET/documents/next-number

Preview 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_idstringoptional

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

Query parameters

typestringrequired

Document type

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

business_unit_idstringoptional

Optional business unit scope for unit-specific numbering sequences.

business_premise_namestringoptional

Business premise name (FURS or FINA). If provided with electronic_device_name, returns fiscalization-format number.

electronic_device_namestringoptional

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';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.documents.getNextNumber({
  type: "invoice"
});

console.log(response);

Returns

numberstringnullable
fursobjectnullable
finaobjectnullable
ptobjectnullable
json
{
  "number": "2026-00042",
  "furs": null
}

Render advance invoice preview

POST/advance-invoices/render

Render an HTML preview of an advance invoice without saving to the database. Perfect for displaying live previews in advance invoice creation/edit forms. Supports both partial mode (allows incomplete data for drafts) and complete mode (validates all required fields).

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

templatestringoptional

Document template design to use. When not specified, uses the entity's configured template.

Possible values: "modern", "classic", "condensed", "minimal", "fashion"

localestringoptionalnullable

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.

languagestringoptionalnullable

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.

partialstringoptional

Whether to treat the document as partial (allows incomplete data) or complete (validates all required fields)

Possible values: "true", "false"

Default: "true"

upn_qr_enabledstringoptional

Override UPN QR enabled setting for preview

Possible values: "true", "false"

upn_qr_display_modestringoptional

Override UPN QR display mode for preview

Possible values: "qr_only", "full_slip"

epc_qr_enabledstringoptional

Override EPC QR enabled setting for preview

Possible values: "true", "false"

hub3_qr_enabledstringoptional

Override Croatian HUB3 PDF417 barcode enabled setting for preview

Possible values: "true", "false"

hub3_qr_purpose_codestringoptional

Override HUB3 purpose code for preview

hub3_qr_reference_modelstringoptional

Override HUB3 Croatian reference model for preview

Body parameters

itemsarray of objectsrequired
datestringoptional

Document date in YYYY-MM-DD format

date_duestringoptionalnullable

Document due date in YYYY-MM-DD format

currency_codestringoptional
issuerobjectoptional

Document issuer (entity) information

customer_idstringoptionalnullable

Referenced Customer ID. Required if customer is not provided.

customerobjectoptionalnullable

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.

notestringoptionalnullable

Note for the document. If not provided, defaults to entity's document-type-specific note setting. Pass empty string to explicitly set no note.

totalnumberoptional
total_with_taxnumberoptional
taxesarray of objectsoptional
metadataobjectoptionalnullable

Custom key-value data for your own use. Store any JSON object up to 50 properties. Values must be strings up to 250 characters. Useful for storing external IDs, tags, or integration data.

Other parameters
is_draftbooleanoptional
business_unit_idstringoptionalnullable
business_unitobjectoptionalnullable
tax_clausestringoptionalnullable
footerstringoptionalnullable
signaturestringoptionalnullable
translationsobjectoptionalnullable
calculation_modestringoptionalnullable
referencestringoptionalnullable
ptobjectoptionalnullable
date_servicestringoptionalnullable
date_service_tostringoptionalnullable
linked_documentsarray of stringsoptionalnullable
category_assignmentsarray of objectsoptionalnullable
finaobjectoptionalnullable
eslogobjectoptionalnullable
expected_total_with_taxnumberoptionalnullable
creation_sourcestringoptional
total_discountnumberoptionalnullable
import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.advanceInvoices.renderAdvanceInvoicePreview({
  items: [
    {
      name: "Prepayment - Project Setup",
      quantity: 1,
      price: 2500
    }
  ],
  customer: {
    name: "Acme Corp"
  }
});

console.log(response);
Example:

Preview document calculation

POST/documents/calculate

Calculate 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_idstringoptional

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

Query parameters

typestringrequired

Document type

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

Body parameters

itemsarray of objectsrequired

Document line items to calculate. At least one item is required.

Other parameters
customerobjectoptionalnullable
customer_idstringoptionalnullable
business_unitobjectoptionalnullable
business_unit_idstringoptionalnullable
currency_codestringoptionalnullable
datestringoptionalnullable
calculation_modestringoptionalnullable
expected_total_with_taxnumberoptionalnullable
import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.documents.calculateDocumentPreview({
  items: [
    {
      name: "Web Development",
      quantity: 10,
      price: 100,
      taxes: [
        {
          rate: 22
        }
      ]
    }
  ]
}, {
  type: "invoice"
});

console.log(response);

Returns

itemsarray of objects
totalnumber
total_with_taxnumber
total_discountnumber
calculation_modestring
taxesarray of objects
transaction_typestringnullable
currency_codestring
exchange_rateobjectnullable
total_convertednumbernullable
total_with_tax_convertednumbernullable
rounding_correctionnumbernullable
viesobjectnullable
json
{
  "items": [
    {
      "name": "Web Development",
      "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,
  "vies": null
}

Render HTML

GET/documents/{id}/html

Render 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_idstringoptional

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

Path parameters

idstring<resource-id>required

Unique resource identifier

Query parameters

templatestringoptional

Document template design to use. When not specified, uses the entity's configured template.

Possible values: "modern", "classic", "condensed", "minimal", "fashion"

localestringoptionalnullable

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.

languagestringoptionalnullable

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';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.invoices.renderHtml("inv_6595a27b5d35015c3ef0c3fd");

console.log(response);

Render PDF

GET/documents/{id}/pdf

Render 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_idstringoptional

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

Path parameters

idstring<resource-id>required

Unique resource identifier

Query parameters

templatestringoptional

Document template design to use. When not specified, uses the entity's configured template.

Possible values: "modern", "classic", "condensed", "minimal", "fashion"

localestringoptionalnullable

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.

languagestringoptionalnullable

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

POST/documents/{id}/finalize

Finalize a draft document by assigning a document number and running fiscalization (if applicable). Only draft documents can be finalized. After finalization, the document cannot be deleted.

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

idstringrequired

Document ID

Query parameters

typestringoptional

Document type. Optional — automatically inferred from the document ID prefix.

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

Body parameters

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.documents.finalizeDocument("inv_clx1234567890", {
  fina: {
    business_premise_name: "PP1",
    electronic_device_name: "1",
    payment_type: "card"
  }
});

console.log(response);
Example:
json
null

Delete a draft document

DELETE/documents/{id}

Delete a draft document. Only draft documents can be deleted. Finalized documents cannot be deleted - use void instead.

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

idstringrequired

Document ID

Query parameters

typestringoptional

Document type. Optional — automatically inferred from the document ID prefix.

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

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

await sdk.documents.delete("inv_clx1234567890");

console.log('Deleted successfully');

Permanently delete a document

DELETE/documents/{id}/permanent

Permanently 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_idstringoptional

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

Path parameters

idstringrequired

Document ID

Query parameters

typestringoptional

Document type. Optional — automatically inferred from the document ID prefix.

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

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

await sdk.documents.permanentDeleteDocument("inv_clx1234567890");

console.log('Deleted successfully');

Make document shareable

POST/documents/{id}/share

Generate a shareable token for a document. Document type is automatically detected from the ID prefix (inv_, est_, cre_, adv_). If the document is already shared, returns the existing token. Can be used to re-share a document that was previously unshared.

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

idstring<resource-id>required

Unique resource identifier

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.documents.shareDocument("inv_6595a27b5d35015c3ef0c3fd");

console.log(response);

Returns

shareable_idstring
json
{
  "shareable_id": "string"
}

Unshare document

DELETE/documents/{id}/share

Remove the shareable token from a document. The document will no longer be accessible via public link. Document type is automatically detected from the ID prefix (inv_, est_, cre_, adv_).

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

idstring<resource-id>required

Unique resource identifier

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

await sdk.documents.unshareDocument("inv_6595a27b5d35015c3ef0c3fd");

console.log('Deleted successfully');

Get shareable token

GET/documents/{id}/share

Retrieve the shareable token for a document if one exists. Document type is automatically detected from the ID prefix (inv_, est_, cre_, adv_).

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

idstring<resource-id>required

Unique resource identifier

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.documents.getShareableId("inv_6595a27b5d35015c3ef0c3fd");

console.log(response);

Returns

shareable_idstring
json
{
  "shareable_id": "string"
}

View shareable advance invoice

GET/advance-invoices/shareable/{shareableId}

Retrieve advance invoice data using a shareable token. No authentication required. Returns full advance invoice data for rendering.

Path parameters

shareableIdstringrequired

Shareable document token

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.advanceInvoices.getShareableAdvanceInvoice('SHAREABLE_ID');

console.log(response);

Returns

idstring
numberstring
itemsarray of objects
datestring<date-time>

Date the advance invoice was created (ISO 8601 datetime at midnight UTC)

date_duestringnullable

Document due date in YYYY-MM-DD format

currency_codestring
issuerobject

Document issuer (entity) information

customer_idstringnullable
customerobjectnullable

Customer information snapshot stored on the document. Null means no customer. When present, known customer fields are returned with null for omitted values.

notestringnullable

Note for the document. If not provided, defaults to entity's document-type-specific note setting. Pass empty string to explicitly set no note.

totalnumber

Document total before tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.

total_with_taxnumber

Document total after tax in the currency's major unit. For EUR, 29.90 means €29.90, not 2,990 cents.

taxesarray of objects

Applied taxes summary

metadataobjectnullable

Custom key-value data for your own use. Store any JSON object up to 50 properties. Values must be strings up to 250 characters. Useful for storing external IDs, tags, or integration data.

Other parameters
is_draftboolean
business_unit_idstringnullable
business_unitobjectnullable
tax_clausestringnullable
footerstringnullable
signaturestringnullable
translationsobject
total_discountnumber
creation_sourcestring
calculation_modestring
entity_idstring
date_yearinteger
shareable_idstringnullable
voided_atstring<date-time>nullable
transaction_typestringnullable
exchange_rateobjectnullable
total_convertednumbernullable
total_with_tax_convertednumbernullable
rounding_correctionnumbernullable
eslogobjectnullable
referencestringnullable
viesobjectnullable
deleted_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
total_paidnumber
total_duenumber
paid_in_fullboolean
fursobjectnullable
finaobjectnullable
ptstringnullable
date_servicestringnullable
date_service_tostringnullable
payment_termsstringnullable
document_relationsarray of objects
json
{
  "id": "adv_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": "adv_item_6595a27b5d35015c3ef0c402",
      "advance_invoice_id": "adv_6595a27b5d35015c3ef0c402",
      "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": "adv_item_6595a27b5d35015c3ef0c403",
      "advance_invoice_id": "adv_6595a27b5d35015c3ef0c402",
      "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,
  "rounding_correction": null,
  "transaction_type": "domestic",
  "vies": null,
  "tax_clause": null,
  "signature": "{entity_name}",
  "total_paid": 0,
  "total_due": 10370,
  "paid_in_full": false,
  "furs": null,
  "fina": null
}

Get shareable advance invoice as HTML

GET/advance-invoices/shareable/{shareableId}/html

Get advance invoice as HTML preview using a shareable token. No authentication required. Supports multiple languages via locale query parameter.

Path parameters

shareableIdstringrequired

Shareable document token

Query parameters

localestringoptional

Locale for number and date formatting (decimal separators, date order). Defaults to entity locale.

Possible values: "en-US", "de-DE", "it-IT", "fr-FR", "es-ES", "sl-SI", "pt-PT", "nl-NL", "pl-PL", "hr-HR", "sv-SE", "fi-FI", "et-EE", "bg-BG", "cs-CZ", "sk-SK", "nb-NO", "is-IS"

languagestringoptional

Language for document labels/translations. Defaults to locale value.

Possible values: "en-US", "de-DE", "it-IT", "fr-FR", "es-ES", "sl-SI", "pt-PT", "nl-NL", "pl-PL", "hr-HR", "sv-SE", "fi-FI", "et-EE", "bg-BG", "cs-CZ", "sk-SK", "nb-NO", "is-IS"

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.advanceInvoices.getShareableAdvanceInvoiceHtml('SHAREABLE_ID');

console.log(response);

Download shareable advance invoice as PDF

GET/advance-invoices/shareable/{shareableId}/pdf

Download advance invoice as PDF using a shareable token. No authentication required. Supports multiple languages via locale query parameter.

Path parameters

shareableIdstringrequired

Shareable document token

Query parameters

localestringoptional

Locale for number and date formatting (decimal separators, date order). Defaults to entity locale.

Possible values: "en-US", "de-DE", "it-IT", "fr-FR", "es-ES", "sl-SI", "pt-PT", "nl-NL", "pl-PL", "hr-HR", "sv-SE", "fi-FI", "et-EE", "bg-BG", "cs-CZ", "sk-SK", "nb-NO", "is-IS"

languagestringoptional

Language for document labels/translations. Defaults to locale value.

Possible values: "en-US", "de-DE", "it-IT", "fr-FR", "es-ES", "sl-SI", "pt-PT", "nl-NL", "pl-PL", "hr-HR", "sv-SE", "fi-FI", "et-EE", "bg-BG", "cs-CZ", "sk-SK", "nb-NO", "is-IS"

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const blob = await sdk.advanceInvoices.getShareableAdvanceInvoicePdf('SHAREABLE_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');

Download shareable advance invoice as e-SLOG XML

GET/advance-invoices/shareable/{shareableId}/eslog

Download advance invoice as e-SLOG 2.0 XML (Slovenian electronic invoice format) using a shareable token. No authentication required. Only available for Slovenian entities with valid e-SLOG validation.

Path parameters

shareableIdstringrequired

Shareable document token

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.advanceInvoices.getShareableAdvanceInvoiceEslog('SHAREABLE_ID');

console.log(response);

Retry document fiscalization

POST/documents/{id}/fiscalize

Manually 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.

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

idstringrequired

Document ID

Query parameters

typestringoptional

Document type. Optional — automatically inferred from the document ID prefix.

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

Body parameters

business_premise_namestringoptionalnullable
electronic_device_namestringoptionalnullable
operator_tax_numberstringoptionalnullable
operator_labelstringoptionalnullable
foreign_operatorbooleanoptionalnullable
json
null

Register fiscalized document output

POST/documents/{id}/register-output

Atomically 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_idstringoptional

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

Path parameters

idstringrequired

Document ID

Query parameters

typestringoptional

Document type. Optional — automatically inferred from the document ID prefix.

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

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.documents.registerDocumentOutput("inv_clx1234567890");

console.log(response);

Returns

print_countintegernullable
fiscalization_providerstringnullable
json
{
  "print_count": 0,
  "fiscalization_provider": "furs"
}

Restore a deleted document

POST/documents/{id}/restore

Restore a soft-deleted document from the trash. The document will be returned to its original state.

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

idstringrequired

Document ID

Query parameters

typestringoptional

Document type. Optional — automatically inferred from the document ID prefix.

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

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.documents.restoreDocument("inv_clx1234567890");

console.log(response);
json
null