Business Units
Business Units
Manage entity-owned business units used for document branding, defaults, and integrations.
The Business Unit object
Attributes
{
"id": "unit_7595a27b5d35015c3ef0c3fe",
"entity_id": "ent_6595a27b5d35015c3ef0c3fd",
"name": "Starward Berlin Office",
"address": "Friedrichstraße 95",
"address_2": "Floor 2",
"post_code": "10117",
"city": "Berlin",
"state": "Berlin",
"country": "Germany",
"country_code": "DE",
"email": "berlin@starward.example",
"phone": "+49 30 12345678",
"website": "https://berlin.starward.example",
"settings": {
"pdf_template": "modern",
"primary_color": "#1D4ED8",
"logo_scale_percent": 110,
"default_invoice_note": "Issued by {entity_name} / {unit_name}",
"default_invoice_payment_terms": "Payment due in 15 days.",
"document_footer": "Questions? Contact {entity_email}.",
"default_document_signature": "Starward Berlin Office team",
"bank_accounts": [
{
"type": "iban",
"iban": "DE89370400440532013000",
"bic": "COBADEFFXXX",
"bank_name": "Commerzbank AG",
"name": "Starward Berlin Office Account",
"is_default": true
}
],
"delivery_note_hide_prices": false,
"credit_note_negative_values": true,
"show_payment_amounts": true,
"email_defaults": {
"invoice_subject": "Invoice {document_number} from {entity_name}",
"invoice_body": "Hello {customer_name},\n\nPlease find your invoice attached."
},
"translations": {
"default_invoice_note": {
"de-DE": "Ausgestellt von {entity_name} / {unit_name}"
},
"default_invoice_payment_terms": {
"de-DE": "Zahlbar innerhalb von 15 Tagen."
},
"document_footer": {
"de-DE": "Fragen? Kontaktieren Sie {entity_email}."
},
"default_document_signature": {
"de-DE": "Starward Berlin Office Team"
},
"email_defaults": {
"invoice_subject": {
"de-DE": "Rechnung {document_number} von {entity_name}"
},
"invoice_body": {
"de-DE": "Hallo {customer_name},\n\nanbei finden Sie Ihre Rechnung."
}
}
}
},
"numbering_index": 2,
"logo_file_id": "file_6595a27b5d35015c3ef0c3ff",
"signature_file_id": "file_8595a27b5d35015c3ef0c400",
"is_active": true,
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-09-01T00:00:00.000Z",
"deleted_at": null
}Create a business unit
/business-unitsCreate a business unit
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Body parameters
import SpaceInvoices from '@spaceinvoices/js-sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.businessUnits.create({
name: "Starward Berlin Office"
});
console.log(response);Returns
{
"id": "unit_6595a27b5d35015c3ef0c3fd",
"entity_id": "ent_6595a27b5d35015c3ef0c3fd",
"name": "Starward Berlin Office",
"address": null,
"address_2": null,
"post_code": null,
"city": null,
"state": null,
"country": null,
"country_code": null,
"email": null,
"phone": null,
"website": null,
"settings": {},
"numbering_index": 1,
"logo_file_id": null,
"signature_file_id": null,
"is_active": true,
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-01T00:00:00.000Z",
"deleted_at": null
}List business units
/business-unitsList business units
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.
Include archived business units in the response.
import SpaceInvoices from '@spaceinvoices/js-sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.businessUnits.list({ limit: 20 });
console.log(response);Returns
{
"data": [
{
"id": "unit_6595a27b5d35015c3ef0c3fd",
"entity_id": "ent_6595a27b5d35015c3ef0c3fd",
"name": "Starward Berlin Office",
"address": null,
"address_2": null,
"post_code": null,
"city": null,
"state": null,
"country": null,
"country_code": null,
"email": null,
"phone": null,
"website": null,
"settings": {},
"numbering_index": 1,
"logo_file_id": null,
"signature_file_id": null,
"is_active": true,
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-01T00:00:00.000Z",
"deleted_at": null
},
{
"id": "unit_7595a27b5d35015c3ef0c3fe",
"entity_id": "ent_6595a27b5d35015c3ef0c3fd",
"name": "Starward Berlin Office",
"address": "Friedrichstraße 95",
"address_2": "Floor 2",
"post_code": "10117",
"city": "Berlin",
"state": "Berlin",
"country": "Germany",
"country_code": "DE",
"email": "berlin@starward.example",
"phone": "+49 30 12345678",
"website": "https://berlin.starward.example",
"settings": {
"pdf_template": "modern",
"primary_color": "#1D4ED8",
"logo_scale_percent": 110,
"default_invoice_note": "Issued by {entity_name} / {unit_name}",
"default_invoice_payment_terms": "Payment due in 15 days.",
"document_footer": "Questions? Contact {entity_email}.",
"default_document_signature": "Starward Berlin Office team",
"bank_accounts": [
{
"type": "iban",
"iban": "DE89370400440532013000",
"bic": "COBADEFFXXX",
"bank_name": "Commerzbank AG",
"name": "Starward Berlin Office Account",
"is_default": true
}
],
"delivery_note_hide_prices": false,
"credit_note_negative_values": true,
"show_payment_amounts": true,
"email_defaults": {
"invoice_subject": "Invoice {document_number} from {entity_name}",
"invoice_body": "Hello {customer_name},\n\nPlease find your invoice attached."
},
"translations": {
"default_invoice_note": {
"de-DE": "Ausgestellt von {entity_name} / {unit_name}"
},
"default_invoice_payment_terms": {
"de-DE": "Zahlbar innerhalb von 15 Tagen."
},
"document_footer": {
"de-DE": "Fragen? Kontaktieren Sie {entity_email}."
},
"default_document_signature": {
"de-DE": "Starward Berlin Office Team"
},
"email_defaults": {
"invoice_subject": {
"de-DE": "Rechnung {document_number} von {entity_name}"
},
"invoice_body": {
"de-DE": "Hallo {customer_name},\n\nanbei finden Sie Ihre Rechnung."
}
}
}
},
"numbering_index": 2,
"logo_file_id": "file_6595a27b5d35015c3ef0c3ff",
"signature_file_id": "file_8595a27b5d35015c3ef0c400",
"is_active": true,
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-09-01T00:00:00.000Z",
"deleted_at": null
}
],
"pagination": {
"total": 2,
"next_cursor": null,
"prev_cursor": null,
"has_more": false
}
}Get a business unit
/business-units/{id}Get a business unit
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
Query parameters
import SpaceInvoices from '@spaceinvoices/js-sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.businessUnits.get("inv_6595a27b5d35015c3ef0c3fd");
console.log(response);Returns
{
"id": "unit_7595a27b5d35015c3ef0c3fe",
"entity_id": "ent_6595a27b5d35015c3ef0c3fd",
"name": "Starward Berlin Office",
"address": "Friedrichstraße 95",
"address_2": "Floor 2",
"post_code": "10117",
"city": "Berlin",
"state": "Berlin",
"country": "Germany",
"country_code": "DE",
"email": "berlin@starward.example",
"phone": "+49 30 12345678",
"website": "https://berlin.starward.example",
"settings": {
"pdf_template": "modern",
"primary_color": "#1D4ED8",
"logo_scale_percent": 110,
"default_invoice_note": "Issued by {entity_name} / {unit_name}",
"default_invoice_payment_terms": "Payment due in 15 days.",
"document_footer": "Questions? Contact {entity_email}.",
"default_document_signature": "Starward Berlin Office team",
"bank_accounts": [
{
"type": "iban",
"iban": "DE89370400440532013000",
"bic": "COBADEFFXXX",
"bank_name": "Commerzbank AG",
"name": "Starward Berlin Office Account",
"is_default": true
}
],
"delivery_note_hide_prices": false,
"credit_note_negative_values": true,
"show_payment_amounts": true,
"email_defaults": {
"invoice_subject": "Invoice {document_number} from {entity_name}",
"invoice_body": "Hello {customer_name},\n\nPlease find your invoice attached."
},
"translations": {
"default_invoice_note": {
"de-DE": "Ausgestellt von {entity_name} / {unit_name}"
},
"default_invoice_payment_terms": {
"de-DE": "Zahlbar innerhalb von 15 Tagen."
},
"document_footer": {
"de-DE": "Fragen? Kontaktieren Sie {entity_email}."
},
"default_document_signature": {
"de-DE": "Starward Berlin Office Team"
},
"email_defaults": {
"invoice_subject": {
"de-DE": "Rechnung {document_number} von {entity_name}"
},
"invoice_body": {
"de-DE": "Hallo {customer_name},\n\nanbei finden Sie Ihre Rechnung."
}
}
}
},
"numbering_index": 2,
"logo_file_id": "file_6595a27b5d35015c3ef0c3ff",
"signature_file_id": "file_8595a27b5d35015c3ef0c400",
"is_active": true,
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-09-01T00:00:00.000Z",
"deleted_at": null
}Update a business unit
/business-units/{id}Update a business unit
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
Body parameters
import SpaceInvoices from '@spaceinvoices/js-sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.businessUnits.update("inv_6595a27b5d35015c3ef0c3fd", {
name: "Starward Berlin HQ"
});
console.log(response);Returns
{
"id": "unit_7595a27b5d35015c3ef0c3fe",
"entity_id": "ent_6595a27b5d35015c3ef0c3fd",
"name": "Starward Berlin HQ",
"address": "Friedrichstraße 95",
"address_2": "Floor 2",
"post_code": "10117",
"city": "Berlin",
"state": "Berlin",
"country": "Germany",
"country_code": "DE",
"email": "berlin@starward.example",
"phone": "+49 30 12345678",
"website": "https://berlin.starward.example",
"settings": {
"pdf_template": "minimal",
"primary_color": "#0F172A",
"logo_scale_percent": 110,
"default_invoice_note": "Issued by {entity_name} / {unit_name}",
"default_invoice_payment_terms": "Payment due in 15 days.",
"document_footer": "Questions? Contact {entity_email}.",
"default_document_signature": "Starward Berlin Office team",
"bank_accounts": [
{
"type": "iban",
"iban": "DE89370400440532013000",
"bic": "COBADEFFXXX",
"bank_name": "Commerzbank AG",
"name": "Starward Berlin Office Account",
"is_default": true
}
],
"delivery_note_hide_prices": false,
"credit_note_negative_values": true,
"show_payment_amounts": true,
"email_defaults": {
"invoice_subject": "Invoice {document_number} from {entity_name}",
"invoice_body": "Hello {customer_name},\n\nPlease find your invoice attached."
},
"translations": {
"default_invoice_note": {
"de-DE": "Ausgestellt von {entity_name} / {unit_name}"
},
"default_invoice_payment_terms": {
"de-DE": "Zahlbar innerhalb von 15 Tagen."
},
"document_footer": {
"de-DE": "Fragen? Kontaktieren Sie {entity_email}."
},
"default_document_signature": {
"de-DE": "Starward Berlin Office Team"
},
"email_defaults": {
"invoice_subject": {
"de-DE": "Rechnung {document_number} von {entity_name}"
},
"invoice_body": {
"de-DE": "Hallo {customer_name},\n\nanbei finden Sie Ihre Rechnung."
}
}
}
},
"numbering_index": 2,
"logo_file_id": "file_6595a27b5d35015c3ef0c3ff",
"signature_file_id": "file_8595a27b5d35015c3ef0c400",
"is_active": true,
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-09-01T00:00:00.000Z",
"deleted_at": null
}Archive a business unit
/business-units/{id}Archive a business unit
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
import SpaceInvoices from '@spaceinvoices/js-sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
await sdk.businessUnits.delete("inv_6595a27b5d35015c3ef0c3fd");
console.log('Deleted successfully');