Skip to content

Price Lists

The Price List object

object

Attributes

idstring
Other attributes
entity_idstring
namestring
descriptionstringnullable
customer_idstringnullable
deleted_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
Examplejson
{
  "id": "pl_6595a27b5d35015c3ef0c400",
  "entity_id": "ent_6595a27b5d35015c3ef0c3fc",
  "name": "Wholesale",
  "description": "Prices for resellers",
  "customer_id": null,
  "price_count": 2,
  "created_at": "2024-06-01T09:00:00.000Z",
  "updated_at": "2024-06-01T09:00:00.000Z",
  "deleted_at": null
}

Create a price list

POST/price-lists

Create a price list, optionally with initial prices (created atomically with the list). Returns 409 when a live list already has this name, or when the customer already has a live list; 422 when customer_id is not a live customer of the entity or a price entry is invalid.

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

namestringrequired

Price list name. Unique per entity (case-insensitive) among live lists.

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.priceLists.create({
  name: "Wholesale"
}, {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);
Example:

Returns

idstring
Other parameters
entity_idstring
namestring
descriptionstringnullable
customer_idstringnullable
deleted_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
json
{
  "id": "pl_6595a27b5d35015c3ef0c400",
  "entity_id": "ent_6595a27b5d35015c3ef0c3fc",
  "name": "Wholesale",
  "description": "Prices for resellers",
  "customer_id": null,
  "price_count": 2,
  "created_at": "2024-06-01T09:00:00.000Z",
  "updated_at": "2024-06-01T09:00:00.000Z",
  "deleted_at": null
}

Resolve effective item prices

GET/items/prices

The price a document line for each item would get by default: the price list's row when price_list_id is given and has one (source: price_list), otherwise the item's own price (source: item; its gross price when set, else its net price). Results follow the order of ids; ids that are not live items of the entity are omitted.

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

idsstringrequired

Comma-separated item ids, 1 to 200. Results follow this order.

price_list_idstring<resource-id>optional

Price list to price under. Omit for the items' own prices.

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.priceLists.resolveItemPrices({
  ids: "item_a,item_b"
}, {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);

Returns

dataarray of objects
json
{
  "data": [
    {
      "item_id": "item_6595a27b5d35015c3ef0c3fa",
      "price": 27.5,
      "gross_price": null,
      "source": "price_list"
    },
    {
      "item_id": "item_6595a27b5d35015c3ef0c3f9",
      "price": 10,
      "gross_price": null,
      "source": "item"
    }
  ]
}

List price lists

GET/price-lists

Retrieve a paginated list of the entity's price lists, excluding deleted ones, with optional filtering and sorting. Supports cursor-based pagination, flexible JSON querying with MongoDB-style operators, and sorting; results are ordered newest first (created_at descending, ties broken by id) unless order_by says otherwise. customer_id filters by exact customer; search is a case- and accent-insensitive substring match on the list name.

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, name, description, customer_id, 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

Case- and accent-insensitive substring match on the list name (cenik finds Čenik). % and _ match themselves.

customer_idstringoptional

Only lists dedicated to this customer.

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.priceLists.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": "pl_6595a27b5d35015c3ef0c400",
      "entity_id": "ent_6595a27b5d35015c3ef0c3fc",
      "name": "Wholesale",
      "description": "Prices for resellers",
      "customer_id": null,
      "price_count": 2,
      "created_at": "2024-06-01T09:00:00.000Z",
      "updated_at": "2024-06-01T09:00:00.000Z",
      "deleted_at": null
    },
    {
      "id": "pl_6595a27b5d35015c3ef0c401",
      "entity_id": "ent_6595a27b5d35015c3ef0c3fc",
      "name": "Acme Ltd",
      "description": null,
      "customer_id": "cus_6595a27b5d35015c3ef0c3fb",
      "price_count": 0,
      "created_at": "2024-06-01T09:00:00.000Z",
      "updated_at": "2024-06-01T09:00:00.000Z",
      "deleted_at": null
    }
  ],
  "pagination": {
    "total": 2,
    "next_cursor": null,
    "prev_cursor": null,
    "has_more": false
  }
}

Get a price list

GET/price-lists/{id}

Get a price list

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

