Skip to content

Orders

Orders

Order management for e-commerce integrations.
Receive, store, and process orders from external platforms into invoices.

The Order object

object

Attributes

idstring
Other attributes
entity_idstring
order_integration_idstring
source_idstring
source_order_numberstringnullable
document_localestringnullable
paidboolean
paid_atstring<date-time>nullable
fulfilledboolean
fulfilled_atstring<date-time>nullable
cancelledboolean
cancelled_atstring<date-time>nullable
refundedboolean
refunded_atstring<date-time>nullable
customer_namestringnullable
customer_emailstringnullable
customer_idstringnullable
currency_codestring
totalnumber
total_with_taxnumber
total_discountnumber
total_shippingnumber
payment_methodstringnullable
payment_gatewaystringnullable
invoice_idstringnullable
estimate_idstringnullable
process_afterstring<date-time>nullable
completeboolean
items_changed_after_processingboolean
raw_dataobjectnullable
source_event_idstringnullable
errorstringnullable
ordered_atstring<date-time>nullable
processed_atstring<date-time>nullable
metadatastringnullable
deleted_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
Examplejson
{
  "id": "ord_6595a27b5d35015c3ef0c3fd",
  "entity_id": "ent_6595a27b5d35015c3ef0c3fd",
  "order_integration_id": "oint_6595a27b5d35015c3ef0c3fd",
  "source": "manual",
  "source_id": "manual-001",
  "source_order_number": null,
  "status": "pending",
  "paid": false,
  "paid_at": null,
  "fulfilled": false,
  "fulfilled_at": null,
  "cancelled": false,
  "cancelled_at": null,
  "refunded": false,
  "refunded_at": null,
  "customer_name": null,
  "customer_email": null,
  "customer": null,
  "billing_address": null,
  "shipping_address": null,
  "customer_id": null,
  "currency_code": "EUR",
  "total": 100,
  "total_with_tax": 122,
  "total_discount": 0,
  "total_shipping": 0,
  "items": [
    {
      "name": "Payload Adapter Kit",
      "quantity": 2,
      "price": 50,
      "gross_price": 61,
      "total": 100,
      "total_with_tax": 122,
      "tax_rate": 22
    }
  ],
  "payment_status": "unpaid",
  "payment_method": null,
  "payment_gateway": null,
  "invoice_id": null,
  "estimate_id": null,
  "process_after": null,
  "transactions": [],
  "complete": false,
  "items_changed_after_processing": false,
  "raw_data": null,
  "source_event_id": null,
  "error": null,
  "ordered_at": null,
  "processed_at": null,
  "metadata": {},
  "created_at": "2024-01-01T00:00:00.000Z",
  "updated_at": "2024-09-01T00:00:00.000Z",
  "deleted_at": null
}

Create a new order

POST/orders

Create a new order manually or from an external source.

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

order_integration_idstringrequired
sourcestringrequired

Order source platform

Possible values: "shopify", "woocommerce", "magento", "custom", "manual"

