Price Lists
Price Lists
Named sets of item prices that override catalog prices on documents, optionally dedicated to one customer.
The Price List object
Attributes
{
"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
/price-listsCreate 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 ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Body parameters
Price list name. Unique per entity (case-insensitive) among live lists.
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);Returns
{
"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
/items/pricesThe 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 ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Query parameters
Comma-separated item ids, 1 to 200. Results follow this order.
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
{
"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
/price-listsRetrieve 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 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, 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
Case- and accent-insensitive substring match on the list name (cenik finds Čenik). % and _ match themselves.
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
Pagination metadata including cursors and result counts
{
"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
/price-lists/{id}Get a price list
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
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
{
"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
/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 ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
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);Returns
{
"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
/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 ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
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
/price-lists/{id}/prices/{item_id}Removes the row. Returns 404 when the list or the row does not exist.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Price list identifier (pl_ prefix).
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
/price-lists/{id}/pricesCursor-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 ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Price list identifier (pl_ prefix).
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.
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
Pagination metadata including cursors and result counts
{
"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
/price-lists/{id}/pricesUpserts 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 ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Price list identifier (pl_ prefix).
Body parameters
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
{
"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
/price-lists/{id}/prices/bulkDerives 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 ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Path parameters
Price list identifier (pl_ prefix).
Body parameters
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"
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);Returns
{
"affected_count": 2
}