Price list identifier (pl_ prefix).

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.priceLists.get('PRICELISTS_ID', {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);

Returns

idstring
Other parameters
entity_idstring
namestring
descriptionstringnullable
customer_idstringnullable
deleted_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
json
{
  "id": "pl_6595a27b5d35015c3ef0c400",
  "entity_id": "ent_6595a27b5d35015c3ef0c3fc",
  "name": "Wholesale",
  "description": "Prices for resellers",
  "customer_id": null,
  "price_count": 2,
  "created_at": "2024-06-01T09:00:00.000Z",
  "updated_at": "2024-06-01T09:00:00.000Z",
  "deleted_at": null
}

Update a price list

PATCH/price-lists/{id}

Rename a list, change its description, or attach it to / detach it from a customer. name: null leaves the name unchanged; description: null and customer_id: null clear those fields. Prices are managed through the /price-lists/{id}/prices operations.

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

Price list identifier (pl_ prefix).

Body parameters

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.priceLists.update('PRICELISTS_ID', {
  name: "Reseller prices"
}, {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);
Example:

Returns

idstring
Other parameters
entity_idstring
namestring
descriptionstringnullable
customer_idstringnullable
deleted_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
json
{
  "id": "pl_6595a27b5d35015c3ef0c400",
  "entity_id": "ent_6595a27b5d35015c3ef0c3fc",
  "name": "Reseller prices",
  "description": "Prices for resellers",
  "customer_id": null,
  "price_count": 2,
  "created_at": "2024-06-01T09:00:00.000Z",
  "updated_at": "2024-06-01T09:00:00.000Z",
  "deleted_at": null
}

Delete a price list

DELETE/price-lists/{id}

Soft-deletes the list. Documents that were priced from it keep their price_list_id and their stored prices.

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

Price list identifier (pl_ prefix).

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

await sdk.priceLists.delete('PRICELISTS_ID', {
  entity_id: "YOUR_ENTITY_ID"
});

console.log('Deleted successfully');

Remove an item's price from a price list

DELETE/price-lists/{id}/prices/{item_id}

Removes the row. Returns 404 when the list or the row does not exist.

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

Price list identifier (pl_ prefix).

item_idstringrequired

Catalog item identifier.

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

await sdk.priceLists.removePriceListPrice('PRICELISTS_ID', 'ITEM_ID', {
  entity_id: "YOUR_ENTITY_ID"
});

console.log('Deleted successfully');

List the prices of a price list

GET/price-lists/{id}/prices

Cursor-paginated rows of the list, ordered by item_id ascending. Rows of deleted items are hidden. Filter with item_ids (comma-separated, up to 200).

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

Price list identifier (pl_ prefix).

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.

item_idsstringoptional

Comma-separated item ids (up to 200).

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.priceLists.listPriceListPrices('PRICELISTS_ID', undefined, {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);

Returns

dataarray of objects
paginationobject

Pagination metadata including cursors and result counts

json
{
  "data": [
    {
      "price_list_id": "pl_6595a27b5d35015c3ef0c400",
      "item_id": "item_6595a27b5d35015c3ef0c3f9",
      "price": null,
      "gross_price": 12.2,
      "created_at": "2024-06-01T09:00:00.000Z",
      "updated_at": "2024-06-01T09:00:00.000Z"
    },
    {
      "price_list_id": "pl_6595a27b5d35015c3ef0c400",
      "item_id": "item_6595a27b5d35015c3ef0c3fa",
      "price": 27.5,
      "gross_price": null,
      "created_at": "2024-06-01T09:00:00.000Z",
      "updated_at": "2024-06-01T09:00:00.000Z"
    }
  ],
  "pagination": {
    "total": 2,
    "next_cursor": null,
    "prev_cursor": null,
    "has_more": false
  }
}

Set prices in a price list

POST/price-lists/{id}/prices

Upserts 1 to 500 prices in one transaction. Each entry carries exactly one of price (net) or gross_price; duplicate item_ids in one request and entries with both or neither price are rejected with 422, as is any item that is not a live item of the entity (the message lists the missing ids). Returns the resulting rows in request order.

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

Price list identifier (pl_ prefix).

Body parameters

pricesarray of objectsrequired

1 to 500 entries, one per item. Existing rows are replaced; setting price clears gross_price and vice versa.

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.priceLists.upsertPriceListPrices('PRICELISTS_ID', {
  prices: [
    {
      item_id: "item_6595a27b5d35015c3ef0c3fa",
      price: 27.5
    },
    {
      item_id: "item_6595a27b5d35015c3ef0c3f9",
      gross_price: 12.2
    }
  ]
}, {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);

Returns

dataarray of objects
json
{
  "data": [
    {
      "price_list_id": "pl_6595a27b5d35015c3ef0c400",
      "item_id": "item_6595a27b5d35015c3ef0c3fa",
      "price": 27.5,
      "gross_price": null,
      "created_at": "2024-06-01T09:00:00.000Z",
      "updated_at": "2024-06-01T09:00:00.000Z"
    },
    {
      "price_list_id": "pl_6595a27b5d35015c3ef0c400",
      "item_id": "item_6595a27b5d35015c3ef0c3f9",
      "price": null,
      "gross_price": 12.2,
      "created_at": "2024-06-01T09:00:00.000Z",
      "updated_at": "2024-06-01T09:00:00.000Z"
    }
  ]
}

Set prices in bulk

POST/price-lists/{id}/prices/bulk

Derives many prices in one statement from the catalog items' own prices (source: item_price, sale-side items only) or from another price list (source: price_list; the source may be this list itself to adjust it in place). Each base price is changed by adjustment (percent: +10 raises by 10%, -15 lowers by 15%; fixed: the value is added) and rounded half up to decimals (default 2 with an adjustment). Results are floored at 0. Bulk sets both the amount and the net/gross mode from the source: an item_price source takes the item's mode (gross_price when set, else price) and a price_list source takes the source row's mode, so with overwrite_existing: true an existing row's net/gross mode is replaced by the source's mode. Narrow the run with item_ids, category and only_existing; overwrite_existing: false keeps rows already in the list. Responds with the number of rows inserted or 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

Price list identifier (pl_ prefix).

Body parameters

sourcestringrequired

Where base prices come from: item_price (the catalog items' own prices, sale-side items only) or price_list (another list's rows, see source_price_list_id). The net/gross mode comes from the source along with the amount (an item with a gross_price or a gross source row gives a gross price, otherwise a net price), and replaces the mode of an existing row when overwrite_existing is true.

Possible values: "item_price", "price_list"

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

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.priceLists.bulkSetPriceListPrices('PRICELISTS_ID', {
  source: "item_price",
  adjustment: {
    type: "percent",
    value: 10
  }
}, {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);
Example:

Returns

affected_countinteger
json
{
  "affected_count": 2
}