source_idstringrequired
currency_codestringrequired
totalnumberrequired
total_with_taxnumberrequired
itemsarray of objectsrequired
Other parameters
source_order_numberstringoptionalnullable
document_localestringoptionalnullable
customer_namestringoptionalnullable
customer_emailstringoptionalnullable
total_discountnumberoptional
total_shippingnumberoptional
payment_methodstringoptionalnullable
payment_gatewaystringoptionalnullable
ordered_atstring<date-time>optionalnullable
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.orders.create({
  order_integration_id: "oint_6595a27b5d35015c3ef0c3fd",
  source: "manual",
  source_id: "manual-001",
  currency_code: "EUR",
  total: 100,
  total_with_tax: 122,
  items: [
    {
      name: "Payload Adapter Kit",
      quantity: 2,
      price: 50,
      gross_price: 61,
      total: 100,
      total_with_tax: 122,
      tax_rate: 22
    }
  ]
}, {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);
Example:

Returns

idstring
Other parameters
entity_idstring
order_integration_idstring
source_idstring
source_order_numberstringnullable
document_localestringnullable
paidboolean
paid_atstring<date-time>nullable
fulfilledboolean
fulfilled_atstring<date-time>nullable
cancelledboolean
cancelled_atstring<date-time>nullable
refundedboolean
refunded_atstring<date-time>nullable
customer_namestringnullable
customer_emailstringnullable
customer_idstringnullable
currency_codestring
totalnumber
total_with_taxnumber
total_discountnumber
total_shippingnumber
payment_methodstringnullable
payment_gatewaystringnullable
invoice_idstringnullable
estimate_idstringnullable
process_afterstring<date-time>nullable
completeboolean
items_changed_after_processingboolean
raw_dataobjectnullable
source_event_idstringnullable
errorstringnullable
ordered_atstring<date-time>nullable
processed_atstring<date-time>nullable
metadatastringnullable
deleted_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
json
{
  "id": "ord_6595a27b5d35015c3ef0c3fd",
  "entity_id": "ent_6595a27b5d35015c3ef0c3fd",
  "order_integration_id": "oint_6595a27b5d35015c3ef0c3fd",
  "source": "manual",
  "source_id": "manual-001",
  "source_order_number": null,
  "status": "pending",
  "paid": false,
  "paid_at": null,
  "fulfilled": false,
  "fulfilled_at": null,
  "cancelled": false,
  "cancelled_at": null,
  "refunded": false,
  "refunded_at": null,
  "customer_name": null,
  "customer_email": null,
  "customer": null,
  "billing_address": null,
  "shipping_address": null,
  "customer_id": null,
  "currency_code": "EUR",
  "total": 100,
  "total_with_tax": 122,
  "total_discount": 0,
  "total_shipping": 0,
  "items": [
    {
      "name": "Payload Adapter Kit",
      "quantity": 2,
      "price": 50,
      "gross_price": 61,
      "total": 100,
      "total_with_tax": 122,
      "tax_rate": 22
    }
  ],
  "payment_status": "unpaid",
  "payment_method": null,
  "payment_gateway": null,
  "invoice_id": null,
  "estimate_id": null,
  "process_after": null,
  "transactions": [],
  "complete": false,
  "items_changed_after_processing": false,
  "raw_data": null,
  "source_event_id": null,
  "error": null,
  "ordered_at": null,
  "processed_at": null,
  "metadata": {},
  "created_at": "2024-01-01T00:00:00.000Z",
  "updated_at": "2024-09-01T00:00:00.000Z",
  "deleted_at": null
}

List all orders

GET/orders

Retrieve a paginated list of orders with optional filtering 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.

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, status, source, source_id, customer_name, customer_email, payment_status, order_integration_id, ordered_at, created_at, updated_at

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.

deletedbooleanoptional

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.orders.list({
  limit: 20,
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);

Returns

dataarray of objects
paginationobject

Pagination metadata including cursors and result counts

json
{
  "data": [
    {
      "id": "ord_6595a27b5d35015c3ef0c3fd",
      "entity_id": "ent_6595a27b5d35015c3ef0c3fd",
      "order_integration_id": "oint_6595a27b5d35015c3ef0c3fd",
      "source": "manual",
      "source_id": "manual-001",
      "source_order_number": null,
      "status": "pending",
      "paid": false,
      "paid_at": null,
      "fulfilled": false,
      "fulfilled_at": null,
      "cancelled": false,
      "cancelled_at": null,
      "refunded": false,
      "refunded_at": null,
      "customer_name": null,
      "customer_email": null,
      "customer": null,
      "billing_address": null,
      "shipping_address": null,
      "customer_id": null,
      "currency_code": "EUR",
      "total": 100,
      "total_with_tax": 122,
      "total_discount": 0,
      "total_shipping": 0,
      "items": [
        {
          "name": "Payload Adapter Kit",
          "quantity": 2,
          "price": 50,
          "gross_price": 61,
          "total": 100,
          "total_with_tax": 122,
          "tax_rate": 22
        }
      ],
      "payment_status": "unpaid",
      "payment_method": null,
      "payment_gateway": null,
      "invoice_id": null,
      "estimate_id": null,
      "process_after": null,
      "transactions": [],
      "complete": false,
      "items_changed_after_processing": false,
      "raw_data": null,
      "source_event_id": null,
      "error": null,
      "ordered_at": null,
      "processed_at": null,
      "metadata": {},
      "created_at": "2024-01-01T00:00:00.000Z",
      "updated_at": "2024-09-01T00:00:00.000Z",
      "deleted_at": null
    }
  ],
  "pagination": {
    "total": 1,
    "next_cursor": null,
    "prev_cursor": null,
    "has_more": false
  }
}

Get order by ID

GET/orders/{id}

Retrieve a single order by its unique identifier.

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. 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.orders.get('ORDERS_ID', {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);

Returns

idstring
Other parameters
entity_idstring
order_integration_idstring
source_idstring
source_order_numberstringnullable
document_localestringnullable
paidboolean
paid_atstring<date-time>nullable
fulfilledboolean
fulfilled_atstring<date-time>nullable
cancelledboolean
cancelled_atstring<date-time>nullable
refundedboolean
refunded_atstring<date-time>nullable
customer_namestringnullable
customer_emailstringnullable
customer_idstringnullable
currency_codestring
totalnumber
total_with_taxnumber
total_discountnumber
total_shippingnumber
payment_methodstringnullable
payment_gatewaystringnullable
invoice_idstringnullable
estimate_idstringnullable
process_afterstring<date-time>nullable
completeboolean
items_changed_after_processingboolean
raw_dataobjectnullable
source_event_idstringnullable
errorstringnullable
ordered_atstring<date-time>nullable
processed_atstring<date-time>nullable
metadatastringnullable
deleted_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
json
{
  "id": "ord_6595a27b5d35015c3ef0c3fd",
  "entity_id": "ent_6595a27b5d35015c3ef0c3fd",
  "order_integration_id": "oint_6595a27b5d35015c3ef0c3fd",
  "source": "manual",
  "source_id": "manual-001",
  "source_order_number": null,
  "status": "pending",
  "paid": false,
  "paid_at": null,
  "fulfilled": false,
  "fulfilled_at": null,
  "cancelled": false,
  "cancelled_at": null,
  "refunded": false,
  "refunded_at": null,
  "customer_name": null,
  "customer_email": null,
  "customer": null,
  "billing_address": null,
  "shipping_address": null,
  "customer_id": null,
  "currency_code": "EUR",
  "total": 100,
  "total_with_tax": 122,
  "total_discount": 0,
  "total_shipping": 0,
  "items": [
    {
      "name": "Payload Adapter Kit",
      "quantity": 2,
      "price": 50,
      "gross_price": 61,
      "total": 100,
      "total_with_tax": 122,
      "tax_rate": 22
    }
  ],
  "payment_status": "unpaid",
  "payment_method": null,
  "payment_gateway": null,
  "invoice_id": null,
  "estimate_id": null,
  "process_after": null,
  "transactions": [],
  "complete": false,
  "items_changed_after_processing": false,
  "raw_data": null,
  "source_event_id": null,
  "error": null,
  "ordered_at": null,
  "processed_at": null,
  "metadata": {},
  "created_at": "2024-01-01T00:00:00.000Z",
  "updated_at": "2024-09-01T00:00:00.000Z",
  "deleted_at": null
}

Update an order

PATCH/orders/{id}

Update an existing order. Only the provided fields will be updated.

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. Prefix depends on the resource, for example inv_, cus_, or ent_.

Body parameters

source_order_numberstringoptionalnullable
document_localestringoptionalnullable
customer_namestringoptionalnullable
customer_emailstringoptionalnullable
currency_codestringoptional
totalnumberoptional
total_with_taxnumberoptional
total_discountnumberoptional
total_shippingnumberoptional
payment_methodstringoptionalnullable
payment_gatewaystringoptionalnullable
ordered_atstring<date-time>optionalnullable
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.orders.update('ORDERS_ID', {
  customer_name: "Updated Customer Name",
  customer_email: "updated@example.com"
}, {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);
Example:

Returns

idstring
Other parameters
entity_idstring
order_integration_idstring
source_idstring
source_order_numberstringnullable
document_localestringnullable
paidboolean
paid_atstring<date-time>nullable
fulfilledboolean
fulfilled_atstring<date-time>nullable
cancelledboolean
cancelled_atstring<date-time>nullable
refundedboolean
refunded_atstring<date-time>nullable
customer_namestringnullable
customer_emailstringnullable
customer_idstringnullable
currency_codestring
totalnumber
total_with_taxnumber
total_discountnumber
total_shippingnumber
payment_methodstringnullable
payment_gatewaystringnullable
invoice_idstringnullable
estimate_idstringnullable
process_afterstring<date-time>nullable
completeboolean
items_changed_after_processingboolean
raw_dataobjectnullable
source_event_idstringnullable
errorstringnullable
ordered_atstring<date-time>nullable
processed_atstring<date-time>nullable
metadatastringnullable
deleted_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
json
{
  "id": "ord_6595a27b5d35015c3ef0c3fd",
  "entity_id": "ent_6595a27b5d35015c3ef0c3fd",
  "order_integration_id": "oint_6595a27b5d35015c3ef0c3fd",
  "source": "manual",
  "source_id": "manual-001",
  "source_order_number": null,
  "status": "pending",
  "paid": false,
  "paid_at": null,
  "fulfilled": false,
  "fulfilled_at": null,
  "cancelled": false,
  "cancelled_at": null,
  "refunded": false,
  "refunded_at": null,
  "customer_name": null,
  "customer_email": null,
  "customer": null,
  "billing_address": null,
  "shipping_address": null,
  "customer_id": null,
  "currency_code": "EUR",
  "total": 100,
  "total_with_tax": 122,
  "total_discount": 0,
  "total_shipping": 0,
  "items": [
    {
      "name": "Payload Adapter Kit",
      "quantity": 2,
      "price": 50,
      "gross_price": 61,
      "total": 100,
      "total_with_tax": 122,
      "tax_rate": 22
    }
  ],
  "payment_status": "unpaid",
  "payment_method": null,
  "payment_gateway": null,
  "invoice_id": null,
  "estimate_id": null,
  "process_after": null,
  "transactions": [],
  "complete": false,
  "items_changed_after_processing": false,
  "raw_data": null,
  "source_event_id": null,
  "error": null,
  "ordered_at": null,
  "processed_at": null,
  "metadata": {},
  "created_at": "2024-01-01T00:00:00.000Z",
  "updated_at": "2024-09-01T00:00:00.000Z",
  "deleted_at": null
}

Delete an order

DELETE/orders/{id}

Soft delete an order by its unique identifier.

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

await sdk.orders.delete('ORDERS_ID', {
  entity_id: "YOUR_ENTITY_ID"
});

console.log('Deleted successfully');

Process or retry an order

POST/orders/{id}/process

Process a pending order or resume failed processing. For refunded orders, retry only reconciliation of the existing document; uncertain outcomes after the document was voided remain blocked for manual reconciliation.
Polish B2B issuance returns 422 KSEF_AUTH_FAILED when KSeF rejects the entity's KSeF token; no number is used.

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. 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.orders.processOrder('ORDERS_ID', {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);

Returns

idstring
Other parameters
entity_idstring
order_integration_idstring
source_idstring
source_order_numberstringnullable
document_localestringnullable
paidboolean
paid_atstring<date-time>nullable
fulfilledboolean
fulfilled_atstring<date-time>nullable
cancelledboolean
cancelled_atstring<date-time>nullable
refundedboolean
refunded_atstring<date-time>nullable
customer_namestringnullable
customer_emailstringnullable
customer_idstringnullable
currency_codestring
totalnumber
total_with_taxnumber
total_discountnumber
total_shippingnumber
payment_methodstringnullable
payment_gatewaystringnullable
invoice_idstringnullable
estimate_idstringnullable
process_afterstring<date-time>nullable
completeboolean
items_changed_after_processingboolean
raw_dataobjectnullable
source_event_idstringnullable
errorstringnullable
ordered_atstring<date-time>nullable
processed_atstring<date-time>nullable
metadatastringnullable
deleted_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
json
{
  "id": "ord_6595a27b5d35015c3ef0c3fd",
  "entity_id": "ent_6595a27b5d35015c3ef0c3fd",
  "order_integration_id": "oint_6595a27b5d35015c3ef0c3fd",
  "source": "manual",
  "source_id": "manual-001",
  "source_order_number": null,
  "status": "invoiced",
  "paid": false,
  "paid_at": null,
  "fulfilled": false,
  "fulfilled_at": null,
  "cancelled": false,
  "cancelled_at": null,
  "refunded": false,
  "refunded_at": null,
  "customer_name": null,
  "customer_email": null,
  "customer": null,
  "billing_address": null,
  "shipping_address": null,
  "customer_id": null,
  "currency_code": "EUR",
  "total": 100,
  "total_with_tax": 122,
  "total_discount": 0,
  "total_shipping": 0,
  "items": [
    {
      "name": "Payload Adapter Kit",
      "quantity": 2,
      "price": 50,
      "gross_price": 61,
      "total": 100,
      "total_with_tax": 122,
      "tax_rate": 22
    }
  ],
  "payment_status": "unpaid",
  "payment_method": null,
  "payment_gateway": null,
  "invoice_id": "inv_7595a27b5d35015c3ef0c3fe",
  "estimate_id": null,
  "process_after": null,
  "transactions": [],
  "complete": false,
  "items_changed_after_processing": false,
  "raw_data": null,
  "source_event_id": null,
  "error": null,
  "ordered_at": null,
  "processed_at": "2024-01-15T12:00:00.000Z",
  "metadata": {},
  "created_at": "2024-01-01T00:00:00.000Z",
  "updated_at": "2024-09-01T00:00:00.000Z",
  "deleted_at": null
}
Example:

Cancel an order

POST/orders/{id}/cancel

Cancel a pending order. Already invoiced orders cannot be cancelled.

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. 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.orders.cancelOrder('ORDERS_ID', {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);

Returns

idstring
Other parameters
entity_idstring
order_integration_idstring
source_idstring
source_order_numberstringnullable
document_localestringnullable
paidboolean
paid_atstring<date-time>nullable
fulfilledboolean
fulfilled_atstring<date-time>nullable
cancelledboolean
cancelled_atstring<date-time>nullable
refundedboolean
refunded_atstring<date-time>nullable
customer_namestringnullable
customer_emailstringnullable
customer_idstringnullable
currency_codestring
totalnumber
total_with_taxnumber
total_discountnumber
total_shippingnumber
payment_methodstringnullable
payment_gatewaystringnullable
invoice_idstringnullable
estimate_idstringnullable
process_afterstring<date-time>nullable
completeboolean
items_changed_after_processingboolean
raw_dataobjectnullable
source_event_idstringnullable
errorstringnullable
ordered_atstring<date-time>nullable
processed_atstring<date-time>nullable
metadatastringnullable
deleted_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
json
{
  "id": "ord_6595a27b5d35015c3ef0c3fd",
  "entity_id": "ent_6595a27b5d35015c3ef0c3fd",
  "order_integration_id": "oint_6595a27b5d35015c3ef0c3fd",
  "source": "manual",
  "source_id": "manual-001",
  "source_order_number": null,
  "status": "cancelled",
  "paid": false,
  "paid_at": null,
  "fulfilled": false,
  "fulfilled_at": null,
  "cancelled": true,
  "cancelled_at": "2024-01-15T12:00:00.000Z",
  "refunded": false,
  "refunded_at": null,
  "customer_name": null,
  "customer_email": null,
  "customer": null,
  "billing_address": null,
  "shipping_address": null,
  "customer_id": null,
  "currency_code": "EUR",
  "total": 100,
  "total_with_tax": 122,
  "total_discount": 0,
  "total_shipping": 0,
  "items": [
    {
      "name": "Payload Adapter Kit",
      "quantity": 2,
      "price": 50,
      "gross_price": 61,
      "total": 100,
      "total_with_tax": 122,
      "tax_rate": 22
    }
  ],
  "payment_status": "unpaid",
  "payment_method": null,
  "payment_gateway": null,
  "invoice_id": null,
  "estimate_id": null,
  "process_after": null,
  "transactions": [],
  "complete": false,
  "items_changed_after_processing": false,
  "raw_data": null,
  "source_event_id": null,
  "error": null,
  "ordered_at": null,
  "processed_at": null,
  "metadata": {},
  "created_at": "2024-01-01T00:00:00.000Z",
  "updated_at": "2024-09-01T00:00:00.000Z",
  "deleted_at": null
}

Reissue an order invoice

POST/orders/{id}/reissue

Credit the existing invoice and create a new one with current order items. Only available when order items have changed after initial processing.
Polish B2B issuance returns 422 KSEF_AUTH_FAILED when KSeF rejects the entity's KSeF token; no number is used.

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. 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.orders.reissueOrder('ORDERS_ID', {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);

Returns

idstring
Other parameters
entity_idstring
order_integration_idstring
source_idstring
source_order_numberstringnullable
document_localestringnullable
paidboolean
paid_atstring<date-time>nullable
fulfilledboolean
fulfilled_atstring<date-time>nullable
cancelledboolean
cancelled_atstring<date-time>nullable
refundedboolean
refunded_atstring<date-time>nullable
customer_namestringnullable
customer_emailstringnullable
customer_idstringnullable
currency_codestring
totalnumber
total_with_taxnumber
total_discountnumber
total_shippingnumber
payment_methodstringnullable
payment_gatewaystringnullable
invoice_idstringnullable
estimate_idstringnullable
process_afterstring<date-time>nullable
completeboolean
items_changed_after_processingboolean
raw_dataobjectnullable
source_event_idstringnullable
errorstringnullable
ordered_atstring<date-time>nullable
processed_atstring<date-time>nullable
metadatastringnullable
deleted_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
json
{
  "id": "ord_6595a27b5d35015c3ef0c3fd",
  "entity_id": "ent_6595a27b5d35015c3ef0c3fd",
  "order_integration_id": "oint_6595a27b5d35015c3ef0c3fd",
  "source": "manual",
  "source_id": "manual-001",
  "source_order_number": null,
  "status": "invoiced",
  "paid": false,
  "paid_at": null,
  "fulfilled": false,
  "fulfilled_at": null,
  "cancelled": false,
  "cancelled_at": null,
  "refunded": false,
  "refunded_at": null,
  "customer_name": null,
  "customer_email": null,
  "customer": null,
  "billing_address": null,
  "shipping_address": null,
  "customer_id": null,
  "currency_code": "EUR",
  "total": 100,
  "total_with_tax": 122,
  "total_discount": 0,
  "total_shipping": 0,
  "items": [
    {
      "name": "Payload Adapter Kit",
      "quantity": 2,
      "price": 50,
      "gross_price": 61,
      "total": 100,
      "total_with_tax": 122,
      "tax_rate": 22
    }
  ],
  "payment_status": "unpaid",
  "payment_method": null,
  "payment_gateway": null,
  "invoice_id": "inv_8595a27b5d35015c3ef0c3ff",
  "estimate_id": null,
  "process_after": null,
  "transactions": [],
  "complete": false,
  "items_changed_after_processing": false,
  "raw_data": null,
  "source_event_id": null,
  "error": null,
  "ordered_at": null,
  "processed_at": "2024-01-16T12:00:00.000Z",
  "metadata": {},
  "created_at": "2024-01-01T00:00:00.000Z",
  "updated_at": "2024-09-01T00:00:00.000Z",
  "deleted_at": null
}