Estimates
Estimates
Estimate management operations.
Create, retrieve, and list estimates with flexible querying.
Estimates are issued by Entities to Customers and contain line items with optional taxes.
Estimates represent proposed pricing and are valid until a specified date.
The Estimate object
Attributes
Date the estimate was created (ISO 8601 datetime at midnight UTC)
Date until which the estimate is valid (ISO 8601 datetime at midnight UTC)
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": "est_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": "est_item_6595a27b5d35015c3ef0c402",
"estimate_id": "est_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": "est_item_6595a27b5d35015c3ef0c403",
"estimate_id": "est_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_valid_till": "2025-04-15T00:00:00.000Z"
}Create a new estimate
/estimatesCreate a new estimate with line items.
This is the recommended endpoint for normal estimate creation. Use it when Space Invoices should calculate line totals, taxes, discounts, document totals, numbering, customer handling, and lifecycle hooks from the supplied business inputs.
Customer is optional - can be omitted or added inline without referencing a customer_id.
The estimate number is auto-generated based on the entity's number format settings.
Taxes are calculated automatically based on the tax rates provided.
Estimates are valid until the date_valid_till field (defaults to 30 days from creation).
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 estimate. At least one item is required.
Document date in YYYY-MM-DD format
Estimate validity date in YYYY-MM-DD format
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.estimates.create({
items: [
{
name: "Satellite Communication Module",
quantity: 1,
price: 1500
}
]
}, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
Date the estimate was created (ISO 8601 datetime at midnight UTC)
Date until which the estimate is valid (ISO 8601 datetime at midnight UTC)
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": "est_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": "est_item_6595a27b5d35015c3ef0c3fd",
"estimate_id": "est_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_valid_till": "2026-02-01T00:00:00.000Z"
}Create estimate with pre-calculated totals
/estimates/customUnavailable for Spanish entities, including drafts; use the standard document routes. Advanced endpoint for importing estimates that already have authoritative pre-calculated totals. Do not use this for normal estimate 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, customer handling, lifecycle hooks) is identical to the standard create endpoint.
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.estimates.createCustom({
total: 5000,
total_with_tax: 6100,
taxes: [
{
rate: 22,
base: 5000,
amount: 1100
}
],
items: [
{
name: "Website Redesign",
quantity: 1,
price: 5000,
total: 5000,
total_with_tax: 6100,
taxes: [
{
rate: 22
}
]
}
]
}, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
Date the estimate was created (ISO 8601 datetime at midnight UTC)
Date until which the estimate is valid (ISO 8601 datetime at midnight UTC)
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": "est_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": "est_item_6595a27b5d35015c3ef0c3fd",
"estimate_id": "est_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_valid_till": "2026-02-01T00:00:00.000Z"
}List all estimates
/estimatesRetrieve a paginated list of estimates with optional filtering and sorting.
Supports cursor-based pagination, flexible JSON querying with MongoDB-style operators, full-text search, and sorting.
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 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.
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, date_valid_till
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:
- document_relations - Linked documents (invoices, etc.)
Usage:?include=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.estimates.list({
limit: 20,
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
Pagination metadata including cursors and result counts
{
"data": [
{
"id": "est_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": "est_item_6595a27b5d35015c3ef0c402",
"estimate_id": "est_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": "est_item_6595a27b5d35015c3ef0c403",
"estimate_id": "est_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_valid_till": "2025-04-15T00:00:00.000Z"
}
],
"pagination": {
"total": 1,
"next_cursor": null,
"prev_cursor": null,
"has_more": false
}
}Get estimate by ID
/estimates/{id}Retrieve a single estimate by its unique identifier. Returns the complete estimate 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:
- document_relations - Linked documents (invoices, etc.)
Usage:?include=document_relations
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.estimates.get('est_6595a27b5d35015c3ef0c3fd', undefined, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
Date the estimate was created (ISO 8601 datetime at midnight UTC)
Date until which the estimate is valid (ISO 8601 datetime at midnight UTC)
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": "est_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": "est_item_6595a27b5d35015c3ef0c402",
"estimate_id": "est_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": "est_item_6595a27b5d35015c3ef0c403",
"estimate_id": "est_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_valid_till": "2025-04-15T00:00:00.000Z"
}Update an estimate
/estimates/{id}Update an existing estimate.
Creates a version snapshot before applying changes.
Cannot update voided estimates.
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
Estimate validity date (YYYY-MM-DD or ISO datetime format). Set to null to clear.
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.estimates.update('est_6595a27b5d35015c3ef0c3fd', {
note: "Updated pricing valid until end of month",
change_reason: "Added validity note"
}, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
Date the estimate was created (ISO 8601 datetime at midnight UTC)
Date until which the estimate is valid (ISO 8601 datetime at midnight UTC)
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": "est_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": "est_item_6595a27b5d35015c3ef0c402",
"estimate_id": "est_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": "est_item_6595a27b5d35015c3ef0c403",
"estimate_id": "est_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_valid_till": "2025-04-15T00:00:00.000Z"
}Get estimate version history
/estimates/{id}/versionsRetrieve the version history for an estimate. 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.estimates.getVersions('est_6595a27b5d35015c3ef0c3fd', {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
{
"versions": [
{
"id": "ver_abc123",
"document_type": "estimate",
"document_id": "est_6595a27b5d35015c3ef0c3fd",
"version": 2,
"snapshot": {
"id": "est_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": "est_item_6595a27b5d35015c3ef0c3fd",
"estimate_id": "est_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_valid_till": "2026-02-01T00:00:00.000Z"
},
"changed_fields": [
"note"
],
"user": {
"id": "usr_123",
"name": "Alex Carter",
"email": "alex.carter@starward.example"
},
"reason": "Updated validity note",
"created_at": "2025-01-15T10:30:00.000Z"
},
{
"id": "ver_xyz789",
"document_type": "estimate",
"document_id": "est_6595a27b5d35015c3ef0c3fd",
"version": 1,
"snapshot": {
"id": "est_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": "est_item_6595a27b5d35015c3ef0c3fd",
"estimate_id": "est_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_valid_till": "2026-02-01T00:00:00.000Z"
},
"changed_fields": [
"items"
],
"user": {
"id": "usr_123",
"name": "Alex Carter",
"email": "alex.carter@starward.example"
},
"reason": "Revised scope and pricing",
"created_at": "2025-01-14T15:00:00.000Z"
}
],
"count": 2
}Get specific estimate version
/estimates/{id}/versions/{version}Retrieve a specific version snapshot of an estimate.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Estimate ID
Version number
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.estimates.getVersion('est_6595a27b5d35015c3ef0c3fd', 1, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
Version record ID
{
"id": "ver_abc123",
"document_type": "estimate",
"document_id": "est_6595a27b5d35015c3ef0c3fd",
"version": 1,
"snapshot": {
"id": "est_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": "est_item_6595a27b5d35015c3ef0c3fd",
"estimate_id": "est_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_valid_till": "2026-02-01T00:00:00.000Z"
},
"changed_fields": [
"items"
],
"user": {
"id": "usr_123",
"name": "Alex Carter",
"email": "alex.carter@starward.example"
},
"reason": "Revised scope and pricing",
"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 estimate preview
/estimates/renderRender an HTML preview of an estimate without saving to the database. Perfect for displaying live previews in estimate 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
Estimate validity date in YYYY-MM-DD format
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.estimates.renderEstimatePreview({
items: [
{
name: "Ground Segment Implementation",
quantity: 1,
price: 5000
}
],
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('est_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');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