# Shopamine REST API v1 — full reference Every per-entity file concatenated. Generated; see https://misc.shopamine.com/restapi/llms.txt for the index. # Shopamine REST API v1 — Overview URL format, authentication, scopes, update semantics, localized strings, list parameters and error responses. Read this first. ## Introduction This is the documentation for Shopamine's [RESTful](http://en.wikipedia.org/wiki/Representational_state_transfer) API, version 2.1. All data is transferred using [JSON](http://json.org/). 1 ### Obtain an API token Generate the API token for your store in the store admin panel. It is a bearer token — treat it like a password. 2 ### Activate the API interface Contact [support@shopamine.com](mailto:support@shopamine.com) to have your store loaded onto the dedicated API server. Integrations are served from the API server rather than your store's regular domains, so this step is required before you can start. Include your store URL in the request. 3 ### Get familiar with the API The easiest way in is to change something in the admin interface and see how it reflects in the API output. **In almost all cases the API expects exactly the same format back.** **Try it before you build.** The [API playground](https://misc.shopamine.com/restapi/playground.html) shows exactly what Shopamine sends to your server for [external prices](https://misc.shopamine.com/restapi/#external-prices) and [webhooks](https://misc.shopamine.com/restapi/#webhooks), in your browser and without an API key. The [changelog](https://misc.shopamine.com/restapi/changelog.html) lists what changed in each release. ### Your first call ```http GET /www.example.com/api/v1/items/list?limit=5 HTTP/1.1 Host: api.shopamine.com Authorization: Bearer 8vd9n8nv9wvm195v1vmanlksdmv Accept: application/json ``` ### Using this API from tools and AI assistants Everything on this page is also published in machine-readable forms, generated from the same source, so you do not have to read HTML to work against this API. - **[openapi.json](https://misc.shopamine.com/restapi/openapi.json)** — An **OpenAPI 3.1** description of the API. Point Postman, a client generator, Swagger UI or Redoc at it and you get a browsable reference or a working client library without writing any of it by hand. It describes the entities whose field definitions can be read directly from the platform source; the rest are documented on this page only. - **[llms.txt](https://misc.shopamine.com/restapi/llms.txt)** — An index for AI assistants, following the `llms.txt` convention. It states the base URL, the authentication scheme and the scope model up front, then links a small markdown file per entity — so an assistant can read the one part it needs instead of this entire page. There is also [llms-full.txt](https://misc.shopamine.com/restapi/llms-full.txt) for tools that prefer a single document. - **[Postman collection](https://misc.shopamine.com/restapi/shopamine.postman_collection.json)** — Every endpoint as a ready-made **Postman** request, one folder per entity, with the example bodies from this page. Import it, set the `shop_domain` and `access_token` variables, and try calls on your own store; your token stays in your Postman. Requests other than `GET` change live data, and each one says so. Both are regenerated whenever this page changes, so they cannot drift out of step with it. Neither is hand-written: field requiredness is read from the platform source and the example responses are real captured calls. ## How to form URLs Each shop runs on its own domain name. Within that domain, all API URLs carry the prefix `/api/v1/`. All calls must be made over HTTPS — and because most shops do not have their own secure domains, they pass through one of Shopamine's HTTPS gateways, e.g. `api.shopamine.com`. *URL_BASE* ``` https://api.shopamine.com/www.example.com/api/v1 ``` This common prefix is referred to as `[URL_BASE]` throughout the reference below. ### Standard operations All entities use the same URL patterns for the same operations: | Method | Endpoint | Description | |---|---|---| | `GET` | `[URL_BASE]/[entity]/list` | Retrieves a list of entities. The result has a single field `data` containing the array. See [list parameters](https://misc.shopamine.com/restapi/#list_params). | | `POST` | `[URL_BASE]/[entity]/create` | Creates a new entity. The response is the entity, exactly as a `GET` on its URL would return it. | | `GET` | `[URL_BASE]/[entity]/[id]` | Retrieves one entity as a JSON representation. | | `POST` | `[URL_BASE]/[entity]/[id]` | Updates one entity. Incoming JSON is [merged](https://misc.shopamine.com/restapi/#updates_note) with existing data; the response is the updated entity. | | `DELETE` | `[URL_BASE]/[entity]/[id]` | Deletes one entity. Returns `{ "status": "ok" }` on success, or `{ "status": "failed", "error_msg": "…" }` on error. | ## Authentication Every call must carry a security token in an HTTP header, as described in [OAuth 2 Bearer Token Usage](http://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-22). ```http GET /www.example.com/api/v1/items/list HTTP/1.1 Authorization: Bearer 8vd9n8nv9wvm195v1vmanlksdmv ``` **Keep the token server-side.** It grants full read and write access to your store's catalogue, customers and orders. Never ship it in a browser or mobile client. ## How to update data One of the main purposes of the API is synchronising data such as item prices with external software. Transferring entire documents every time would be slow and brittle, so **incoming data is merged with existing data**. Fields not present in the incoming JSON are left untouched. To update only an item's first price and stock amount: ```http POST /www.example.com/api/v1/items/123 HTTP/1.1 Authorization: Bearer 8vd9n8nv9wvm195v1vmanlksdmv Content-Type: application/json { "stock_amount": 18, "prices": { "p1": 124.99 } } ``` Because of the merge, **deleting a field requires explicitly setting it to `null`**. Omitting it simply leaves it as it was. Clients that cannot send an HTTP `DELETE` may use `POST …/[entity]/[id]?method=delete` instead — it is treated exactly like `DELETE`. ## Localized strings Most strings visible to shop visitors are localized. In the API they are JSON objects whose keys are locale identifiers (e.g. `en_US`) and whose values are the translations. The special key `"__"` is the default: it must always be present and is used wherever a translation is missing. ```json { "__": "Chocolate cookies", "sl": "Čokoladni piškoti", "de": "Schokoladenkekse", "en_GB": "Chocolate biscuits" } ``` Single-language shops should use only the default. Multi-language shops should keep the default in the shop owner's language — that is what they see in the admin interface. Localized strings merge like everything else, so removing a translation means sending `null` (an empty string `""` removes it as well): ```json { "__": "Apple iPhone 14", "sl": null } ``` ## Types & formats | Type | Representation | |---|---| | Decimal | Used for prices, discounts and spec values. Stored with a maximum of **6 decimal places**. | | Datetime | An [ISO 8601](http://en.wikipedia.org/wiki/ISO-8601)-like string in **UTC**, e.g. `"2012-10-08T12:34:56.789Z"`. Milliseconds are optional; otherwise this is the only accepted incoming format. Make sure your data really is UTC. | | Localized string | An object keyed by locale, with `"__"` as the default. See [Localized strings](https://misc.shopamine.com/restapi/#local_strings). | | Percentage | A plain decimal between 0 and 100 — a 20% discount is `20`, not `0.2`. | ## List parameters Because some shops have very large inventories, all entity lists support (and require) pagination. Each entity type has its own maximum page size, documented in its section. **Query parameters** | Parameter | Description | Example | |---|---|---| | limit | Maximum number of entities to retrieve. Defaults to the entity's page size. A value above the entity's maximum page size is rejected with [`400`](https://misc.shopamine.com/restapi/#errors) rather than silently reduced. | `…/list?limit=40` First 40 entities. | | offset | Number of entities to skip from the start of the list. Defaults to `0`. | `…/list?offset=40&limit=20` Third page, 20 per page. | | order | Field(s) to sort by, comma-separated. Prefix a field with `-` to reverse it. Available fields are listed per entity. | `…/list?order=-date_updated` Most recently edited first. | | startId / endId | Alternative to offset paging: retrieves entities whose id falls in the given range, inclusive. Useful for stable, repeatable exports of large lists. | `…/list?startId=1000&endId=2000` | When sorting on a field where several entities can share a value, append `id` as the last sort field — `?order=[sort_field],id` — to guarantee a stable order across pages. ## Errors Failures return a JSON body with a `status` of `failed` and a human-readable `error_msg`. ```json { "status": "failed", "error_msg": "Item with id 123 does not exist" } ``` | Status | Meaning | |---|---| | `200` | Success. The body carries the entity or the `data` array. | | `400` | Invalid request — e.g. a `limit` above the entity's maximum page size, or a request body that cannot be parsed (invalid JSON, an unknown field or enum value). Its message then starts with `Invalid request body:`. Such requests used to answer `500`. | | `401` | Missing or invalid bearer token, or an API key that has been deactivated or has expired. The response includes an error message. | | `404` | Unknown entity, or unknown id within a known entity. | | `429` | Too many requests — back off and retry. | | `500` | Unexpected server error. Contact support with the request details. | | `503` | Service temporarily unavailable — a dependency the request needed could not be reached. Safe to retry. | --- Source: [https://misc.shopamine.com/restapi/#intro](https://misc.shopamine.com/restapi/#intro) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — Items / Products Products and variants: prices, stock, specs, images, node placement, and bulk create/update. **items** - **Path:** `[URL_BASE]/items/` - **Scope:** `items` — a request without it returns `403 You need scope "items"` - **Operations:** `list`, `get`, `create`, `update`, `delete` **item-bulk** - **Path:** `[URL_BASE]/items/` - **Scope:** `items` — a request without it returns `403 You need scope "items"` **Standard operations — items** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/items/list` | List, paginated | | `GET` | `[URL_BASE]/items/[id]` | Retrieve one | | `POST` | `[URL_BASE]/items/create` | Create | | `POST` | `[URL_BASE]/items/[id]` | Update (merge: absent fields untouched, explicit null clears) | | `DELETE` | `[URL_BASE]/items/[id]` | Delete | **Base path:** `[URL_BASE]/items/…` Items are the products in your catalogue: prices, stock, specs, images and their placement in the node tree. An item of type `"variants"` is a collection of items, one of which must be selected when adding to basket. ### Endpoints | Method | Endpoint | Description | |---|---|---| | `GET, POST, DELETE` | `[URL_BASE]/items/{id}` | Refer to an item by its Shopamine ID. | | `GET` | `[URL_BASE]/items/list` | Retrieve lists of items. See [list parameters](https://misc.shopamine.com/restapi/#list_params) and the item-specific filters below. | | `POST` | `[URL_BASE]/items/create` | Create a new item. | | `GET, POST, DELETE` | `[URL_BASE]/items/by_bar_code/{bar_code}` | Find, update or delete an item by bar code (EAN). | | `GET, POST, DELETE` | `[URL_BASE]/items/by_external_id/{external_id}` | Find, update or delete an item by its external ID (called *User Code* in the admin dashboard). | | `GET, POST, DELETE` | `[URL_BASE]/items/by_sku/{sku}` | Find, update or delete an item by SKU. | | `POST` | `[URL_BASE]/items/{item_id}/supplier/remove` | Body `{ "list": [supplier_item_row_ids] }` removes the given supplier-item rows from this item. | ### List parameters | Parameter | Description | |---|---| | limit | Page size. Default **10**, maximum **200**. Example: `?limit=20&offset=30` | | updated_after | Filters the list to items changed after the given time — `?updated_after=2026-01-31T00:00:00+00:00`. ISO format; `dd-MM-yyyy` and `dd-MM-yyyy'T'HH:mm:ss` are accepted too. A supplier price change (see `suppliers`) counts as a change to the item, even when no other item field is touched, and is reflected in `date_updated` too — use that value as your next cursor to pick up supplier-driven changes without re-fetching everything. Changing the store's `computed_prices` configuration counts as a change too, for any cursor before the config change: it widens the pull to every item the new configuration reaches (all items, or only those with supplier rows, depending on the configuration), and stops widening once your cursor has passed it — no re-fetch of the same items on later polls. Adds the sort fields `external_supplier`, `carry_over` and `date_created`. | | erp_sync | Filters the list to items whose `erp_sync` is `true` or `false`, for example `?erp_sync=true`. Any other value returns `400`. Works with `updated_after` and both paging modes. | | order | Sort by `id`, `external_id`, `name`, `model`, `sku`, `bar_code`, `stock_amount`, `avail_in_days`, `date_updated`, `price:p1`–`price:p3`, `discount:d1`–`discount:d3`. Example: `?order=-date_updated` | | label_specs | When present and not `=false`, each entry in `specs.values` embeds the full spec metadata under `spec` and, for choice-typed specs, the selected choice under `choice` (replacing `choice_id`). Numeric, text and boolean entries gain the `spec` sub-object but keep their value field unchanged. `specs.layout` is unchanged. Useful for self-contained responses without separate lookups against `/specs/`. | ### Fields **Item object** | Field | Required | Description | |---|---|---| | id | Required | Shopamine's ID number for this item. | | external_id | Optional | External ID for this item. Called *User Code* in the admin dashboard. | | type | Required | Either `"physical"` or `"variants"`. A `"variants"` item is a collection of items, one of which must be selected when placing into basket; otherwise the item can be bought stand-alone. | | name | Required | The [localized](https://misc.shopamine.com/restapi/#local_strings) name of this item. | | list_desc | Optional | Localized list description. | | short_desc | Optional | Localized short description. | | long_desc | Optional | Localized long description. | | nodes | Optional | IDs of nodes this item belongs to, separated by type (`brands`, `categories`, `pages`, `finders`, `containers`) so each can be updated separately. On write an entry may also be an object `{ "external_id": …, "createOnNew": true, "parent_node_id": …, "name": {…} }` — the node is looked up by `external_id` and can be auto-created. Update requests also accept `skipNodesForExisting` and `retainNodeType` to control how existing node links are merged. | | prices | Required | Base prices. `p1` is required, `p2` and `p3` are optional. For compatibility `p1`–`p3` are mirrored at the item's top level (read and write), as are `d1`–`d3` for discounts, and `prices` also carries `wholesale`. | | discounts | Optional | Discounts as percentages between 0 and 100 — a 20% discount is `20`. | | shipping_dimensions | Optional | `weight` (in **grams**) may appear on its own and is used in shipping-fee calculation. `width`, `depth` and `height` must either all be present or all be absent; sizes are currently not used for any calculation. | | model | Optional | Model designation for this item. | | sku | Optional | This is the SKU code for this item. | | bar_code | Optional | This is the bar code (EAN) for this item. | | supplier_code | Optional | This is the supplier code for this item. | | additional_code | Optional | A secondary code used for internal references / integrations. Free-form string. | | external_supplier | Required | Boolean — true when the item is sourced from an external supplier (in which case `final_price` is the authoritative selling price; see below). | | wholesale | Optional | The item's own cost price (NNC), emitted at the root under this key. This is an item-level value and is **independent of, and unrelated to, the per-supplier prices** — in particular it is not the selected supplier's `cost_price`. Despite the key name it carries the item's cost, not a wholesale figure. | | computed_prices | Read-only | Carries both bases: `net` is tax-exclusive and `gross` is tax-inclusive for each of the four prices. | | distributor_rrp | Read-only | The selected supplier's Distributor RRP. It equals that supplier's `ppc` unless a rule, a fixed value or a supplier price list sets it otherwise. When it is present, `list_price` carries the same value. Emitted when the item has a selected supplier and the value is set. To change it, write it on the supplier row (see `suppliers`). | | distributor_rrp_mode | Read-only | How `distributor_rrp` is set: `LINKED` (derived from the supplier's `ppc`, so it follows the feed), `FIXED` (a set value that stays when `ppc` changes) or `PRICE_LIST` (set by a supplier price list imported in the admin). Emitted when set. | | carry_over | Required | Boolean — true when the item is marked as a carry-over from a previous preorder season (B2B catalog flag; default false). | | erp_sync | Read-only | Boolean: true when the item currently meets its ERP sync condition. Always present; an item without a condition, or with one that cannot be evaluated, is `false`. The value is stored when the item is saved and is re-checked when a category or brand is created, moved, deleted or changed in a way a condition reads (its type or tags), for the items in it and below it. The response to `POST` and `PUT` on items shows the value after that re-check. For conditions based on a one-of list it can lag until the item is next saved. | | stock_amount | Optional | This is the number of items that are immediately available. | | avail_in_days | Optional | This is the number of days in which this item is available when out of stock. | | unit_of_sale | Optional | Localized text: the unit shown next to the quantity in the shop, e.g. `{ "__": "Pair" }`. `null` clears it. Can be sent on its own. Emitted when set. | | sale_qty_minimum | Optional | The smallest quantity a customer can order, a whole number from 1 to 100,000. `sale_qty_minimum`, `sale_qty_maximum` and `sale_qty_step` must be sent together in one request, or the request is rejected; send `null` for any you don't want to set. `null` clears the value, and the store's default applies. If it is not a multiple of `sale_qty_step`, the shop rounds it up to the next multiple. Emitted when set. | | sale_qty_maximum | Optional | The largest quantity a customer can order, a whole number from 1 to 100,000; `null` means no limit on the item (the store's default applies). Sent together with `sale_qty_minimum` and `sale_qty_step`. If it is not a multiple of `sale_qty_step`, the shop rounds it down. Emitted when set. | | sale_qty_step | Optional | The quantity increment, a whole number from 1 to 10,000: the customer can only order multiples of it (with `6`: 6, 12, 18 …). For an item sold only in whole packs, set both `sale_qty_minimum` and `sale_qty_step` to the pack size. Sent together with `sale_qty_minimum` and `sale_qty_maximum`; `null` clears it. Emitted when set. | | sale_over_stock | Optional | Boolean: whether customers may order more than `stock_amount`. Only read when the three `sale_qty_*` fields are in the same request (sent alone it is ignored), and only kept while at least one of them has a value. `null` clears it, and the store's default applies. Emitted when set. | | tax_class_id | Optional | This is the ID of the tax class to which this item belongs. | | tax_rate | Optional | The effective total tax rate for this item in the current request's tax zone (as a percentage, e.g. `22` for 22%). Only emitted when the request carries store context. | | tax_inclusive | Optional | Boolean — true when stored prices already include tax. Only emitted when the request carries store context. | | buyable | Optional | This determines if this item can currently be bought. `as_part_only` means that it can be bought only as a variant of a container item. Possible values are `yes`, `no`, `as_part_only`, `supplied`, `draft`, `archived`, `preorder` and `preorder_cancelled`. Note the asymmetry: `preorder_cancelled` is only ever emitted by the API and cannot be supplied on write (it is a system-managed state); all other values may be both read and written. | | default_buyable | Optional | Determines the default `buyable` status for items of type variant. I.e. if an Item with `default_buyable="as_part_only"` is updated with `buyable = "yes"` the `buyable` value will automatically be converted to "as_part_only" | | warranty_months | Optional | This is the length of warranty for this item, in months. | | variants_configuration | Optional | For items with type `variants`, this field contains the configuration. If `chooser_type` is `"names"`, the user will choose one of the variants by their respective names. If it is `"specs"`, the user will choose by choosing relevant spec values. In that case, the specs have to be listed in `chooser_specs`. Using this field, it's also possible to set the sorting order of item's variants. See the [Sample Object](https://misc.shopamine.com/restapi/#item-sample-object) bellow for an example of using specs to define the variant sorting order. | | customization | Optional | This field contains information about customization options for this item. There can be any number of them, and each is represented as either a choice of options (`type: "choices"`), or a field for the user to enter (`type: "text"`). `price_delta` is the change in price of the item, applied if the user chooses to use the option. `pricing_steps` determines in which order price deltas are appliced. It is useful when combining relative and absolute price deltas. | | external_buy_settings | Optional | This rarely used field is used for items that are actually bought on other sites. | | extra_search_kws | Optional | This field is used to enter additional search keywords that this item can be found by, in the (rare) case when they don't appear in any of the other fields. | | related_items | Optional | Contains IDs of related items | | variant_members | Optional | Contains variant items | | warehouses | Optional | Contains warehouse id and stock | | variant_containers | Optional | For variant items (a "physical" item that belongs to a container): the list of container items it is a variant of. Mutually exclusive in practice with `variant_members` — a given response carries one or the other. | | suppliers | Optional | Per-supplier breakdown of this item (supplier id/name/code and the SupplierItem rows linking the item to each supplier; see the sample for the full structure). Each supplier-item row carries its own prices: `nnc` (cost price) and `ppc` (list price) are always present, while `selling_price` (the price the retailer pays), `wholesale_price`, `stock`, `stock_available`, `avail_in_days`, `supplier_description`, and `price_increase` are emitted only when set. `price_increase` is the per-unit markup over cost (`selling_price = nnc + price_increase`) and may be negative. All prices are scoped to that single `(supplier, item)` row, not shared across the supplier. On write, each row must carry `supplier_item_id`; the wholesale price is written via the `vpc` key, and new rows require `nnc`, `ppc` and a stock value. `selling_price` and `price_increase` are read only. Each row also carries `distributor_rrp` and `distributor_rrp_mode` when set (see `distributor_rrp` above). On write, a `distributor_rrp` value fixes the row's Distributor RRP (mode `FIXED`); `distributor_rrp_mode` `LINKED` makes it follow `ppc` again (a `distributor_rrp` in the same row is then ignored), and `FIXED` without a value keeps the current value as the fixed one. Any other mode, including `PRICE_LIST`, is rejected with an error. A supplier price list that covers the row takes precedence over a written value. | | suppliers_combined_description | Optional | Aggregated localized description from all linked SupplierItems, joined with newlines. Only emitted when at least one supplier has a description. | **Tax basis of price fields.** Prices (`p1`–`p3`) and the root `wholesale` follow the item's `tax_inclusive` flag. `final_price` is always tax-*inclusive*. All supplier prices (`cost_price`, `list_price`, `wholesale_price`, `distributor_rrp` and the `supplier_items[]` prices) use the same tax basis as the item's prices: tax-*inclusive* when the item's `tax_inclusive` is true, otherwise net. If the item has no setting of its own, the store's price 1 default applies, so read `tax_inclusive` on the same item to know which. Imported supplier price lists are converted to that basis. ### Sample object *item.json* ```json { "id": 1234567, "external_id": "abc", "sku": "qwe", "bar_code": "2131231123", "supplier_code": "1234", "additional_code": "INT-9876", "type": "physical" / "variants", "name": { "__": "default name", "sl": "Slovensko ime", "de": "Deutsch-Namen", ... }, "model": "abc", "list_desc": { "__": ... }, "short_desc": { "__": ... }, "long_desc": { "__": ... }, "nodes": { "brands": [1, 2, 3], "categories": [4, 5, 6], "pages": [6, 7, 8] }, // Tax basis of the price fields in this response: // - prices (p1/p2/p3) and the root "wholesale" follow the item's // "tax_inclusive" flag — tax-included when true, net when false. // - final_price is tax-INCLUSIVE. // - all supplier prices (cost_price, list_price, wholesale_price, // distributor_rrp and the supplier_items[] prices) use the same basis as // the item's prices: tax-included when "tax_inclusive" is true, net when // false (an item with no setting of its own follows the store's price 1 default). // - computed_prices carry both: "net" is tax-EXCLUSIVE and "gross" is // tax-INCLUSIVE for each of the four prices. "prices": { "p1": 123.456, "p2": 123.344, "p3": 140.422, "wholesale": 110.0 // optional wholesale price }, // p1-p3 (and d1-d3 below) are also mirrored at the item root on read and write "discounts": { "d1": 12.5, "d2": 10.5, "d3": 0 }, "external_supplier": true, "final_price": 12.04, // The selected supplier's prices, surfaced at the root immediately after // final_price. (final_price is the item's effective selling price — // supplier-derived when supplied, otherwise from the item's local price // (p1/p2/p3, per the active price-field settings).) Emitted when the item // has a "current" (selected) supplier item. "current_supplier_id": 1, "current_supplier_name": "Supplier 1", "current_supplier_code": "suplier1_code", // selected supplier's user code; omitted when unset "cost_price": 12, // selected supplier's cost price (NNC) "list_price": 15, // selected supplier's list price: its Distributor RRP when set, otherwise its PPC "wholesale_price": 13, // selected supplier's wholesale price (VPC); omitted when unset "distributor_rrp": 15, // selected supplier's Distributor RRP; omitted when unset "distributor_rrp_mode": "LINKED", // LINKED, FIXED or PRICE_LIST; omitted when unset "wholesale": 12, // the item's own cost price (NNC); item-level, unrelated to the // selected-supplier prices above — not the same as cost_price // Four abstract computed prices, each resolved from a single source // regardless of local vs supplier stock mode. The whole block is emitted // ONLY when the store has a computed-price configuration; each price (and // each of its sub-fields) is omitted when its source is unset. The prices: // - cost_price — what the store pays to source the item (procurement) // - consumer_price — supplier's recommended final-consumer price (MSRP) // - wholesale_price — the store's B2B wholesale-tier selling price // - retail_price — the store's B2B retail-tier selling price // Each price is configured with TWO sources — one for supplier stock, one // for local stock — and "price_mode" reports which applied for this item: // SUPPLIED (item sells supplier stock) reads each price's supplier source; // LOCAL reads its local source. So the same price can resolve from a // SUPPLIER_* column on one item and an ITEM_* column on another — read each // price's "source" (below) to see which concretely fed the value. // "resolved_at" is when the values were computed, "currency" is the base // currency. Possible "source" values: // - ITEM_P1 / ITEM_P2 / ITEM_P3 — the item's own price 1/2/3 (local stock) // - SUPPLIER_NNC — selected supplier cost price (Supplier_Item.NNC) // - SUPPLIER_PPC: selected supplier list price as the feed delivers it (Supplier_Item.PPC) // - SUPPLIER_MPC — selected supplier selling price (Supplier_Item.MPC) // - SUPPLIER_VPC — selected supplier wholesale price (Supplier_Item.VPC) // - SUPPLIER_DISTRIBUTOR_RRP: selected supplier Distributor RRP (the root "distributor_rrp") "computed_prices": { "price_mode": "SUPPLIED", "resolved_at": "2026-07-16T09:41:00Z", "currency": "EUR", "cost_price": { "net": 12.00, "gross": 14.64, "source": "SUPPLIER_NNC" }, // procurement cost (net + incl VAT) "consumer_price": { "net": 39.99, "gross": 48.79, "source": "SUPPLIER_PPC" }, // supplier's recommended consumer price "wholesale_price": { "net": 19.99, "gross": 24.39, "source": "SUPPLIER_VPC" }, // store's B2B wholesale-tier price "retail_price": { "net": 24.99, "gross": 30.49, "source": "SUPPLIER_MPC" } // store's B2B retail-tier price }, "carry_over": false, "erp_sync": true, "suppliers": [{ "supplier_name": "Supplier 1", "supplier_code": "suplier1_code", "supplier_id": 1, "supplier_items": [{ "nnc": 12, // cost price (legacy abbreviation kept) "ppc": 15, // list price (legacy abbreviation kept) "selling_price": 14, // MPC: price the retailer pays; omitted when not set "wholesale_price": 13, // VPC: wholesale price; omitted when not set "distributor_rrp": 15, // Distributor RRP; omitted when not set "distributor_rrp_mode": "LINKED", // LINKED, FIXED or PRICE_LIST; omitted when not set "price_increase": 0.5, // per-unit markup over cost: selling_price = nnc + price_increase; may be negative; omitted when not set "supplier_item_id": "1234", "stock": 0, "stock_available": 5, // omitted when not set "avail_in_days": 3, // omitted when not set "supplier_description": "...", // omitted when not set "id": 1915638, "item_id": 1234567, "item_external_id": null }] }, { "supplier_name": "Supplier 2", "supplier_code": "supplier2_code", "supplier_id": 2, "supplier_items": [{ "nnc": 12.7, "ppc": 16.2, "selling_price": 14.9, "wholesale_price": 13.4, "price_increase": 0.5, "supplier_item_id": "12345", "stock": 25, "id": 402250, "item_id": 1234567, "item_external_id": null }] }, { ... } ], // Aggregated description from all linked SupplierItems, joined with newlines. "suppliers_combined_description": { "__": "Manufacturer notes …" }, "shipping_dimensions": { "weight": 213, "width": 511, "height": 123, "depth": 150 }, "stock_amount": 123, "avail_in_days": 6, "unit_of_sale": { "__": "Pair", "de": "Paar" }, // sale_qty_minimum, sale_qty_maximum and sale_qty_step are sent together; // use null for any you don't want to set. "sale_qty_minimum": 2, "sale_qty_maximum": 10, "sale_qty_step": 2, "sale_over_stock": true, "tax_class_id": 56, "tax_rate": 22, // Whether the item's stored prices already include tax (boolean). // Only emitted when the request carries store context. "tax_inclusive": true, // "preorder_cancelled" is emitted by the API but cannot be set on write // (it is a system-managed state); all other values are also accepted on input. "buyable": "no" / "yes" / "as_part_only" / "supplied" / "draft" / "archived" / "preorder" / "preorder_cancelled", "default_buyable": "yes" / "as_part_only", "date_created": "2019-08-15T23:06:36Z", "date_updated": "2012-05-03T12:50:10.414Z", "warranty_months": 12, "variants_configuration": { "chooser_type": "names" / "specs", "chooser_specs": [{ "spec_id": 123, "label_basket": { "__": ... }, "label_chooser": { "__": ... } }, ... ], "sort_type": "BY_SPEC", "spec_sort_options": { "spec_id": 42, /* OR */ "spec_external_id": "abc" "ascending": false } }, "images": { "gallery": [1, 2, 3], // Same gallery as IDs above but with full image metadata for each // image. Emitted alongside "gallery" — consumers can pick either. "gallery_full": [ { "id": 1, "width": 1200, "height": 800, "mime_type": "image/jpeg", "description": { "__": "Front view" }, // optional, localized "title": { "__": "..." } // optional, localized }, ... ], "list": 5, "variant_chooser": 6 }, "customization": { "apply_after_discounts": true / false, "pricing_steps": [ ["key1", "key2"], ["key3"] ], "options": [{ "key": "someKey", "label": { "__": ... }, "label_basket": { "__": ... }, "required": true / false, "icon_image_id": 123, "type": "text", "view_mode": "big" / "small", "min_len": 10, "max_len": 100, "price_delta": { "absolute": 123.45, OR "percentage": 30.0, OR "price_from_item": { "mode": "ABSOLUTE" / "PER_UNIT", "linked_item_id": 456, "linked_item_quantity": 1.0, "linked_item_ignore_discount": false, "multiplier_spec_ids": [1, 2] // optional }, "override_tax_class_id": 3 // optional, combinable with any of the above } }, { "key": "someOtherKey", "label": { "__": ... }, "label_basket": { "__": ... }, "required": true / false, "icon_image_id": 123, "type": "choices", "view_mode": "listbox" / "radios" / "icons", "min_allowed": 1, "max_allowed": 15, "choices": [{ "key": "...", "label": { "__": ... }, "colors": [...], "icon_image_id": 100, "price_delta": { "absolute": 123.45, OR "percentage": 30.0, OR "price_from_item": { ... }, "override_tax_class_id": 3 // optional } }, { ... } ], "pricing_steps": [ ["key1", "key2"], ["key3"] ] } ] }, "sys_tags": ["a", "b", "c"], "seo_data": { "no_index": false, // true = ask search engines not to index this item "description": { "__": "..." }, "keywords": { "__": "..." }, "custom_meta_tags": [{ "name": "abc", "content": { "__": ... } }, { "property": "def", "content": { "__": ... } } ] }, "external_buy_settings": { "type": "link" / "form", "target_url": { "__": ... }, "label": { "__": ... }, "quantity_field_name": { "__": ... }, "buy_button_image_id": { "__": 123, ... }, "hidden_values": [{ "name": { "__": ... }, "value": { "__": ... } }, ... ] }, "extra_search_kws": { "__": "abc", ... }, "generic_data": { "images": { "key": { "__": 5 }, "key2": { "__": 6 } }, "strings": { "key": { "__": "foo" } } }, "specs": { // Default ("compact") shape — ids only. To delete a spec value on // write, set the entry to null (e.g. "spec5": null). // To get an enriched response shape, pass ?label_specs (or // ?label_specs=true) on GET — see the alternate "values" block // below. "values": { "spec1": { "choice_id": 12 }, "spec2": { "number": 123.456 }, "spec3": { "string": { "__": "abc" } }, "spec4": { "boolean": true }, "spec5": null // delete (write only) }, // Alternate shape when reading with ?label_specs=true. // Each value entry embeds the spec metadata under "spec" and the // selected choice(s) under "choice" (replacing "choice_id"). // numeric/text/boolean entries keep their value field unchanged // and just gain the "spec" sub-object. The "layout" array is // unchanged. Write paths still use the compact shape above. /* "values": { "spec1": { "spec": { "id": 1, "external_id": "color", "type": "choice", "name": { "__": "Color" }, "hidden": false }, "choice": { "id": 12, "value": { "__": "Blue" }, "external_id": "blue" } }, "spec1b": { "spec": { "id": 7, "type": "multi_choice", ... }, "choice": [ { "id": 51, "value": { "__": "Cotton" } }, { "id": 52, "value": { "__": "Polyester" } } ] }, "spec2": { "spec": { "id": 2, "type": "numeric", "name": { "__": "Weight" }, "unit": "kg", ... }, "number": 123.456 }, "spec3": { "spec": { "id": 3, "type": "text", ... }, "string": { "__": "abc" } }, "spec4": { "spec": { "id": 4, "type": "boolean", ... }, "boolean": true } }, */ "layout": [{ "spec_id": 1 }, { "spec_id": 2 }, { "group_name": { "__": ... }, "parts": [{ "spec_id": 3 }, { "spec_id": 4 }, // recursive ... ] }, { "spec_id": 5 } ] }, "related_items": [ 1497, 1523, 1678 ], // For container items (type: "variants"): the variants this item contains. variant_members: [ { id: 2785, bar_code: '5420007148720', sku: '4384', external_id: '15623', order_weight: 4 }, { id: 1839, bar_code: '5420007142551', sku: '3091', external_id: '14464', order_weight: 2 }, { ... } ], // For variant items (type: "physical" that belongs to a container): // the container item(s) this variant belongs to. Mutually exclusive // with variant_members in practice — a given response has one or the other. "variant_containers": [ { "id": 1199, "bar_code": "5420007140000", "sku": "PARENT-1", "external_id": "1199", "order_weight": 0 }, ... ], "warehouses": [ { "warehouse_id": 1, "warehouse_stock": 100 }, { ... } ] } ``` ## Bulk update **Base path:** `[URL_BASE]/items/bulk` Update many items in a single request. Each element of `data` is merged into the matching item exactly as a single-item `POST` would be. | Method | Endpoint | Description | |---|---|---| | `POST` | `[URL_BASE]/items/bulk` | Body is `{ "data": [ …items… ] }`. The response reports per-item success individually. | *item-bulk.json* ```json { "data": [ { Item Entity Object 1 }, { Item Entity Object 2 }, { Item Entity Object 3 }, ... ] } ``` ## Examples In a separate file to keep this one readable: [items-examples.md](https://misc.shopamine.com/restapi/md/items-examples.md) --- Source: [https://misc.shopamine.com/restapi/#items](https://misc.shopamine.com/restapi/#items) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — Nodes The catalogue hierarchy - categories, brands and content pages. **nodes** - **Path:** `[URL_BASE]/nodes/` - **Scope:** `nodes` — a request without it returns `403 You need scope "nodes"` - **Operations:** `list`, `get`, `create`, `update`, `delete` **Standard operations — nodes** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/nodes/list` | List, paginated | | `GET` | `[URL_BASE]/nodes/[id]` | Retrieve one | | `POST` | `[URL_BASE]/nodes/create` | Create | | `POST` | `[URL_BASE]/nodes/[id]` | Update (merge: absent fields untouched, explicit null clears) | | `DELETE` | `[URL_BASE]/nodes/[id]` | Delete | **Base path:** `[URL_BASE]/nodes/…` Nodes are the hierarchy your catalogue hangs off — categories, brands and content pages. Every shop has exactly one `"home"` node: nodes can switch between types, but never to or from `home`, and home cannot be deleted. ### List parameters - **Page size** — default **10**, maximum **40** — e.g. `?limit=20&offset=30` - **Sort fields** — `id`, `external_id`, `parent_node_id`, `url_key`, `date_created`, `date_updated`, `date_published`. Example: `?order=-date_published` - **label_specs** — Same semantics as for [items](https://misc.shopamine.com/restapi/#items_list_params) — enriches `specs.values` with embedded `spec` metadata and `choice` objects. ### Fields **Node object** | Field | Required | Description | |---|---|---| | id | Required | Shopamine's ID number for this node. | | external_id | Optional | External ID for this node. | | type | Required | The type of this node. Nodes can switch types, but not to or from `"home"`. There is always exactly one home page, and it cannot be deleted. | | url_key | Optional | What goes into the URL for this node. Allowed characters are `a-z`, `A-Z`, `0-9`, `-` and `_`. | | parent_node_id | Required | ID of the parent node. All nodes except the home page must have this set. Cycles are forbidden. | | show_in_parent | Required | Whether the node is considered to belong to its parent. If not, it starts a new separate sub-tree and the parent(s) only contribute URL parts. | | order_weight | Optional | By default nodes are displayed sorted by name. Use this when another order is wanted. Nodes with the same weight are still sorted by name; nodes without a weight come last. | | name | Required | The name of the node. | | node_title | Optional | Localized page title — overrides `name` for SEO and browser-title rendering when present. | | data_id | Optional | Reference to an external dataset / record id. Integration-specific. | | sys_tags | Optional | Like with items, these tell skins that the node is somehow special. They do nothing by default. | | visibility | Optional | Whether the node is visible. When `hidden`, visitors can still reach it via a direct URL or a link. When `404`, it is as if the node does not exist. | | date_created | Required | When the node was first created. Set automatically. | | date_updated | Required | When the node was last edited. Set automatically. | | date_published | Optional | When the node was published. Set automatically. | | image_id | Optional | ID of the image that represents this node. | | images | Optional | Array of additional image IDs associated with this node (gallery). The primary image is exposed separately as `image_id`. | | generic_data | Optional | Like with items, stores generic attributes, occasionally used with custom skins. | | specs | Optional | A spec layout that can be used as the template for items in this node. | | seo_data | Optional | SEO-related data — currently `` tags. The two most commonly used are represented directly; any number of extra tags can go inside `custom_meta_tags`. | | filters | Optional | Which filters are available when looking at items in this node. Each filter is either predefined (`price`, `brand`, `category`, `in_stock_only`, `finder_like`) or based on a spec — in which case its ID must be set. | | sort_orders | Optional | Which sort orders are offered to visitors looking at items in this node. Similar to filters, except the allowed directions must also be specified. | ### Sample object *node.json* ```json { "id": 123, "external_id": "...", // Optional reference to an external dataset / record id; integration-specific. "data_id": 4567, "type": "home" / "brand" / "category" / "page" / "container" / "form" / "finder" / "notification", "url_key": "abc", "parent_node_id": 55, "show_in_parent": true / false, "order_weight": 4, "name": { "__": "..." }, // Optional localized page title — overrides "name" for SEO / browser // title rendering when present. "node_title": { "__": "..." }, "sys_tags": [ "a", "b", "c" ], "visibility": "public" / "hidden" / "404", "date_created": "2012-05-03T12:50:10.414Z", "date_updated": "2012-05-03T12:50:10.414Z", "date_published": "2012-05-03T12:50:10.414Z", // image_id is the primary image. "images" is an additional gallery of // image IDs (not necessarily including image_id). "image_id": 123, "images": [ 12, 34, 56 ], "generic_data": { "images": { "key": { "__": 5 }, "key2": { "__": 6 } }, "strings": { "key": { "__": "foo" } } }, "specs": { // Default ("compact") shape — ids only. Pass ?label_specs (or // ?label_specs=true) on GET to receive the enriched shape, where // each entry under "values" embeds the spec metadata under "spec" // and the selected choice(s) under "choice" (replacing // "choice_id"). See item.json for the alternate "values" // example — node values follow the same shape. The "layout" // array is unchanged. "values": { "spec1": { "choice_id": 12 }, "spec2": { "number": 123.456 }, "spec3": { "string": { "__": "abc" } }, "spec4": { "boolean": true }, "spec5": null // delete (write only) }, "layout": [ { "spec_id": 1 }, { "spec_id": 2 }, { "group_name": { "__": ... }, "parts": [ { "spec_id": 3 }, { "spec_id": 4 }, // recursive ... ] }, { "spec_id": 5 } ] }, "seo_data": { "description": { "__": "..." }, "keywords": { "__": "..." }, "custom_meta_tags": [ { "name": "abc", "content": { "__": ... } }, { "property": "def", "content": { "__": ... } } ] }, "filters": [ { "type": "price" / "brand" / "category" / "in_stock_only" / "finder_like" }, { "type": "spec", "spec_id": 123 } ], "sort_orders": [ { "type": "name" / "price" / "stock_amount" / "date" / "probability" / "rating", "directions": "asc" / "desc" / "both" }, { "type": "spec" / "spec_per_price" / "price_per_spec", "directions": "asc" / "desc" / "both", "spec_id": 123 } ] } ``` ## Examples ### List nodes `GET /nodes/list` The response is an object with a single `data` array. **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/nodes/list?limit=20&offset=0' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/nodes/list?limit=20&offset=0", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response (1 of 20 entries shown, truncated)** ```json { "data": [ { "id": 1, "type": "home", "url_key": "", "show_in_parent": true, "visibility": "public", "name": { "__": "Home page" }, "date_created": "2012-03-30T07:57:38Z", "date_updated": "2023-05-25T07:02:46Z", "date_published": "2012-03-30T07:57:38Z", "images": [], "seo_data": { "keywords": { "__": "" }, "description": { "__": "" }, "no_index": false }, "sort_orders": [ ... truncated ``` ### Retrieve one `GET /nodes/1` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/nodes/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/nodes/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response (truncated)** ```json { "id": 1, "type": "home", "url_key": "", "show_in_parent": true, "visibility": "public", "name": { "__": "Home page" }, "date_created": "2012-03-30T07:57:38Z", "date_updated": "2023-05-25T07:02:46Z", "date_published": "2012-03-30T07:57:38Z", "images": [], "seo_data": { "keywords": { "__": "" }, "description": { "__": "" }, "no_index": false }, "sort_orders": [ { "type": "name", ... truncated ``` ### Create `POST /nodes/create` **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/nodes/create' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "external_id": "CAT-01", "name": { "__": "Example Category" }, "type": "page", "parent_node_id": 1 }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/nodes/create", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "external_id": "CAT-01", "name": { "__": "Example Category" }, "type": "page", "parent_node_id": 1 }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 164, "external_id": "docs-example-nodes-tmp", "type": "page", "url_key": "example-category", "show_in_parent": true, "visibility": "public", "parent_node_id": 1, "name": { "__": "Example Category" }, "date_created": "2026-08-16T12:09:23Z", "date_updated": "2026-08-16T12:09:23Z" } ``` ### Update `POST /nodes/1` Updates merge: fields absent from the request are left untouched. Send an explicit `null` to clear a field. **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/nodes/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "name": { "__": "Example Category (renamed)" } }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/nodes/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "name": { "__": "Example Category (renamed)" } }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 164, "external_id": "docs-example-nodes-tmp", "type": "page", "url_key": "example-category", "show_in_parent": true, "visibility": "public", "parent_node_id": 1, "name": { "__": "Example Category (renamed)" }, "date_created": "2026-08-16T12:09:23Z", "date_updated": "2026-08-16T12:09:24Z" } ``` ### Delete `DELETE /nodes/1` Clients that cannot send DELETE may use `POST /nodes/{id}?method=delete`. **curl** ```bash curl -X DELETE \ 'https://api.shopamine.com/www.example.com/api/v1/nodes/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.delete( "https://api.shopamine.com/www.example.com/api/v1/nodes/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "status": "ok" } ``` --- Source: [https://misc.shopamine.com/restapi/#nodes](https://misc.shopamine.com/restapi/#nodes) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — Specs Product specifications and their choice values. **specs** - **Path:** `[URL_BASE]/specs/` - **Scope:** `specs` — a request without it returns `403 You need scope "specs"` - **Operations:** `list`, `get`, `create`, `update`, `delete` **choices** - **Path:** `[URL_BASE]/specs/[spec_id]/choices/` - **Scope:** `specs` — a request without it returns `403 You need scope "specs"` - **Operations:** `sub_list`, `sub_get` **Standard operations — specs** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/specs/list` | List, paginated | | `GET` | `[URL_BASE]/specs/[id]` | Retrieve one | | `POST` | `[URL_BASE]/specs/create` | Create | | `POST` | `[URL_BASE]/specs/[id]` | Update (merge: absent fields untouched, explicit null clears) | | `DELETE` | `[URL_BASE]/specs/[id]` | Delete | **Standard operations — choices** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/specs/[spec_id]/choices/list` | List, paginated | | `GET` | `[URL_BASE]/specs/[spec_id]/choices/[id]` | Retrieve one | **Base path:** `[URL_BASE]/specs/…` Specs are the attributes attached to items — numeric, text, boolean, or choice-based. `numeric` and `discrete_numeric` are interchangeable; the only difference is how they are displayed in filters. ### List parameters - **Page size** — default **100**, maximum **500** - **Sort fields** — `id`, `external_id`, `name`. Example: `?order=-name` ### Fields **Spec object** | Field | Required | Description | |---|---|---| | id | Required | Shopamine's ID number for this spec. | | external_id | Optional | External ID for this spec. | | type | Required | The type of this spec. `numeric` and `discrete_numeric` are interchangeable — the only difference is how they display in filters. For `choice` specs, see [Choices](https://misc.shopamine.com/restapi/#choices). | | name | Required | The localized name of this spec. | | description | Optional | Useful for administrators when several unrelated specs share a name — "Capacity" might refer to a hard drive or to a barrel. | | unit | Optional | The unit of measurement, used for numeric specs. | | hidden | Optional | Boolean — when true, the spec is suppressed from default filter UIs and category sidebars. Storefront templates may still render it on the item page. | | choices | Optional | For `choice` / `multi_choice` specs only: the full list of defined choices, sorted by `order_weight` then id. Each entry follows the choice shape. Not emitted for other spec types. | ### Sample object *spec.json* ```json { "id": 213, "external_id": "user_code", "type": "numeric" / "discrete_numeric" / "boolean" / "choice" / "text" / "multi_boolean" / "multi_choice" / "multi_numeric" / "multi_text" / "timestamp" / "minute_of_day", "name": { "__": "Name", "sl": "Ime" }, "description": "...", "unit": "...", // Only present for "choice" / "multi_choice" specs: the full list of // defined choices, ordered by order_weight then by id. Each entry // matches the choice.json shape. "choices": [ { "id": 1, "external_id": "blue", "value": { "__": "Blue" }, "order_weight": 10 }, { "id": 2, "external_id": "red", "value": { "__": "Red" }, "order_weight": 20 } ], // Admin-hidden flag — when true, the spec is suppressed from default // filter UIs and category sidebars. "hidden": false } ``` Specs ## Choices Specs of type `choice` and `multi_choice` each have a corresponding list of the actual choices. | Method | Endpoint | Description | |---|---|---| | `GET` | `[URL_BASE]/specs/{spec_id}/choices/list` | Retrieves the list of choices. See also [list parameters](https://misc.shopamine.com/restapi/#list_params). | | `POST` | `[URL_BASE]/specs/{spec_id}/choices/create` | Creates a new choice. | | `GET, POST, DELETE` | `[URL_BASE]/specs/{spec_id}/choices/{choice_id}` | Retrieve, update or delete one choice. | | `GET, POST, DELETE` | `[URL_BASE]/specs/{spec_id}/choices/by_external_id/{external_id}` | Address one choice unambiguously by its `external_id`. | | `GET, POST, DELETE` | `[URL_BASE]/specs/{spec_id}/choices/by_id/{id}` | Address one choice unambiguously by its Shopamine `id`. | In the bare `…/choices/{choice_id}` form the trailing segment resolves as a Shopamine `id` when it is a positive integer, and otherwise as an `external_id`. A **numeric-only `external_id`** (e.g. `10408`) therefore cannot be reached with the bare form — it would be looked up as an `id` and not found. Use the explicit `by_external_id/` or `by_id/` prefixes instead. - **Page size** — default **100**, maximum **500** - **Sort fields** — `id` **Choice object** | Field | Required | Description | |---|---|---| | id | Required | Shopamine's ID number for this choice. | | external_id | Optional | External ID for this choice. | | value | Required | The localized textual value visitors will see. | | order_weight | Optional | Use this when a specific order is required. A choice created without `order_weight` is placed automatically next to its closest neighbour in the spec's order (letter sizes, numbers or text), and the spec's weights are renumbered. Sending `order_weight` places the choice exactly where you say. | *choice.json* ```json { "id": 123, "external_id": "user_code", "value": { "__": "Default value", ... }, "order_weight": 5 } ``` ## Examples ### List specs `GET /specs/list` The response is an object with a single `data` array. **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/specs/list?limit=20&offset=0' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/specs/list?limit=20&offset=0", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response (1 of 14 entries shown, truncated)** ```json { "data": [ { "id": 1, "type": "choice", "name": { "__": "Size" }, "choices": [ { "id": 1, "value": { "__": "S" }, "order_weight": 0 }, { "id": 2, "value": { "__": "M" }, "order_weight": 1 }, { "id": 3, ... truncated ``` ### Retrieve one `GET /specs/1` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/specs/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/specs/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response (truncated)** ```json { "id": 1, "type": "choice", "name": { "__": "Size" }, "choices": [ { "id": 1, "value": { "__": "S" }, "order_weight": 0 }, { "id": 2, "value": { "__": "M" }, "order_weight": 1 }, { "id": 3, "value": { "__": "L" ... truncated ``` ### Create `POST /specs/create` **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/specs/create' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "external_id": "SPEC-01", "name": { "__": "Example Spec" }, "type": "text" }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/specs/create", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "external_id": "SPEC-01", "name": { "__": "Example Spec" }, "type": "text" }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 19, "external_id": "docs-example-specs-tmp", "type": "text", "name": { "__": "Example Spec" }, "hidden": false } ``` ### Update `POST /specs/1` Updates merge: fields absent from the request are left untouched. Send an explicit `null` to clear a field. **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/specs/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "name": { "__": "Example Spec (renamed)" } }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/specs/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "name": { "__": "Example Spec (renamed)" } }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 19, "external_id": "docs-example-specs-tmp", "type": "text", "name": { "__": "Example Spec (renamed)" }, "hidden": false } ``` ### Delete `DELETE /specs/1` Clients that cannot send DELETE may use `POST /specs/{id}?method=delete`. **curl** ```bash curl -X DELETE \ 'https://api.shopamine.com/www.example.com/api/v1/specs/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.delete( "https://api.shopamine.com/www.example.com/api/v1/specs/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "status": "ok" } ``` ### List choices `GET /specs/1/choices/list` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/specs/1/choices/list?limit=20&offset=0' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/specs/1/choices/list?limit=20&offset=0", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response (1 of 3 entries shown)** ```json { "data": [ { "id": 1, "value": { "__": "S" }, "order_weight": 0 } ] } ``` ### Retrieve one `GET /specs/1/choices/1` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/specs/1/choices/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/specs/1/choices/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 1, "value": { "__": "S" }, "order_weight": 0 } ``` --- Source: [https://misc.shopamine.com/restapi/#specs](https://misc.shopamine.com/restapi/#specs) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — Users Customer accounts, GDPR permissions, addresses (append-only) and per-user contract prices. **users** - **Path:** `[URL_BASE]/users/` - **Scope:** `users` — a request without it returns `403 You need scope "users"` - **Operations:** `list`, `get`, `create`, `update`, `delete` **addresses** - **Path:** `[URL_BASE]/users/[user_id]/addresses/` - **Scope:** `users` — a request without it returns `403 You need scope "users"` - **Operations:** `sub_list`, `sub_get`, `sub_create` **contract prices** - **Path:** `[URL_BASE]/users/[user_id]/contract_prices/` - **Scope:** `users` — a request without it returns `403 You need scope "users"` - **Operations:** `sub_list` **Standard operations — users** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/users/list` | List, paginated | | `GET` | `[URL_BASE]/users/[id]` | Retrieve one | | `POST` | `[URL_BASE]/users/create` | Create | | `POST` | `[URL_BASE]/users/[id]` | Update (merge: absent fields untouched, explicit null clears) | | `DELETE` | `[URL_BASE]/users/[id]` | Delete | **Standard operations — addresses** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/users/[user_id]/addresses/list` | List, paginated | | `GET` | `[URL_BASE]/users/[user_id]/addresses/[id]` | Retrieve one | | `POST` | `[URL_BASE]/users/[user_id]/addresses/create` | Create | **Standard operations — contract prices** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/users/[user_id]/contract_prices/list` | List, paginated | **Base path:** `[URL_BASE]/users/…` Customer accounts, their addresses, GDPR consents and contract pricing. ### Endpoints | Method | Endpoint | Description | |---|---|---| | `GET, POST, DELETE` | `[URL_BASE]/users/by_email/{value}` | Find, update or delete a customer by email. | | `GET, POST, DELETE` | `[URL_BASE]/users/by_external_id/{value}` | Find, update or delete a customer by user code. | | `POST` | `[URL_BASE]/users/addresses/validate` | Validates an address payload without creating anything. `name`, `street_addr_1`, `postal_code`, `city` and `country_code` are required; `tax_code`, `phone` and `state_code` are checked when present. Returns the payload back on success, or a `4xx` naming the invalid field. | ### List parameters - **Page size** — default **25**, maximum **100** - **Sort fields** — `id`, `email`, `name`, `date_created`, `external_id`, `domain`, `locale`, `date_updated` - **exploded** — Adding `?exploded` embeds an `addresses` array in each user object. ### Fields **User object** | Field | Required | Description | |---|---|---| | id | Required | Shopamine's ID number for this user. | | external_id | Optional | The external ID of this user. | | email | Required | The e-mail address of this user. | | name | Optional | The name of this user. | | nickname | Optional | The nickname of this user. | | locked | Optional | Lock or unlock this user. | | date_created | Required | When the user was created. Set automatically. | | date_updated | Required | When the user was updated. Set automatically. | | user_type_id | Optional | The ID of the [user type](https://misc.shopamine.com/restapi/#user_types) of this user. | | gdpr_permissions | Optional | Array of GDPR permissions associated with the user, including whether each is required and whether the user agreed. See [GDPR permissions](https://misc.shopamine.com/restapi/#users_gdpr). | ### Sample object *user.json* ```json { "id": 123, "external_id": "abc123", "email": "john.smith@gmail.com", "name": "John Smith", "nickname": "johnny21", "date_created": "2012-10-16T17:41:00Z", "date_updated": "2020-10-16T17:41:00Z", "user_type_id": 2, "locked": true/false, "gdpr_permissions": [ { "id": 1, "required": true, "external_id": "1", "name": "Privacy Policy", "text": "I hereby confirm that I have read and agree with this web site’s Privacy Policy", "agreed": true }, ... ] } ``` Users ## GDPR permissions New permissions can only be created in the Shopamine admin dashboard, and not all fields are updatable through the API. Adding a permission to a user is possible only if an existing `id` or `external_id` is sent. Only `agreed` is written from the submitted entry; `external_id` and `mailchimp_id` are used solely to look up the matching permission and are always stored back as the store's own definition, never as the values sent. Permissions absent from a submitted array are **preserved unchanged** — omitting a permission does not delete it. The serialized array also contains mailing-list opt-in entries, recognizable by their `mail_opt_in_id` key instead of `id`. On `GET`, the array lists every permission the store currently has enabled, with `agreed` defaulting to `false` for one the user has not answered; a permission the store has disabled is left out entirely. | Field | Required | Description | |---|---|---| | id | Required | User permission Shopamine ID number. | | required | Required | When true, the user must agree to it to finalize an order. | | external_id | Optional | User permission external ID. | | name | Not updatable | The permission label displayed to the user. | | text | Not updatable | Info text displayed to the user. | | mailchimp_id | Not updatable | Mailchimp ID for this permission, when the store is connected to a Mailchimp account. Always taken from the store's permission definition; a value sent by the caller is ignored. | | agreed | Optional | Whether the user agreed to the permission. | Users ## Addresses Each user can have a number of addresses associated with them, used in checkout. Addresses, once created, **cannot be changed or deleted**. | Method | Endpoint | Description | |---|---|---| | `GET` | `[URL_BASE]/users/{user_id}/addresses/list` | Retrieves the list of addresses. See also [list parameters](https://misc.shopamine.com/restapi/#list_params). | | `POST` | `[URL_BASE]/users/{user_id}/addresses/create` | Creates a new address. | | `GET` | `[URL_BASE]/users/{user_id}/addresses/{address_id}` | Retrieves data for one address. | - **Page size** — default **25**, maximum **100** - **Sort fields** — `id` **Address object** | Field | Required | Description | |---|---|---| | id | Read-only | Shopamine's ID number for this address. | | name | Required | The name of the person. | | company | Optional | The company name. | | type | Read-only | The address type, e.g. `USER_ADDRESS`. | | external_id | Read-only | External reference id, present when set. | | street_addr_1 | Required | First line of street address. | | street_addr_2 | Optional | Second line of street address. | | postal_code | Required | The postal code of this address. | | city | Required | The city of this address. | | state_code | Optional | The code of the state, in countries which have states. | | country_code | Required | The 2-letter country code. | | tax_code | Optional | The tax code (e.g. VAT number in the EU). | | phone | Optional | The phone number to call when issues arise. | | deleted | Optional | Whether the user has removed this address from their list. | *address.json* ```json { "id": 123, "type": "USER_ADDRESS", "external_id": "...", // present when set "name": "Janez Novak", "company": "Firma d.o.o.", "street_addr_1": "Ulica bratov Novak 12", "street_addr_2": "4. nadstropje", "postal_code": "1215", "city": "Medvode", "state_code": "CA", "country_code": "SI", "tax_code": "SI21341515", "phone": "+386 41 123 456", "deleted": true / false } ``` Users ## Contract prices **Not enabled by default.** Contact [support@shopamine.com](mailto:support@shopamine.com) to switch the Contract Prices API on for your store. Each user can have a number of contract prices. Each object pairs an item with its price before discounts and taxes, plus the discount used to arrive at that price. The **price must be pre-calculated; the discount value is for display only**. | Method | Endpoint | Description | |---|---|---| | `GET` | `[URL_BASE]/users/{user_id}/contract_prices/list` | Retrieves the list of contract prices. | | `POST` | `[URL_BASE]/users/{user_id}/contract_prices/create` | Creates a new contract price. Adding `?ignoreUnknownItems` skips rows referencing unknown items instead of failing the whole call. | | `POST` | `[URL_BASE]/users/{user_id}/contract_prices/delete` | Deletes an existing contract price. | | `POST` | `[URL_BASE]/users/{user_id}/contract_prices/deleteAll` | Deletes all contract prices for the selected user. | | `GET, POST, DELETE` | `[URL_BASE]/users/{user_id}/contract_prices/` | The bare path works directly: GET lists, POST creates/updates, DELETE (or `POST ?method=delete`) deletes. | A create or update responds with the user's **entire** contract-price list, not only the submitted rows. You must always send a `data` object containing an array of values — even when sending a single contract price. - **Page size** — default **100**, maximum **500** **Contract price object** | Field | Required | Description | |---|---|---| | item_id | One of ¹ | Shopamine's ID number for this item. | | item_sku | One of ¹ | The SKU code for this item. | | item_bar_code | One of ¹ | The bar code for this item. | | item_external_id | One of ¹ | The external ID of this item. | | price_base | Optional | Contract final price for the item/user combination. | | discount_rate | Optional | Discount rate (%) associated with this item/user combination. | | sync_name | Optional | Your integration name, or additional info for this price. | ¹ At least one item code must be included, otherwise the API call will fail. *contract_prices.json* ```json { "data": [ { "item_id": 123454567, "item_bar_code": "1234ABCD", "item_sku": "1234ABCD", "item_external_id": "1234ABCD", "price_base": 1234.54, "discount_rate": 12.34, "sync_name": "My Api Integration" }, } } ``` ## Examples ### List users `GET /users/list` The response is an object with a single `data` array. **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/users/list?limit=20&offset=0' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/users/list?limit=20&offset=0", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response (1 of 20 entries shown)** ```json { "data": [ { "id": 1, "email": "jane.doe@example.com", "date_created": "2023-12-18T08:51:17Z", "date_updated": "2026-06-18T05:14:29Z", "external_id": "1", "locked": false, "gdpr_permissions": [ { "id": 1, "required": true, "external_id": "1", "name": "Privacy Policy", "text": "By placing this order you agree to all terms of service and payment (order with obligation to pay).", "agreed": true } ] } ] } ``` ### Retrieve one `GET /users/27` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/users/27' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/users/27", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 27, "email": "jane.doe@example.com", "date_created": "2026-08-15T19:22:06Z", "date_updated": "2026-08-15T19:22:06Z", "external_id": "docs-example-user", "locked": false, "gdpr_permissions": [] } ``` ### Create `POST /users/create` **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/users/create' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "external_id": "USER-01", "email": "jane.doe@example.com" }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/users/create", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "external_id": "USER-01", "email": "jane.doe@example.com" }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 33, "email": "docs-example-users-tmp@example.com", "date_created": "2026-08-16T12:09:30Z", "date_updated": "2026-08-16T12:09:30Z", "external_id": "docs-example-users-tmp", "locked": false, "gdpr_permissions": [] } ``` ### Update `POST /users/27` Updates merge: fields absent from the request are left untouched. Send an explicit `null` to clear a field. **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/users/27' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "locked": false }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/users/27", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "locked": false }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 33, "email": "docs-example-users-tmp@example.com", "date_created": "2026-08-16T12:09:30Z", "date_updated": "2026-08-16T12:09:30Z", "external_id": "docs-example-users-tmp", "locked": false, "gdpr_permissions": [] } ``` ### Delete `DELETE /users/27` Clients that cannot send DELETE may use `POST /users/{id}?method=delete`. **curl** ```bash curl -X DELETE \ 'https://api.shopamine.com/www.example.com/api/v1/users/27' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.delete( "https://api.shopamine.com/www.example.com/api/v1/users/27", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "status": "ok" } ``` ### Find by e-mail `GET /users/by_email/jane.doe@example.com` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/users/by_email/jane.doe@example.com' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/users/by_email/jane.doe@example.com", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 27, "email": "jane.doe@example.com", "date_created": "2026-08-15T19:22:06Z", "date_updated": "2026-08-15T19:22:06Z", "external_id": "docs-example-user", "locked": false, "gdpr_permissions": [] } ``` ### Find by external id `GET /users/by_external_id/USER-01` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/users/by_external_id/USER-01' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/users/by_external_id/USER-01", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 27, "email": "jane.doe@example.com", "date_created": "2026-08-15T19:22:06Z", "date_updated": "2026-08-15T19:22:06Z", "external_id": "docs-example-user", "locked": false, "gdpr_permissions": [] } ``` ### Validate an address `POST /users/addresses/validate` **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/users/addresses/validate' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "name": "Jane Doe", "street_addr_1": "Example Street 1", "city": "Ljubljana", "postal_code": "1000", "country_code": "SI" }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/users/addresses/validate", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "name": "Jane Doe", "street_addr_1": "Example Street 1", "city": "Ljubljana", "postal_code": "1000", "country_code": "SI" }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "name": "Jane Doe", "street_addr_1": "Example Street 1", "city": "Ljubljana", "postal_code": "1000", "country_code": "SI" } ``` ### List addresses `GET /users/27/addresses/list` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/users/27/addresses/list?limit=20&offset=0' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/users/27/addresses/list?limit=20&offset=0", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response (1 of 3 entries shown)** ```json { "data": [ { "id": 265, "name": "Jane Doe", "type": "USER_ADDRESS", "street_addr_1": "Example Street 1", "postal_code": "1000", "city": "Ljubljana", "country_code": "si", "deleted": false } ] } ``` ### Retrieve one `GET /users/27/addresses/263` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/users/27/addresses/263' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/users/27/addresses/263", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 263, "name": "Jane Doe", "type": "USER_ADDRESS", "street_addr_1": "Example Street 1", "postal_code": "1000", "city": "Ljubljana", "country_code": "si", "deleted": false } ``` ### Create `POST /users/27/addresses/create` **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/users/27/addresses/create' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "name": "Jane Doe", "first_name": "Jane", "last_name": "Doe", "street_addr_1": "Example Street 1", "city": "Ljubljana", "postal_code": "1000", "country_code": "SI" }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/users/27/addresses/create", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "name": "Jane Doe", "first_name": "Jane", "last_name": "Doe", "street_addr_1": "Example Street 1", "city": "Ljubljana", "postal_code": "1000", "country_code": "SI" }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 265, "name": "Jane Doe", "type": "USER_ADDRESS", "street_addr_1": "Example Street 1", "postal_code": "1000", "city": "Ljubljana", "country_code": "si", "deleted": false } ``` ### List contract_prices `GET /users/27/contract_prices/list` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/users/27/contract_prices/list?limit=20&offset=0' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/users/27/contract_prices/list?limit=20&offset=0", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "data": [] } ``` --- Source: [https://misc.shopamine.com/restapi/#users](https://misc.shopamine.com/restapi/#users) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — External Prices Service A service the MERCHANT implements and Shopamine calls for live pricing - a receiver, not a Shopamine endpoint. **external prices** - **Path:** `[URL_BASE]/external-prices/` - **Scope:** `settings` — a request without it returns `403 You need scope "settings"` Users ## External prices service When internal capabilities are not enough — typically B2B stores with customer-specific rules and contracts — Shopamine can obtain prices from an external web service in real time. You implement an HTTP-accessible service which receives queries from Shopamine and responds with price data. The query contains the user's email address and a number of item IDs with quantities of interest (usually 1, but larger in basket and checkout). The incoming item ID can be `external_id`, `sku` or Shopamine's internal item `id`, configurable in Shopamine. Quantities are always integers. There are two ways the query can be encoded: as URL parameters, or as a JSON document. The latter is slightly more robust but a bit harder to implement. Which one is used is configurable. **See the requests for your own setup.** The [API playground](https://misc.shopamine.com/restapi/playground.html#pg-prices) shows exactly what Shopamine sends for your store's settings, customer and items, in your browser and without an API key. ### URL query format If the query is in the URL, you have four choices. To Shopamine they are all equivalent — pick whichever is easiest to implement on your side. #### 1 · Entire query in one parameter You configure the separator between items and between an item's ID and quantity. With `,` and `:` respectively: *URL* ``` http://.../getUserPrices?user=john@example.com&items=SKU0001:1,SKU0015:1,SKU0451:12 ``` #### 2 · One parameter per item The parameter name is always the same or can include a counter, with a separator between the item's ID and quantity: *URL* ``` http://.../getUserPrices?email=john@example.com&item1=SKU0001:1&item2=SKU0015:1&item3=SKU0451:12 ``` For something PHP-like, brackets instead of a counter are usually easier: *URL* ``` http://.../getUserPrices.php?who=john@example.com&item[]=SKU0001:1&item[]=SKU0015:1&item[]=SKU0451:12 ``` #### 3 · Two parameters per item One holds the item's ID, the other its quantity. Counters optional: *URL* ``` http://.../prices?user=john@example.com&item1=SKU0001&qty1=1&item2=SKU0015&qty2=1&item3=SKU0451&qty3=12 ``` #### 4 · Item ID as the parameter name *URL* ``` http://.../getPrices?_email=john@example.com&SKU0001=1&SKU0015=1&SKU0451=12 ``` If you use either separator-based mode, choose a separator that cannot appear in your item IDs. ### JSON query format Shopamine POSTs to a URL of your choice with contents like this: *JSON — request* ```json { "v": 1, "user_email": "john@example.com", "query": { "SKU0001": 1, "SKU0015": 1, "SKU0451": 12 } } ``` The `v` field is the version, currently always `1`. If a richer query format is introduced later it will carry a different version, and version 1 is planned to be supported indefinitely. ### Response format The response is a table of data, one line per item. For encoding efficiency it is a JSON array of arrays, with metadata in the envelope describing what the table contains: *JSON — response v1* ```json { "v": 1, "currency": "EUR", "columns": [ "id", "base_price", "final_price" ], "data": [ [ "SKU0001", 180.0, 155.0 ], [ "SKU0015", 12.0, 12.0 ], [ "SKU0451", 75.0, 44.5 ] ] } ``` **Supported columns** | Column | Description | |---|---| | id | The item ID. Must be present and must match one of the IDs from the query. | | base_price | The item's price before discounts and taxes. | | discount_rate | The discount rate given to the user for this item. A number between 0 and 1 inclusive — **not** a percentage, so a 25% discount is `0.25`. | | final_price | The final item price the user must pay, before taxes. | The response must include `id` and at least one of `base_price` or `final_price`. If `discount_rate` is included it is taken into account; if not, it is computed from `base_price` and `final_price` when both are present, and assumed to be 0 otherwise. Recommended combinations, in order of preference: - `id, base_price, final_price` - `id, base_price, discount_rate` - `id, discount_rate, final_price` - `id, final_price` Prices returned should always be **for one item**, regardless of the quantity in the query. Whether they **include tax** depends on the store's configuration: an item's own tax setting if it has one, otherwise the external price service's tax setting, otherwise the store's default. Ask support which applies to your store; the [playground](https://misc.shopamine.com/restapi/playground.html#pg-prices) shows it for a given setup. The response must be in the shop's base currency — in the EU, typically EUR. ### Version 2 response format A response may instead declare `"v": 2`. It follows exactly the same rules and envelope as version 1 — only the column names differ: | Version 1 | Version 2 | |---|---| | `id` | `c_product_id` | | `base_price` | `n_price_base` | | `final_price` | `n_price_final` | | `discount_rate` | `discount_rate` — unchanged | *JSON — response v2* ```json { "v": 2, "currency": "EUR", "columns": [ "c_product_id", "n_price_base", "n_price_final" ], "data": [ [ "SKU0001", 180.0, 155.0 ], [ "SKU0015", 12.0, 12.0 ], [ "SKU0451", 75.0, 44.5 ] ] } ``` Responses with any other `v` value are rejected. The query Shopamine sends always has `"v": 1`, regardless of which response version your service returns. ### Error responses If the user is not recognized or has no special prices, return your shop's currency with an empty data set: ```json { "v": 1, "currency": "EUR", "columns": [ "id", "final_price" ], "data": [] } ``` In that case — and for items not included in the returned data — the user is shown the default prices configured in Shopamine. `currency` and `columns` must always be present; a bare `{ "v": 1 }` is rejected as an invalid response. If an error occurs, return a response like this: *JSON — error* ```json { "error": "Subject can not be defined based on email john@example.com", "public_error": "Prices are not available for your account. Please contact support." } ``` | Field | Audience | |---|---| | error | A free-form technical message for diagnostics. **Not** shown to the shopper — it is written to the shop's error log so support can investigate. | | public_error | The message shown to the shopper. If present it is displayed; otherwise a generic error message is shown. | `public_error` must be a **single plain-text string, already in the desired language**. Shopamine does not translate it and does not resolve per-language variants — the value is emitted exactly as it appears in the JSON. Because it is emitted as encoded JSON, a string currently renders including its surrounding double quotes. Keep the message simple and avoid characters that need JSON escaping. Both fields, when present, are recorded in the shop's error log. ### Circuit breaker — when Shopamine stops calling your service To keep the shop fast when your service is down or misbehaving, Shopamine uses a **circuit breaker**. After **3 failed calls in a row**, Shopamine stops calling your service for a while. During that time **every shopper in the store** — not only the user whose request failed — sees the default prices configured in Shopamine, together with the message *“The price information server is temporarily unavailable. Please contact support”*. No requests reach your service while the breaker is open. **These count as a failed call** and trip the breaker: - Your service cannot be reached, or the connection is dropped. - No connection within **1.5 seconds**, or no response within **5 seconds**. - An HTTP error status. Always answer with `200`. **These do not count** — the breaker stays closed: - A valid JSON [error response](https://misc.shopamine.com/restapi/#extprices_errors) with `error` / `public_error`. - An empty `data` array (user not recognized, no special prices). - Valid JSON that Shopamine rejects for its content — wrong currency, unknown `v`, missing columns, invalid rows. Only that request falls back to default prices. - A `200` whose body cannot be read — not valid JSON, not a JSON object, an empty body, plain text, an HTML page, or JSON with a syntax error such as a stray comma (`"data": [ ,[ … ] ]`). That request falls back to default prices, with an error message for the shopper. **Recovery.** After a pause, Shopamine sends a single test request (triggered by the next shopper page view). If it succeeds, the breaker closes and customer prices return immediately. If it fails, the pause gets longer: - 1st pause: **1 minute** - 2nd pause: **30 minutes** - 3rd and later pauses: **2 hours** The store admin sees each opening and recovery in the shop's error log (source *External Pricer*, entries `CIRCUIT_OPEN` and `CIRCUIT_RECOVERED`). The `CIRCUIT_OPEN` entry includes the last failure, including the body your service returned if it could not be read. A problem that affects only some users can still switch off prices for everyone. For example, answering `404` or `500` for unknown email addresses: three such users in a row open the breaker for the whole store. **Always answer with HTTP 200 and a valid JSON object**, including for errors and unknown users, and respond within 5 seconds. A body Shopamine cannot read does not open the breaker, but every shopper it reaches sees default prices, so validating your output with a JSON parser before sending it is still worth it. ### Other considerations - The response should include `Content-Type: application/json`. The charset must be UTF-8. - Requests can go over HTTP or HTTPS. HTTP is considerably faster and gives a better user experience, but is less secure — if pricing is sensitive, use HTTPS. - For queries with many items using URL parameters, several HTTP requests are made so URLs do not get too long. The default limit is **2000 characters** total. - With JSON queries there is usually only one request per page view, containing all items. The request can be unauthenticated, or use any of these methods: - A security token in the URL itself (`https://.../getPrices?token=[sometoken]&user=john@example.com…`). The parameter name can be anything. - HTTP Basic authentication (username + password, RFC 2617 §2). - Bearer token authentication (token in HTTP headers, RFC 6750 §2.1). ## Examples ### External Prices Service — JSON query (POST) `POST` Shopamine → your endpoint This is **not a Shopamine endpoint** — you implement the service and Shopamine queries it in real time for customer-specific pricing. This is the JSON query format: Shopamine POSTs the query as a JSON body. `v` is always `1`. **curl** ```bash # Simulate Shopamine calling your endpoint curl -X POST \ 'https://your-service.example.com/shopamine-hook' \ -H 'Content-Type: application/json' \ -d '{"v":1,"user_email":"john@example.com","query":{"SKU0001":1,"SKU0015":1,"SKU0451":12}}' ``` **Python** ```python from flask import Flask, request, jsonify app = Flask(__name__) @app.post('/shopamine-hook') def shopamine_hook(): payload = request.get_json() # ... handle the payload ... return jsonify({ "v": 1, "currency": "EUR", "columns": [ "id", "base_price", "final_price" ], "data": [ [ "SKU0001", 180.0, 155.0 ], [ "SKU0015", 12.0, 12.0 ], [ "SKU0451", 75.0, 44.5 ] ] }) ``` ### External Prices Service — URL query (GET) `GET` Shopamine → your endpoint With the URL query format Shopamine sends a plain `GET` with the query in URL parameters and no body. Shown with the defaults — `user` and `items`, items separated by `,` and ID from quantity by `:` (option 1 below); parameter names, separators and layout are configurable. Values are URL-encoded, so the email arrives as `john%40example.com`. Long queries are split across several GETs, each answered on its own. The response format is the same as for JSON queries. **curl** ```bash # Simulate Shopamine calling your endpoint curl -X GET \ 'https://your-service.example.com/shopamine-hook?user=john%40example.com&items=SKU0001:1,SKU0015:1,SKU0451:12' ``` **Python** ```python from flask import Flask, request, jsonify app = Flask(__name__) @app.get('/shopamine-hook') def shopamine_hook(): user = request.args['user'] # items=SKU0001:1,SKU0015:1,SKU0451:12 -> {'SKU0001': 1, ...} query = {} for pair in request.args['items'].split(','): item_id, qty = pair.split(':') query[item_id] = int(qty) # ... look up prices for user + query ... return jsonify({ "v": 1, "currency": "EUR", "columns": [ "id", "base_price", "final_price" ], "data": [ [ "SKU0001", 180.0, 155.0 ], [ "SKU0015", 12.0, 12.0 ], [ "SKU0451", 75.0, 44.5 ] ] }) ``` --- Source: [https://misc.shopamine.com/restapi/#external-prices](https://misc.shopamine.com/restapi/#external-prices) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — User types Customer groups used for pricing and visibility rules. **user types** - **Path:** `[URL_BASE]/user_types/` - **Scope:** `users` — a request without it returns `403 You need scope "users"` - **Operations:** `list`, `get` **Standard operations — user types** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/user_types/list` | List, paginated | | `GET` | `[URL_BASE]/user_types/[id]` | Retrieve one | **Base path:** `[URL_BASE]/user_types/…` Customer segments. A user type can carry its own pricing settings, overriding the shop defaults. - **Page size** — default **100**, maximum **500** - **Sort fields** — `id`, `name` **User type object** | Field | Required | Description | |---|---|---| | id | Read-only | Shopamine's ID number for this user type. | | name | Required | The name of this user type. | | sys_tags | Optional | System tags skins can use for special handling of this user type. | | pricing_settings | Optional | Present when this user type uses different pricing settings from the shop's default. | *user_type.json* ```json { "id": 1, "name": "B2B Users", "sys_tags": [ "a", "b", "c" ], "pricing_settings": { "price_to_pay": { "price_key": "p1", "discount_key": "d1" }, "comparison_price": { "price_key": "p2", "fixed_discount_rate": 0.25 }, "show_prices_without_taxes": true / false } } ``` ## Examples ### List user_types `GET /user_types/list` The response is an object with a single `data` array. **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/user_types/list?limit=20&offset=0' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/user_types/list?limit=20&offset=0", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response (1 of 5 entries shown)** ```json { "data": [ { "id": 1, "name": "Seller", "pricing_settings": { "price_to_pay": { "price_key": "p3", "discount_key": "d2" }, "comparison_price": { "price_key": "p1", "discount_key": "d1" }, "show_prices_without_taxes": false } } ] } ``` ### Retrieve one `GET /user_types/1` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/user_types/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/user_types/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 1, "name": "Seller", "pricing_settings": { "price_to_pay": { "price_key": "p3", "discount_key": "d2" }, "comparison_price": { "price_key": "p1", "discount_key": "d1" }, "show_prices_without_taxes": false } } ``` --- Source: [https://misc.shopamine.com/restapi/#user_types](https://misc.shopamine.com/restapi/#user_types) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — Purchase attempts Shopping carts, including abandoned ones. Read-only. Needs the `settings` scope, not `purchases`. **purchase attempts** - **Path:** `[URL_BASE]/purchase_attempts/` - **Scope:** `settings` — a request without it returns `403 You need scope "settings"` - **Operations:** `list`, `get` **Standard operations — purchase attempts** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/purchase_attempts/list` | List, paginated | | `GET` | `[URL_BASE]/purchase_attempts/[id]` | Retrieve one | **Base path:** `[URL_BASE]/purchase_attempts/…` A purchase attempt is created the moment a shopper reaches checkout with items in their basket — before any payment is attempted — and is kept in sync as they fill in address and payment details. If they complete the order, the attempt is linked to the resulting purchase (`purchase_id` is set) and no longer appears in this list. If they never complete it, the row remains as an abandoned cart. **Read only.** Purchase attempts cannot be created, updated or deleted through the API. The list endpoint returns only **abandoned carts** — attempts that resulted in an actual purchase are excluded. - **Page size** — default **100**, maximum **500** - **Sort fields** — `id`, `external_id`, `date_created` ### Fields **Purchase attempt object** | Field | Description | |---|---| | id | Shopamine's ID number for this purchase attempt. | | purchase_id | Present when this attempt resulted in an actual purchase — the id of that purchase. | | email | E-mail address of the buyer. Always present; `null` when the attempt has no associated user. | | phone | Phone number from the attempt's shipping address. Always present; `null` when not known. | | user_id | Present when the attempt belongs to a registered user — the id of that user. | | user | Object representing the [user](https://misc.shopamine.com/restapi/#users) entity. Embedded directly whenever the attempt belongs to a registered user — no `?exploded` parameter needed. | | user_type_id | ID of the user's user type. | | user_type | Name of the user's user type. | | domain | The shop domain the attempt was made on. | | link | Permanent link to the abandoned cart. | | shipping_address_id | The shipping address for this attempt. Absent on attempts with only virtual goods, or with no shipping. | | shipping_address | Object representing the shipping address entity. | | date_created | When the attempt was made. | | items | The items in this attempt. `container_item_id` is only present with variants. `customization` is only present with items that have customization — the values live under `values`, and `configuration` holds a snapshot of the item's settings at the time. | | payment | Information on the payment method for this attempt. | | items_total | Total cost of all items, excluding shipping and billing costs. | | final_price | Final total for this attempt, including items, shipping and billing costs. | ### Complex prices All purchase-attempt prices and costs are stored as **complex prices**. You will likely only use a field or two — the rest are there for audit purposes. | Field | Description | |---|---| | value | The final value, with taxes and discounts applied. | | currency | The currency of this price. | | base | The base price, before taxes and discounts. | | base_with_discounts | The base price with discounts applied, but without taxes. | | base_with_taxes | The base price with taxes, but without discounts. | | discounts_applied | Discounts applied to this price. The default SKU-level discount (from `Item.discount1/2/3`) has `discount_id` `0` and `discount_name` `"Item discount"`. Entries include a `discount_target` (`items`, `basket` or `shipping`) identifying scope. See [Discount semantics](https://misc.shopamine.com/restapi/#purchases_discounts). | | taxes_applied | All taxes applied to this price. Use in combination with the purchase's `tax_conf_snapshot`, rather than the shop's current settings. | ### Sample object *purchase_attempt.json* ```json { "id": 123, "email": "test@example.com", "purchase_id": 456, // present when the attempt became a purchase "domain": "www.example.com", "link": "https://www.example.com/basket/restore/abc123", // permanent cart link "phone": "+38641123456", "user_id": 78, // present when the attempt belongs to a registered user "user": { // serialized user entity, see user }, "user_type_id": 2, "user_type": "B2B customers", "shipping_address_id": 12, "shipping_address": { "id": 123, "name": "Janez Novak", "company": "Firma d.o.o.", "street_addr_1": "Ulica bratov Novak 12", "street_addr_2": "4. nadstropje", "postal_code": "1215", "city": "Medvode", "state_code": "CA", "country_code": "SI", "tax_code": "SI21341515", "phone": "+386 41 123 456", "deleted": true / false }, "date_created": "2023-05-04T12:34:56.789Z", "items": [ { "item_id": 213, "container_item_id": 15, "quantity": 10, "customization": { "values": { "key1": { "type": "text" / "choices", "value": [ "abc" ] }, ... }, "configuration": { // see item } }, "price_unconfigured": { complex_price }, "price_single": { complex_price }, "price_total": { complex_price }, "tax_class_id": 12 }, ... ], "payment": { "type": "unhandled" / "megapos" / "paypal_wp_standard" / "banka_koper", "name": { "__": ... }, "payment_id": 123, "cost": { complex_price } }, "items_total": { complex_price }, "final_price": { complex_price } } complex price: { "value": 108.45, "currency": "EUR", "base": 100.5, "base_with_discounts": 90.45, "base_with_taxes": 120.6, "discounts_applied": [ { "discount_id": 12, "discount_name": "Promo: Get 10%", "coupon_code": "PROMO10", "base": 100.5, "rate": 0.1, "amount": 10.05 }, ... ], "taxes_applied": [ { "tax_rate_id": 1, "base": 90.45, "rate": 0.2, "amount": 18.09 }, ... ] } ``` ## Examples ### List purchase_attempts `GET /purchase_attempts/list` The response is an object with a single `data` array. **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/purchase_attempts/list?limit=20&offset=0' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/purchase_attempts/list?limit=20&offset=0", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response (1 of 20 entries shown, truncated)** ```json { "data": [ { "id": 1, "domain": null, "date_created": "2023-12-18T08:53:18Z", "email": "jane.doe@example.com", "phone": null, "user_id": 1, "user": { "id": 1, "email": "jane.doe@example.com", "date_created": "2023-12-18T08:51:17Z", "date_updated": "2026-06-18T05:14:29Z", "external_id": "1", "locked": false, "gdpr_permissions": [ { "id": 1, "required": true, "external_id": "1", "name": "Privacy Policy", "text": "By placing this order you agree to all terms of service and payment (order with obligation to pay).", "agreed": true } ... truncated ``` ### Retrieve one `GET /purchase_attempts/1` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/purchase_attempts/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/purchase_attempts/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response (truncated)** ```json { "id": 1, "domain": null, "date_created": "2023-12-18T08:53:18Z", "email": "jane.doe@example.com", "phone": null, "user_id": 1, "user": { "id": 1, "email": "jane.doe@example.com", "date_created": "2023-12-18T08:51:17Z", "date_updated": "2026-06-18T05:14:29Z", "external_id": "1", "locked": false, "gdpr_permissions": [ { "id": 1, "required": true, "external_id": "1", "name": "Privacy Policy", "text": "By placing this order you agree to all terms of service and payment (order with obligation to pay).", "agreed": true } ] }, ... truncated ``` --- Source: [https://misc.shopamine.com/restapi/#purchases_attempts](https://misc.shopamine.com/restapi/#purchases_attempts) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — Purchases Completed orders, discount semantics, and updating an order's status and documents. **purchases** - **Path:** `[URL_BASE]/purchases/` - **Scope:** `purchases` — a request without it returns `403 You need scope "purchases"` - **Operations:** `list`, `get` **purchases** - **Path:** `[URL_BASE]/purchases/` - **Scope:** `purchases` — a request without it returns `403 You need scope "purchases"` **Standard operations — purchases** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/purchases/list` | List, paginated | | `GET` | `[URL_BASE]/purchases/[id]` | Retrieve one | **Base path:** `[URL_BASE]/purchases/…` Completed orders — line items, shipping, payment, discounts and the tax snapshot used at the time of purchase. ### List parameters - **Page size** — default **25**, maximum **100** - **Sort fields** — `id`, `external_id`, `external_order_id`, `date_bought` - **status** — `?status=[order status]` restricts the list to purchases with the given status. - **company_id** — `?company_id=[id]` restricts the list to purchases made for the given company. - **company_external_id** — `?company_external_id=[number]` restricts the list to purchases of the company with this ERP customer number. - **company_tax_code** — `?company_tax_code=[VAT number]` restricts the list to purchases whose recorded company VAT number matches. Spaces, dots and dashes are ignored and case does not matter. Several companies can share a VAT number. - **Combining** — The company filters combine with each other and with `status`; a purchase must match all of them. An unknown or invalid value matches no purchases. ### Fields **Purchase object** | Field | Required | Description | |---|---|---| | id | Required | Shopamine's ID number for this purchase. | | external_id | Optional | The external ID of this purchase. | | purchase_attempt_id | Required | ID of the originating [purchase attempt](https://misc.shopamine.com/restapi/#purchases_attempts) (shopping cart) that produced this completed purchase. Useful for cross-referencing cart events. | | user_id | Required | The ID of the user that made this purchase. | | user ² | Required | Object representing the user entity. | | company_id | Optional | ID of the company the purchase was made for. Present only when the buyer was a member of a company when the order was placed at checkout; older purchases do not have it. | | company | Optional | The company the purchase was made for, present together with `company_id`: `id`, `name`, and, when set, `external_id` and `tax_code`. `name` and `tax_code` are as they were when the order was placed; `external_id` is the company's current ERP customer number. Purchase webhooks carry the same fields. | | shipping_address_id | Optional | The shipping address. Absent on purchases with only virtual goods, or with no shipping. | | shipping_address ² | Required | Object representing the shipping address entity. | | billing_address_id | Optional | The billing address. Absent on purchases that only contain free items. | | billing_address ² | Required | Object representing the billing address entity. | | date_bought | Required | When the purchase was made. | | status | Required | The status of the order. | | domain | Required | Which domain the order was made on. | | locale | Required | Which locale the order was made in. | | payment_status | Required | The payment status of the order. | | items | Required | The items bought in this purchase. `container_item_id` is only present with variants; `customization` only with customized items, where values live under `values` and `configuration` holds the settings snapshot. Includes `promotion` when present, plus `item_name`, `item_external_id`, `item_sku`, `supplier_code`, `additional_code`, `container_item_external_id`, `container_item_sku`, `container_item_name`, `tax_inclusive`, `suppliers` (entries carry `supplier_id`, `supplier_name`, `nnc`, `ppc`) and `parts` for customized items. | | shipping | Optional | Shipping information. Some shipping types calculate how items are distributed into parcels; most do not. `type` and `name` snapshot the shipping settings at purchase time. Also includes `promotion` when present, `parcels`, `messages`, `was_embedded`, `cost` (complex price), `tax_class_id` (defaults to 1), `tracking`, `shipping_ext_ids`, `pickup_location`, `tax_inclusive` and `allows_partial_shipping`. | | payment | Optional | Information on the payment method, including `payment_ext_ids`. | | user_notes | Optional | The user's comments when they made the purchase. | | system_notes | Optional | Anything Shopamine had to say about this purchase, usually related to billing. | | merchant_notes | Optional | Internal merchant/admin notes — distinct from `system_notes`. | | items_total | Required | Total cost of all items, excluding shipping and billing costs. | | grand_total | Required | Grand total, including items, shipping and billing costs. | | tax_conf_snapshot | Required | Snapshot of the tax computation settings used for this purchase. | | delivery_window | Optional | For B2B preorder-originated purchases: snapshot of the buyer-selected delivery window (e.g. "March 2026 shipment"). Object with `code` and localized `label`. Absent for non-preorder purchases. | | payment_terms | Optional | For B2B preorder-originated purchases: snapshot of the buyer-selected payment terms. Object with `code`, localized `label`, `payment_days` (0 = prepay), `adjustment_mode` (`percent` or `value`) and `adjustment`. On older purchases `label` may be a plain string instead of a localized object. | | external_order_id | Optional | External order tracking ID for integration with external systems. | | external_reference | Optional | Additional external reference field. | | supplier_reference | Optional | The supplier's reference for the purchase. Emitted only when set, can be changed with a purchase update (send an empty string to clear it), and is not shown to the buyer. Not unique: one reference can cover several purchases. | | approval_status | Required | Customer approval status: `awaiting_approval`, `approved` or `not_approved`. | | user_type_id | Optional | ID of the user type. | | user_type | Optional | Name of the user type. | | link | Optional | Thank-you-page link data: `{ "domain": …, "url": … }`. Only included in the exploded view, as are `user_type_id` and `user_type`. | | purchase_documents | Optional | Array of documents attached to the purchase. A document's location must be a file path in your store or an absolute `https://` URL with a host and no embedded credentials; any other location is skipped. Base64 content over 20 MB is skipped as well. | | discounts_breakdown | Optional | Detailed breakdown of all discounts applied, showing each discount individually rather than aggregated. See the table below. | ² Adding `?exploded` to the request makes `user`, `billing_address` and `shipping_address` return the full serialized entity rather than just the ID. ### Complex prices All purchase-related prices and costs are stored as **complex prices**. | Field | Required | Description | |---|---|---| | value | | The final value, with taxes and discounts applied. | | value_unrounded | Optional | Final value before rounding. Present only in `items_total` and `grand_total`. | | currency | | The currency of this price. | | base | | The base price, before taxes and discounts. | | base_with_discounts | | The base price with discounts applied, but without taxes. | | base_with_taxes | | The base price with taxes, but without discounts. | | base_with_taxes_unrounded | Optional | Base price with taxes before rounding. Present only in `items_total` and `grand_total`. | | discounts_applied | | Discounts applied to this price. The default SKU-level discount has `discount_id` `0` and `discount_name` `"Item discount"`. Each entry includes `discount_target` (`items`, `basket` or `shipping`) and, in totals only, `amount_unrounded`. See [Discount semantics](https://misc.shopamine.com/restapi/#purchases_discounts). | | taxes_applied | | All taxes applied to this price. Use with the purchase's `tax_conf_snapshot` rather than the shop's current settings. Each tax includes `amount_unrounded` in totals only. | ### Promotion field | Field | Description | |---|---| | promotion_id | Shopamine's ID number for this promotion. | | user_code | Custom identification for this promotion. | | promotion_rate | How much of a discount this promotion applies. | | type | `GIFT`, `DISCOUNT` or `FREE_SHIPPNG`. | | applied_type | What the promotion is applied to: `PRODUCTS`, `BRANDS_CATEGORIES`, `QUANTITY` or `CUSTOM`. | ### Discounts breakdown A detailed breakdown of *all* discounts applied to a purchase, each shown individually rather than aggregated. | Field | Required | Description | |---|---|---| | discount_id | Required | Shopamine's ID for this discount. | | discount_name | Required | Name of the discount. | | discount_target | Required | Scope: `items` (specific items), `basket` (basket total) or `shipping` (shipping cost). | | item_id | Optional | Present only when `discount_target` is `items` — identifies which item this discount applies to. | | coupon_code | Optional | Coupon code, if this discount was triggered by a coupon. | | base | Required | Base amount the discount was calculated on. | | rate | Required | Discount rate — e.g. `0.1` for 10%. | | amount | Required | Discount amount in currency units. | ### Sample object *purchase.json* ```json { "id": 123, // ID of the originating PurchaseAttempt (shopping cart) that // produced this completed purchase. "purchase_attempt_id": 4567, "external_id": "XY123", "external_order_id": "EXT-ORD-12345", "external_reference": "REF-XYZ-789", "user_id": 123, "user_type_id": 2, "user_type": "wholesale", // only when the buyer belonged to a company at checkout "company_id": 7, "company": { "id": 7, "external_id": "ERP-CUST-0042", // when set "name": "ACME d.o.o.", "tax_code": "SI12345678" // when set }, "shipping_address_id": 12, "billing_address_id": 23, "date_bought": "2012-10-15T12:34:56.789Z", "status": "new" / "confirmed" / "processing" / "manufacturing" / "pending" / "complaint" / "paused" / "change_goods" / "ready_to_ship" / "partially_shipped" / "shipped_pickup_station" / "awaiting_pick_up" / "shipped_unsuccessful" / "shipped" / "returned_to_sender" / "not_valid" / "canceled" / "finished" / "test", "approval_status": "awaiting_approval" / "approved" / "not_approved", "payment_status": "awaiting_payment" / "payment_received" / "payment_allocated" / "payment_partially_invoiced" / "payment_canceled" / "payment_failed" / "payment_refunded" / "cash_on_delivery" / "contract_defined", "domain": "www.example.com", "locale": "sl" / "en" / "de" / ... , "items": [ { "item_id": 213, "item_name": "Chocolate cookies", // also present when set: item_external_id, item_sku, item_bar_code, supplier_code, // additional_code, container_item_*, tax_inclusive, parts, // suppliers: [ { "supplier_id": ..., "supplier_name": ..., "nnc": ..., "ppc": ... } ] "container_item_id": 15, "quantity": 10, "customization": { "values": { "key1": { "type": "text" / "choices", "value": [ "abc" ] }, ... }, "configuration": { // see item } }, "price_unconfigured": { complex_price }, "price_single": { complex_price }, "price_total": { complex_price }, "tax_class_id": 12, "promotion":{ "applied_type":"PRODUCTS", "type":"DISCOUNT", "promotion_id":6, "user_code":"Promotion_User_Code", "promotion_rate":0.3 } }, ... ], "shipping": { "type": "free" / "simple" / "weight_based" / "flat_rate" / "item_number_based" / "price_based" / "international", "name": { "__": "Shipping name" }, "shipping_id": 123, "tax_class_id": 1, "parcels": [ { "cost": 123.456, "repeats": 5, "contents": [ { "item_id": 123, "quantity": 10 "weight_grams": 15 }, ... ] }, ... ], "messages": [ "message 1", ... ], "was_embedded": true / false, "cost": { complex_price }, "tracking": { "tracking_number": "trackingNumber1234", "company": "shippingCompany", "tracking_link": "https://www.example.com/tracking/1234" }, "pickup_location": { // AddressInfo structure - same as shipping_address/billing_address "first_name": "John", "last_name": "Doe", "street": "123 Pickup Street", "city": "Springfield", "post_code": "12345", "country_code": "US" }, "promotion":{ "applied_type":"PRODUCTS", "type":"DISCOUNT", "promotion_id":6, "user_code":"Promotion_Shipping_User_Code", "promotion_rate":0.3 }, "allows_partial_shipping": true / false }, "payment": { "type": "unhandled" / "megapos" / "paypal_wp_standard" / "banka_koper", "name": { "__": ... }, "payment_id": 123, "cost": { complex_price } }, "user_notes": "...", "system_notes": "...", "merchant_notes": "Customer requested expedited shipping", "link": { // only in exploded view (?exploded) "domain": "www.example.com", "url": "https://www.example.com/order/thank-you/123" }, "purchase_documents": [ { "id": 1, "document_name": "invoice.pdf", "document_hash": "abc123...", "document": "https://www.example.com/documents/invoice.pdf", "inserted": 1706428800 } ], "discounts_breakdown": [ { "discount_id": 12, "discount_name": "Promo: Get 10%", "discount_target": "items", "item_id": 213, "coupon_code": "PROMO10", "base": 100.5, "rate": 0.1, "amount": 10.05 }, { "discount_id": 311, "discount_name": "PROMO-10€", "discount_target": "basket", "coupon_code": "10-PROMO", "base": 303.27, "rate": 0.03, "amount": 8.20, "calculation_mode": "amount_with_tax", // "percent" / "amount" / "amount_with_tax" "lines": [ // the discount as line items, one per tax class { "tax_class_id": 1, "tax_rate_id": 1, // omitted if the class has several rates "tax_rate": 0.22, "base": -8.20, // net "tax": -1.80, "total": -10.00 // gross; base + tax = total } ] // "lines_derived": true on purchases placed before the lines were stored }, { "discount_id": 15, "discount_name": "Free shipping on orders over $100", "discount_target": "shipping", "base": 12.50, "rate": 1.0, "amount": 12.50 } ], "items_total": { complex_price }, "grand_total": { complex_price }, // B2B preorder-originated purchases capture the buyer's selected // delivery window. Present only when a window was selected. "delivery_window": { "code": "MARCH_2026", // stable machine identifier "label": { "__": "March 2026 shipment" } // localized display name }, // B2B preorder-originated purchases capture the buyer's selected // payment terms. Present only when terms were selected. "payment_terms": { "code": "NET_30", // stable machine identifier "label": { "__": "Net 30 — 1% discount" }, // localized display name; may be a plain string on older purchases "payment_days": 30, // 0 = prepay "adjustment_mode": "percent" / "value", // how the adjustment applies "adjustment": -0.01 // percent (as a rate) or fixed amount }, "tax_conf_snapshot": { "zone": { "id": 123, "name": "EU", "order_rank": 1, "territory": { "include_countries": [ { "country_code": "US", "include_states": [ "CA", "NY" ], "exclude_states": [ "AL" ], "include_post_code_prefixes": [ "94", "95 ], "exclude_post_code_prefixes": [ "12" ], "tax_number": "required" / "forbidden" / "any" }, ... ], "exclude_countries": [ "GB", "AU" ], "include_regions": [ { "region_code": "EU", "tax_number": "required" / "forbidden" / "any" } ], "exclude_regions": [ "EU", "001" ], "tax_number": "required" / "forbidden" / "any" }, "users": { "user_type_ids": [ 1, 2, 3 ], "include_null_type": true / false } }, "rates": [ { "id": 1, "name": { "__": "DDV" }, "tax_zone_id": 1, "order_weight": 5, "values": [ { "tax_class_id": 1, "rate": 0.2 }, { "tax_class_id": 2, "rate": 0.085 } ] }, ... ], "classes": [ { "id": 1, "name": "Izdelki z običajnim DDV" }, { "id": 2, "name": "Izdelki z znižanim DDV" }, ... ] } } complex price: { "value": 108.45, "value_unrounded": 108.454321, // present only in items_total and grand_total "currency": "EUR", "base": 100.5, "base_with_discounts": 90.45, "base_with_taxes": 120.6, "base_with_taxes_unrounded": 120.604321, // present only in items_total and grand_total // See "Discount Semantics" in the Purchases section for how to interpret each entry. // An entry's "discount_target" identifies scope: // - "items" : applied to individual line items. Also visible on the corresponding items[#].price_*.discounts_applied. // Entries in items_total/grand_total with discount_target: "items" are an aggregate summary; // they must NOT be redistributed across all order lines. // - "basket" : applied to the order subtotal (e.g. a promotional coupon code). Only appears in // items_total/grand_total.discounts_applied, never on individual line items. // - "shipping": applied to shipping cost. // The default (SKU-level) discount from Item.discount1/2/3 uses discount_id: 0 and discount_name: "Item discount". "discounts_applied": [ { "discount_id": 0, "discount_name": "Item discount", "discount_target": "items", // SKU-level discount from Item.discount1/2/3 "base": 100.5, "rate": 0.3, "amount": 30.15 }, { "discount_id": 12, "discount_name": "Promo: Get 10%", "discount_target": "basket", // basket-level promotional code "coupon_code": "PROMO10", "base": 100.5, "rate": 0.1, "amount": 10.05 }, ... ], "taxes_applied": [ { "tax_rate_id": 1, "base": 90.45, "rate": 0.2, "amount": 18.09, "amount_unrounded": 18.094321 // present only in totals }, ... ] } ``` Purchases ## Discount semantics Discount information appears in three places in a serialized purchase. Each has a distinct purpose, and the same discount can be visible in more than one of them — **which causes double-counting if not handled with care**. **Where discounts appear** | Location | Purpose | |---|---| | items[#].price_unconfigured.discounts_applied items[#].price_single.discounts_applied items[#].price_total.discounts_applied | Discounts that reduce **this specific line item**. `price_single` / `price_unconfigured` carry per-unit amounts; `price_total` carries per-unit amounts multiplied by the line's quantity. The line's `base_with_discounts` / `value` already reflect these — you do not need to re-apply them. | | items_total.discounts_applied grand_total.discounts_applied | An aggregated, order-wide summary of the discounts that contributed to the totals. Entries with `discount_target: "items"` are **already accounted for on the individual line items** — repeated here as a summary only. Entries with `discount_target: "basket"` act at the subtotal level (e.g. coupon codes discounting the whole order) and do **not** appear on individual line items. | | discounts_breakdown (top level) | The authoritative, non-aggregated per-discount listing. Every entry has a `discount_target`, and when it is `items`, an `item_id` identifying exactly which line the discount applies to. **Use this array to classify discounts unambiguously.** | ### Classifying by `discount_target` - `items` — reduces the price of specific line items. Two sub-cases: SKU-level discount from the item record (`Item.discount1/2/3`): `discount_id: 0`, `discount_name: "Item discount"`. In `discounts_breakdown` the entry carries the relevant `item_id`. Promotion targeting individual items: `discount_id > 0`. Also carries an `item_id` in `discounts_breakdown`. - `basket` — reduces the order subtotal as a whole (typical coupon-code behaviour). `discount_id > 0`. Never attached to a single `item_id`. - `shipping` — reduces shipping cost. Appears on `shipping.cost.discounts_applied` and in `discounts_breakdown`. ### Basket discounts as line items Each `discount_target: "basket"` entry in `discounts_breakdown` also carries the discount as it was actually taken off the order: one line per tax class, with net, tax and gross spelled out. Consumers that post basket discounts as line items (for example an ERP) should use these lines rather than recompute anything from `rate` or `amount`. **Basket discount fields** | Field | Presence | Description | |---|---|---| | calculation_mode | Optional | How the promotion is configured: `percent`, `amount` (a fixed net amount) or `amount_with_tax` (a fixed gross amount). | | lines | Optional | The discount as line items, one per tax class. Present on every basket entry. | | lines[#].tax_class_id | Optional | Tax class of the items this part of the discount was taken from. | | lines[#].tax_rate_id lines[#].tax_rate | Optional | The tax class's rate. Omitted if the class has more than one rate in the purchase's tax zone. | | lines[#].base | Optional | Net amount of the line. Negative. | | lines[#].tax | Optional | Tax amount of the line. Negative. | | lines[#].total | Optional | Gross amount of the line. Negative. | | lines_derived | Optional | `true` when the lines were reconstructed rather than stored (see below). Absent otherwise. | - All line amounts are whole cents, and `base + tax = total` on every line. - The sum of `lines[#].total` is exactly the amount the basket discount took off the charged total, and the sum of `lines[#].base` exactly what it took off `items_total.base_with_discounts`. - With per-line tax calculation, the sum of `lines[#].tax` for a tax rate is exactly what the discount took off that rate's `items_total.taxes_applied[#].amount`. - A line's tax is the difference between its gross and its net. It is not the net multiplied by the rate, and the two can differ by a cent. Purchases placed before these fields existed did not store the lines. For those, `lines` is reconstructed from the stored totals (the line items' `price_total` minus `items_total`, per tax rate) and the entry carries `"lines_derived": true`. Reconstructed lines are exact for baskets with a single tax rate; for mixed-rate baskets, or stores that calculate tax per rate bucket, they can be a cent off. On those purchases, `calculation_mode` reflects the promotion's current configuration, not necessarily the one in effect when the purchase was placed. ### Consumer rules **Do not redistribute** entries from `items_total.discounts_applied` across all lines. Entries with `discount_target: "items"` are per-line discounts already attributed to their respective line items — redistributing double-counts them and misapplies them to lines that were never discounted. - To compute per-line charges, rely on the line item's own `price_*.value` / `base_with_discounts`, or on its `discounts_applied`. - To decide the scope of a discount, consult `discounts_breakdown` and read `discount_target` (and `item_id` when present). The `discounts_applied` arrays are a summary view and are not the right place to drive scope decisions. - A single entry may be structurally identical in several locations (same `discount_id`, `discount_name`, `rate`, …). That is **one** discount seen at different levels of aggregation — not several independent discounts. Purchases ## Updating a purchase A purchase **cannot be created** via an API call at the moment. Only a handful of fields can be changed: Moving `status` to `ready_to_ship` can be refused on stores that use an order-management integration: `400` if the integration hasn’t confirmed the order yet, `503` if it couldn’t be reached (safe to retry). Stores without such an integration configured are unaffected, and re-saving an order that is already `ready_to_ship` never triggers this check. **Updatable fields** | status | payment_status | approval_status | |---|---|---| | external_id | external_order_id | external_reference | | system_notes | merchant_notes | purchase_documents | | supplier_reference | | | | shipping_address_id | billing_address_id | shipping → tracking | *purchase-update.json* ```json { "id": 1213, "status": "shipped", "payment_status": "payment_received", "external_id": "external_id1234", "external_order_id": "external_order_id1234", "external_reference": "REF-UPDATE-123", "approval_status": "approved", "system_notes": "system notes", "merchant_notes": "merchant notes", "shipping_address_id": 764, "billing_address_id": 764, "shipping": { "tracking": { "tracking_number": "trackingNumber1234", "company": "shippingCompany", "tracking_link": "https://www.example.com/tracking/1234" } } } ``` ### Updating documents on a purchase Adding documents to a purchase needs the purchase `id`. A document can be added as an external link or as an uploaded binary. When a `purchase_document` id is already present, your POST results in an **update**. Otherwise it results in a **create**. You can add many documents to one order. *purchase-update-upload-binary.json* ```json { “id”: 22913, “purchase_documents”: [ { “document_name”:“invoice_1234.pdf”, “document_hash”:“hfxh876348y2r8gjgrewfsq39eufh”, “document”:“https://your-erp/docs/invoice_1234.pdf”, “inserted”:1 }, { “document_name”:“invoice_2345.pdf”, “document_hash”:“454vfg56348y2dfgyd6788hhhjx2x”, “document”: “JVBERi0xLjUNJeLjz9MNCjI1IDAgb2JqDTw8L0xpbmVhcml6ZWQgMS9MIDQ0MjUyL08gMjcvRSAyODMwMS9OIDIvVCA0MzYzN ... “, “inserted”:1 } ] } ``` ## Examples ### List purchases `GET /purchases/list` The response is an object with a single `data` array. **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/purchases/list?limit=20&offset=0' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/purchases/list?limit=20&offset=0", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response (1 of 20 entries shown, truncated)** ```json { "data": [ { "id": 1, "purchase_attempt_id": 2, "user_id": 2, "shipping_address_id": 1, "billing_address_id": 1, "date_bought": "2023-12-18T08:55:03Z", "domain": "www.example.com", "locale": "en", "status": "finished", "payment_status": "payment_allocated", "approval_status": "approved", "items": [ { "item_id": 133, "item_sku": "123SKU123", "item_name": "Product 06", "quantity": 1, "customization": { "values": {}, "configuration": { "apply_after_discounts": false } ... truncated ``` ### Retrieve one `GET /purchases/1` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/purchases/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/purchases/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response (truncated)** ```json { "id": 1, "purchase_attempt_id": 2, "user_id": 2, "shipping_address_id": 1, "billing_address_id": 1, "date_bought": "2023-12-18T08:55:03Z", "domain": "www.example.com", "locale": "en", "status": "finished", "payment_status": "payment_allocated", "approval_status": "approved", "items": [ { "item_id": 133, "item_sku": "123SKU123", "item_name": "Product 06", "quantity": 1, "customization": { "values": {}, "configuration": { "apply_after_discounts": false } }, "price_unconfigured": { ... truncated ``` ### Update a purchase `POST /purchases/1` Only these fields are writable: `status`, `payment_status`, `external_id`, `external_order_id`, `external_reference`, `supplier_reference`, `approval_status`, `system_notes`, `merchant_notes`, `shipping_address_id`, `billing_address_id`. **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/purchases/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "status": "finished", "payment_status": "payment_allocated", "external_order_id": "ERP-10021", "merchant_notes": "Picked and packed" }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/purchases/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "status": "finished", "payment_status": "payment_allocated", "external_order_id": "ERP-10021", "merchant_notes": "Picked and packed" }, timeout=30, ) res.raise_for_status() data = res.json() ``` --- Source: [https://misc.shopamine.com/restapi/#purchases](https://misc.shopamine.com/restapi/#purchases) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — Tax classes Tax rate groupings that items are assigned to. **tax classes** - **Path:** `[URL_BASE]/tax_classes/` - **Scope:** `settings` — a request without it returns `403 You need scope "settings"` - **Operations:** `list`, `get`, `create`, `update`, `delete` **Standard operations — tax classes** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/tax_classes/list` | List, paginated | | `GET` | `[URL_BASE]/tax_classes/[id]` | Retrieve one | | `POST` | `[URL_BASE]/tax_classes/create` | Create | | `POST` | `[URL_BASE]/tax_classes/[id]` | Update (merge: absent fields untouched, explicit null clears) | | `DELETE` | `[URL_BASE]/tax_classes/[id]` | Delete | **Base path:** `[URL_BASE]/tax_classes/…` Like items and users, tax classes can also be addressed by external id. | Method | Endpoint | Description | |---|---|---| | `GET, POST` | `[URL_BASE]/tax_classes/by_external_id/{external_id}` | | - **Page size** — default **100**, maximum **500** - **Sort fields** — `id`, `name`, `external_id` **Tax class object** | Field | Required | Description | |---|---|---| | id | Read-only | Shopamine's ID number for this tax class. | | name | Required | The name of this tax class. | | external_id | Optional | The external ID of this tax class. | *tax_class.json* ```json { "id": 1, "external_id": "...", "name": "Taxable products" } ``` ## Examples ### List tax_classes `GET /tax_classes/list` The response is an object with a single `data` array. **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/tax_classes/list?limit=20&offset=0' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/tax_classes/list?limit=20&offset=0", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response (1 of 4 entries shown)** ```json { "data": [ { "id": 1, "name": "Tax products" } ] } ``` ### Retrieve one `GET /tax_classes/1` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/tax_classes/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/tax_classes/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 1, "name": "Tax products" } ``` ### Create `POST /tax_classes/create` **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/tax_classes/create' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "external_id": "TC-01", "name": "Standard rate" }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/tax_classes/create", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "external_id": "TC-01", "name": "Standard rate" }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 11, "name": "Standard rate", "external_id": "docs-example-tax_classes-tmp" } ``` ### Update `POST /tax_classes/1` Updates merge: fields absent from the request are left untouched. Send an explicit `null` to clear a field. **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/tax_classes/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "name": "Standard rate (renamed)" }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/tax_classes/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "name": "Standard rate (renamed)" }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 11, "name": "Standard rate (renamed)", "external_id": "docs-example-tax_classes-tmp" } ``` ### Delete `DELETE /tax_classes/1` Clients that cannot send DELETE may use `POST /tax_classes/{id}?method=delete`. **curl** ```bash curl -X DELETE \ 'https://api.shopamine.com/www.example.com/api/v1/tax_classes/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.delete( "https://api.shopamine.com/www.example.com/api/v1/tax_classes/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "status": "ok" } ``` ### Find by external id `GET /tax_classes/by_external_id/TC-01` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/tax_classes/by_external_id/TC-01' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/tax_classes/by_external_id/TC-01", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 7, "name": "Docs example tax class", "external_id": "docs-example-tc" } ``` --- Source: [https://misc.shopamine.com/restapi/#tax_classes](https://misc.shopamine.com/restapi/#tax_classes) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — Images Image assets, addressable by md5 hash. **images** - **Path:** `[URL_BASE]/images/` - **Scope:** `images` — a request without it returns `403 You need scope "images"` - **Operations:** `list`, `get`, `create`, `update`, `delete` **Standard operations — images** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/images/list` | List, paginated | | `GET` | `[URL_BASE]/images/[id]` | Retrieve one | | `POST` | `[URL_BASE]/images/create` | Create | | `POST` | `[URL_BASE]/images/[id]` | Update (merge: absent fields untouched, explicit null clears) | | `DELETE` | `[URL_BASE]/images/[id]` | Delete | **Base path:** `[URL_BASE]/images/…` Besides JPEG, PNG and GIF, uploads may be WEBP, SVG or APNG — any `data:image/*` URI. Images can be uploaded directly using data URLs, or fetched from an external server over HTTP/S or FTP. For FTP, credentials can be supplied directly in the URL. A source that cannot be fetched, including one at a private or internal address, is answered with `400` and the message `could not fetch image source`; the status of the remote server is not passed on. **Uploads are de-duplicated by content.** Creating an image whose MD5 matches an existing one returns the existing image instead of creating a duplicate. Images cannot be changed once uploaded, except for their title and description. | Method | Endpoint | Description | |---|---|---| | `GET` | `[URL_BASE]/images/by_md5_hash/{hash}` | Look an image up by content hash. | | `DELETE` | `[URL_BASE]/images/{id}` | Delete an image. | - **Page size** — default **25**, maximum **100** - **Sort fields** — `id`, `width`, `height` **Image object** | Field | Required | Description | |---|---|---| | id | Read-only | Shopamine's ID number for this image. | | media_type | Read-only | The media type of this image. | | width | Read-only | The width of the image in pixels. | | height | Read-only | The height of the image in pixels. | | title | Optional | The localized title of this image. | | description | Optional | The localized description of this image. | | md5_hash | Read-only | MD5 hash of the file's contents. Used for preventing duplicates. | *image.json* ```json // read: { "id": 123, "media_type": "image/jpeg", "width": 500, "height": 300, "title": { "__": "abc", ... }, "description": { "__": ... }, "md5_hash": "123456..." } // update: { "title": ..., "description": ... } // create: { "source": "http://...", "title": { "__": "abc", ... }, "description": { "__": ... }, } // supported source protocols: http:// https:// ftp:// data:image/jpeg;base64,... data:image/png;base64,... data:image/gif;base64,... ``` ## Examples ### List images `GET /images/list` The response is an object with a single `data` array. **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/images/list?limit=20&offset=0' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/images/list?limit=20&offset=0", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response (1 of 18 entries shown)** ```json { "data": [ { "id": 277, "media_type": "image/webp", "width": 220, "height": 50, "md5_hash": "d5c2b002766c228f93c3414122e9d86f" } ] } ``` ### Retrieve one `GET /images/277` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/images/277' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/images/277", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 277, "media_type": "image/webp", "width": 220, "height": 50, "md5_hash": "d5c2b002766c228f93c3414122e9d86f" } ``` ### Create `POST /images/create` **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/images/create' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "external_id": "IMG-01", "source": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==" }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/images/create", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "external_id": "IMG-01", "source": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==" }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 305, "media_type": "image/png", "width": 1, "height": 1, "md5_hash": "2cd8bde463f5d82aae0f0cec061d6b8f" } ``` ### Update `POST /images/277` Updates merge: fields absent from the request are left untouched. Send an explicit `null` to clear a field. **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/images/277' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "title": { "__": "Example image" } }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/images/277", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "title": { "__": "Example image" } }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 305, "media_type": "image/png", "width": 1, "height": 1, "title": { "__": "Example image" }, "md5_hash": "2cd8bde463f5d82aae0f0cec061d6b8f" } ``` ### Delete `DELETE /images/277` Clients that cannot send DELETE may use `POST /images/{id}?method=delete`. **curl** ```bash curl -X DELETE \ 'https://api.shopamine.com/www.example.com/api/v1/images/277' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.delete( "https://api.shopamine.com/www.example.com/api/v1/images/277", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "status": "ok" } ``` ### Find by MD5 hash `GET /images/by_md5_hash/d5c2b002766c228f93c3414122e9d86f` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/images/by_md5_hash/d5c2b002766c228f93c3414122e9d86f' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/images/by_md5_hash/d5c2b002766c228f93c3414122e9d86f", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 277, "media_type": "image/webp", "width": 220, "height": 50, "md5_hash": "d5c2b002766c228f93c3414122e9d86f" } ``` --- Source: [https://misc.shopamine.com/restapi/#images](https://misc.shopamine.com/restapi/#images) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — Physical stores Store locations. Path is singular `/physical_store/`; needs the `items` scope. **physical stores** - **Path:** `[URL_BASE]/physical_store/` - **Scope:** `items` — a request without it returns `403 You need scope "items"` - **Operations:** `list`, `get`, `create`, `update`, `delete` **Standard operations — physical stores** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/physical_store/list` | List, paginated | | `GET` | `[URL_BASE]/physical_store/[id]` | Retrieve one | | `POST` | `[URL_BASE]/physical_store/create` | Create | | `POST` | `[URL_BASE]/physical_store/[id]` | Update (merge: absent fields untouched, explicit null clears) | | `DELETE` | `[URL_BASE]/physical_store/[id]` | Delete | **Base path:** `[URL_BASE]/physical_store/…` **Updates replace the whole object.** Unlike other entities, fields omitted from an update request are *cleared*, not preserved. - **Page size** — default **100**, maximum **500** - **Sort fields** — `id`, `admin_label`, `external_id` **Physical store object** | Field | Required | Description | |---|---|---| | id | Read-only | Shopamine's ID number for this physical store. | | admin_label | On create | Physical store label. | | external_id | Optional | External reference id. | | public_name | Optional | Name displayed on the storefront. | | opened | Optional | Time the store opens, e.g. `"2023-12-03T08:15:00+01:00[Europe/Ljubljana]"` — only the time part is relevant. | | closed | Optional | Time the store closes — only the time part is relevant. | | address | Optional | Address. | | latitude | Optional | Latitude as a double. | | longitude | Optional | Longitude as a double. | | order_weight | Optional | Max order weight. | | node_id | Optional | [Node](https://misc.shopamine.com/restapi/#nodes) id of the page with store information. | *physical_store.json* ```json { id: 1, admin_label: 'Testna trgovina', external_id: '1-trgovina', public_name: { __: 'Testna trgovina' }, opened: '2023-12-03T07:15:00Z', closed: '2023-12-03T07:15:00Z', address: address: { company: 'Firma d.o.o.', line1: 'Ulica bratov Novak 12', line2: '4. nadstropje', city: 'Medvode', postCode: '1215', countryCode: 'SI', phone: '+386 41 123654', taxCode: 'SI1234568', companyRegNum: '12345678910' }, latitude: 34.43444, longitude: 45.23234, order_weight: 2, node_id: 5 } ``` ## Examples ### List physical_store `GET /physical_store/list` The response is an object with a single `data` array. **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/physical_store/list?limit=20&offset=0' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/physical_store/list?limit=20&offset=0", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "data": [ { "id": 3, "admin_label": "Example Store", "external_id": "docs-example-ps1", "public_name": { "__": "Example Store" }, "opened": "2026-01-01T00:00:00Z", "closed": "2026-01-01T00:00:00Z", "address": { "name": "Example Store", "city": "Ljubljana", "line1": "Example Street 1", "postCode": "1000", "countryCode": "SI" }, "latitude": 46.05, "longitude": 14.51, "order_weight": 1, "node_id": null } ] } ``` ### Retrieve one `GET /physical_store/3` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/physical_store/3' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/physical_store/3", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 3, "admin_label": "Example Store", "external_id": "docs-example-ps1", "public_name": { "__": "Example Store" }, "opened": "2026-01-01T00:00:00Z", "closed": "2026-01-01T00:00:00Z", "address": { "name": "Example Store", "city": "Ljubljana", "line1": "Example Street 1", "postCode": "1000", "countryCode": "SI" }, "latitude": 46.05, "longitude": 14.51, "order_weight": 1, "node_id": null } ``` ### Create `POST /physical_store/create` **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/physical_store/create' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "external_id": "PS-01", "admin_label": "Example Store", "public_name": { "__": "Example Store" }, "opened": "2026-01-01T00:00:00Z", "address": { "name": "Example Store", "line1": "Example Street 1", "city": "Ljubljana", "postCode": "1000", "countryCode": "SI" }, "latitude": 46.05, "longitude": 14.51, "order_weight": 1 }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/physical_store/create", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "external_id": "PS-01", "admin_label": "Example Store", "public_name": { "__": "Example Store" }, "opened": "2026-01-01T00:00:00Z", "address": { "name": "Example Store", "line1": "Example Street 1", "city": "Ljubljana", "postCode": "1000", "countryCode": "SI" }, "latitude": 46.05, "longitude": 14.51, "order_weight": 1 }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 10, "admin_label": "Example Store", "external_id": "docs-example-physical_stores-tmp", "public_name": { "__": "Example Store" }, "opened": "2026-01-01T00:00:00Z", "closed": "2026-01-01T00:00:00Z", "address": { "name": "Example Store", "city": "Ljubljana", "line1": "Example Street 1", "postCode": "1000", "countryCode": "SI" }, "latitude": 46.05, "longitude": 14.51, "order_weight": 1, "node_id": null } ``` ### Update `POST /physical_store/3` Updates merge: fields absent from the request are left untouched. Send an explicit `null` to clear a field. **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/physical_store/3' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "admin_label": "Example Store", "public_name": { "__": "Example Store" }, "order_weight": 2 }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/physical_store/3", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "admin_label": "Example Store", "public_name": { "__": "Example Store" }, "order_weight": 2 }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 10, "admin_label": "Example Store", "external_id": null, "public_name": { "__": "Example Store" }, "opened": "2026-01-01T00:00:00Z", "closed": "2026-01-01T00:00:00Z", "address": { "name": "Example Store", "city": "Ljubljana", "line1": "Example Street 1", "postCode": "1000", "countryCode": "SI" }, "latitude": null, "longitude": null, "order_weight": 2, "node_id": null } ``` ### Delete `DELETE /physical_store/3` Clients that cannot send DELETE may use `POST /physical_store/{id}?method=delete`. **curl** ```bash curl -X DELETE \ 'https://api.shopamine.com/www.example.com/api/v1/physical_store/3' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.delete( "https://api.shopamine.com/www.example.com/api/v1/physical_store/3", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "status": "ok" } ``` --- Source: [https://misc.shopamine.com/restapi/#physical_store](https://misc.shopamine.com/restapi/#physical_store) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — Warehouses Stock locations. Path is singular `/warehouse/`; needs the `items` scope. **warehouses** - **Path:** `[URL_BASE]/warehouse/` - **Scope:** `items` — a request without it returns `403 You need scope "items"` - **Operations:** `list`, `get`, `create`, `update`, `delete` **Standard operations — warehouses** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/warehouse/list` | List, paginated | | `GET` | `[URL_BASE]/warehouse/[id]` | Retrieve one | | `POST` | `[URL_BASE]/warehouse/create` | Create | | `POST` | `[URL_BASE]/warehouse/[id]` | Update (merge: absent fields untouched, explicit null clears) | | `DELETE` | `[URL_BASE]/warehouse/[id]` | Delete | **Base path:** `[URL_BASE]/warehouse/…` **Deleting a warehouse also removes all stock information for that warehouse from all items.** This cannot be undone. **Updates replace the whole object** — fields omitted from an update (e.g. `external_id`, `public_in_store`) are cleared, not preserved. `admin_label` and `public_name` are required on every update. - **Page size** — default **100**, maximum **500** - **Sort fields** — `id`, `admin_label`, `external_id` **Warehouse object** | Field | Required | Description | |---|---|---| | id | Read-only | Shopamine's ID number for this warehouse. | | admin_label | Required | Warehouse label. | | public_name | Every write | Name displayed on the storefront. Required on every create *and* update. | | external_id | Optional | External reference id. | | physical_store | Optional | Nested [physical store](https://misc.shopamine.com/restapi/#physical_store) object. Sending it on warehouse create/update creates or fully updates the physical store itself, matched by id. | | public_in_store | Optional | Store pickup. | *warehouse.json* ```json { "admin_label": "Skladišče v trgovini: Testna trgovina", "external_id": null, "public_name": { "__": "Testna trgovina" }, "physical_store": { "id": 1, "admin_label": "Testna trgovina", "external_id": "1-trgovina", "public_name": { "__": "Testna trgovina" }, "opened": "2023-12-03T07:15:00Z", "closed": "2023-12-03T07:15:00Z", "address": { "city": "Medvode", "company": "Firma d.o.o.", "line1": "Ulica bratov Novak 12", "line2": "4. nadstropje", "postCode": "1215" }, "latitude": 34.43444, "longitude": 45.23234, "order_weight": 2, "node_id": null }, "public_in_store": null } ... //minimal { "admin_label": "Skladišče 1", "public_name": { "__": "Skladišče 1" } } ``` ## Examples ### List warehouse `GET /warehouse/list` The response is an object with a single `data` array. **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/warehouse/list?limit=20&offset=0' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/warehouse/list?limit=20&offset=0", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "data": [ { "id": 1, "admin_label": "Example Warehouse", "public_name": { "__": "Example Warehouse" }, "external_id": "docs-example-wh1", "public_in_store": null } ] } ``` ### Retrieve one `GET /warehouse/1` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/warehouse/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/warehouse/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 1, "admin_label": "Example Warehouse", "public_name": { "__": "Example Warehouse" }, "external_id": "docs-example-wh1", "public_in_store": null } ``` ### Create `POST /warehouse/create` **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/warehouse/create' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "external_id": "WH-01", "admin_label": "Example Warehouse", "public_name": { "__": "Example Warehouse" } }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/warehouse/create", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "external_id": "WH-01", "admin_label": "Example Warehouse", "public_name": { "__": "Example Warehouse" } }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 7, "admin_label": "Example Warehouse", "public_name": { "__": "Example Warehouse" }, "external_id": "docs-example-warehouses-tmp", "public_in_store": null } ``` ### Update `POST /warehouse/1` Updates merge: fields absent from the request are left untouched. Send an explicit `null` to clear a field. **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/warehouse/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "admin_label": "Main warehouse", "public_name": { "__": "Example Warehouse" } }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/warehouse/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "admin_label": "Main warehouse", "public_name": { "__": "Example Warehouse" } }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 7, "admin_label": "Main warehouse", "public_name": { "__": "Example Warehouse" }, "external_id": null, "public_in_store": null } ``` ### Delete `DELETE /warehouse/1` Clients that cannot send DELETE may use `POST /warehouse/{id}?method=delete`. **curl** ```bash curl -X DELETE \ 'https://api.shopamine.com/www.example.com/api/v1/warehouse/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.delete( "https://api.shopamine.com/www.example.com/api/v1/warehouse/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "status": "ok" } ``` --- Source: [https://misc.shopamine.com/restapi/#warehauses](https://misc.shopamine.com/restapi/#warehauses) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — Promotions Promotional campaigns and their coupon codes. Dates are date-only; discount_rate is a 0-1 fraction. **promotions** - **Path:** `[URL_BASE]/promotions/` - **Scope:** `settings` — a request without it returns `403 You need scope "settings"` - **Operations:** `list`, `get`, `create`, `update`, `delete` **promotion coupons** - **Path:** `[URL_BASE]/promotions/[promotion_id]/coupons/` - **Scope:** `settings` — a request without it returns `403 You need scope "settings"` - **Operations:** `sub_list`, `sub_get`, `sub_create`, `sub_update`, `sub_delete` **Standard operations — promotions** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/promotions/list` | List, paginated | | `GET` | `[URL_BASE]/promotions/[id]` | Retrieve one | | `POST` | `[URL_BASE]/promotions/create` | Create | | `POST` | `[URL_BASE]/promotions/[id]` | Update (merge: absent fields untouched, explicit null clears) | | `DELETE` | `[URL_BASE]/promotions/[id]` | Delete | **Standard operations — promotion coupons** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/promotions/[promotion_id]/coupons/list` | List, paginated | | `GET` | `[URL_BASE]/promotions/[promotion_id]/coupons/[id]` | Retrieve one | | `POST` | `[URL_BASE]/promotions/[promotion_id]/coupons/create` | Create | | `POST` | `[URL_BASE]/promotions/[promotion_id]/coupons/[id]` | Update (merge) | | `DELETE` | `[URL_BASE]/promotions/[promotion_id]/coupons/[id]` | Delete | **Base path:** `[URL_BASE]/promotions/…` **Updates replace the whole object.** `promotion_name`, `active_from`, `active_until`, `promotion_type` and `promotion_config` must *all* be present on every update. For promotions of type `SIMPLE_COUPON`, `coupon_code` must equal `promotion_name` or the request is rejected. - **Page size** — default **100**, maximum **500** - **Sort fields** — `name`, `date_created`, `active_from` **Promotion object** | Field | Required | Description | |---|---|---| | promotion_id | Required | Shopamine's ID number for this promotion. | | promotion_name | Required | Name of the promotion. | | active_from | Required | Start of the promotion's active timeframe. | | active_until | Required | End of the promotion's active timeframe. | | promotion_type | Required | Only `GENERAL_DISCOUNT` should be used — the others are legacy. | | promotion_config | Required | What the user gets when this promotion applies. For `GENERAL_DISCOUNT` promotions this object can carry `discount_target`, `discount_calculation`, `discount_rate`, `discount_amount` (fixed amount), `internal_discount_composition`, `max_composite_discount`, `target_items_condition` (a condition object limiting which items are discounted), `target_items_max`, `target_items_subset`, `volume_group_by` and `volume_tiers` (a list of `{ "min_quantity": …, "discounted_count": … }` entries for volume promotions). | | times_usable | Optional | Number of times this promotion can apply. | | times_used | Read-only | How many times this promotion has been used so far. | | uses_personal_coupons | Optional | Indicates that coupons are in use. | | coupon_code | Optional | Top-level coupon code, when the promotion is coupon-based. | | single_use_per_user | Optional | When true, each user can use the promotion only once, whether or not it uses coupons. Must be a boolean; any other value is refused with `400`. | | guest_single_use_handling | Optional | How the single-use rule is enforced for guests (buyers who are not logged in): `GUEST_REQUIRE_LOGIN` (the default, guests do not get the promotion and must log in) or `GUEST_CHECK_BY_EMAIL` (the email entered at checkout identifies the buyer; once a customer with that email has used the promotion, it no longer applies). Any other value is refused with `400`. | | validity_condition | Optional | Condition under which this promotion applies. See the sample object. | | date_created | Read-only | | | date_updated | Read-only | | *promotions.json* ```json { promotion_id: 1, promotion_name: 'Test', active_from: '2025-02-06', active_until: '2025-02-28', uses_personal_coupons: false, times_used: 0, // read only coupon_code: 'PROMO10', // optional, coupon-based promotions single_use_per_user: false, // optional guest_single_use_handling: '...', // optional validity_condition: { condition_type: 'USER_LOGGED_IN' }, promotion_type: 'GENERAL_DISCOUNT', promotion_config: { discount_target: 'BASKET', is_exclusive: false, discount_calculation: 'PERCENT', discount_rate: 0.05, internal_discount_composition: 'HIGHEST_DISCOUNT', max_composite_discount: 0 // GENERAL_DISCOUNT may also carry: discount_amount (fixed amount), // target_items_condition {...}, target_items_max, target_items_subset, // volume_group_by, volume_tiers: [ { min_quantity: ..., discounted_count: ... } ] }, date_created: '2025-02-06T14:25:16Z', date_updated: '2025-02-06T14:26:23Z' } ``` Promotions ## Coupons | Method | Endpoint | Description | |---|---|---| | `GET` | `[URL_BASE]/promotions/{promotion_id}/coupons/list` | Retrieves the list of coupons. See also [list parameters](https://misc.shopamine.com/restapi/#list_params). | | `POST` | `[URL_BASE]/promotions/{promotion_id}/coupons/create` | Creates a new coupon. | | `POST` | `[URL_BASE]/promotions/{promotion_id}/coupons/createUpdateBulk` | Body `{ "data": [...] }`. Entries with a `coupon_id` update that coupon; entries without one create new coupons. | | `DELETE` | `[URL_BASE]/promotions/{promotion_id}/coupons/deleteAll` | Removes all coupons of this promotion. | | `GET, POST, DELETE` | `[URL_BASE]/promotions/{promotion_id}/coupons/{coupon_id}` | Retrieve, update or delete one coupon. | - **Page size** — default **100**, maximum **500** **Coupon object** | Field | Required | Description | |---|---|---| | coupon_id | Read-only | Shopamine's ID number for this coupon. | | promotion_id | Read-only | Connected promotion id. | | coupon_code | Required | Coupon code. A new or changed code must be at least 6 characters long after trimming spaces, otherwise the request is refused with `400` (in a bulk request nothing is saved). Saving a coupon without changing its code still works when that existing code is shorter. | | max_uses | Optional | Number of times the coupon can be used. | | user_email | Optional | Email to limit coupon use to. | | active_from | Optional | Start of the coupon's active timeframe. | | active_until | Optional | End of the coupon's active timeframe. | | times_used | Read-only | | | date_created | Read-only | | | date_updated | Read-only | | *promotion_coupons.json* ```json { coupon_id: 1, promotion_id: 1, coupon_code: 'super-discount', times_used: 0, max_uses: 1, active_from: '2025-02-06', active_until: '2025-02-20', user_email: 'test@hribar.eu', date_created: '2025-01-29T15:18:32Z', date_updated: '2025-02-06T13:59:58Z' } ``` ## Examples ### List promotions `GET /promotions/list` The response is an object with a single `data` array. **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/promotions/list?limit=20&offset=0' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/promotions/list?limit=20&offset=0", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response (1 of 18 entries shown)** ```json { "data": [ { "promotion_id": 1, "promotion_name": "TEST", "active_from": "2023-12-18", "active_until": "2023-12-31", "times_used": 1, "category_node_id": 83, "coupon_code": "TEST", "promotion_type": "SIMPLE_COUPON", "promotion_config": { "discount_rate": 0.15, "include_base_discount": true, "max_composite_discount": 0.15, "apply_to_items": true, "apply_to_shipping": false, "is_fixed_amount": false, "fixed_amount": 0 }, "date_created": "2023-12-19T06:22:49Z", "date_updated": "2023-12-19T08:14:02Z" } ] } ``` ### Retrieve one `GET /promotions/1` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/promotions/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/promotions/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "promotion_id": 1, "promotion_name": "TEST", "active_from": "2023-12-18", "active_until": "2023-12-31", "times_used": 1, "category_node_id": 83, "coupon_code": "TEST", "promotion_type": "SIMPLE_COUPON", "promotion_config": { "discount_rate": 0.15, "include_base_discount": true, "max_composite_discount": 0.15, "apply_to_items": true, "apply_to_shipping": false, "is_fixed_amount": false, "fixed_amount": 0 }, "date_created": "2023-12-19T06:22:49Z", "date_updated": "2023-12-19T08:14:02Z" } ``` ### Create `POST /promotions/create` **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/promotions/create' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "external_id": "PROMO-01", "promotion_name": "PROMO-01", "active_from": "2026-01-01", "active_until": "2030-01-01", "promotion_type": "GENERAL_DISCOUNT", "promotion_config": { "discount_target": "ITEMS", "discount_calculation": "PERCENT", "discount_rate": 0.1 } }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/promotions/create", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "external_id": "PROMO-01", "promotion_name": "PROMO-01", "active_from": "2026-01-01", "active_until": "2030-01-01", "promotion_type": "GENERAL_DISCOUNT", "promotion_config": { "discount_target": "ITEMS", "discount_calculation": "PERCENT", "discount_rate": 0.1 } }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "promotion_id": 30, "promotion_name": "docs-example-promotions-tmp", "active_from": "2026-01-01", "active_until": "2030-01-01", "times_used": 0, "promotion_type": "GENERAL_DISCOUNT", "promotion_config": { "discount_target": "ITEMS", "discount_calculation": "PERCENT", "discount_rate": 0.1 }, "date_created": "2026-08-16T12:09:26Z", "date_updated": "2026-08-16T12:09:26Z" } ``` ### Update `POST /promotions/1` Updates merge: fields absent from the request are left untouched. Send an explicit `null` to clear a field. **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/promotions/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "promotion_name": "PROMO-01", "active_from": "2026-01-01", "active_until": "2030-01-01", "promotion_type": "GENERAL_DISCOUNT", "promotion_config": { "discount_target": "ITEMS", "discount_calculation": "PERCENT", "discount_rate": 0.15 } }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/promotions/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "promotion_name": "PROMO-01", "active_from": "2026-01-01", "active_until": "2030-01-01", "promotion_type": "GENERAL_DISCOUNT", "promotion_config": { "discount_target": "ITEMS", "discount_calculation": "PERCENT", "discount_rate": 0.15 } }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "promotion_id": 30, "promotion_name": "PROMO-01", "active_from": "2026-01-01", "active_until": "2030-01-01", "times_used": 0, "promotion_type": "GENERAL_DISCOUNT", "promotion_config": { "discount_target": "ITEMS", "discount_calculation": "PERCENT", "discount_rate": 0.15 }, "date_created": "2026-08-16T12:09:26Z", "date_updated": "2026-08-16T12:09:26Z" } ``` ### Delete `DELETE /promotions/1` Clients that cannot send DELETE may use `POST /promotions/{id}?method=delete`. **curl** ```bash curl -X DELETE \ 'https://api.shopamine.com/www.example.com/api/v1/promotions/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.delete( "https://api.shopamine.com/www.example.com/api/v1/promotions/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "status": "ok" } ``` ### List coupons `GET /promotions/24/coupons/list` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/promotions/24/coupons/list?limit=20&offset=0' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/promotions/24/coupons/list?limit=20&offset=0", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "data": [ { "coupon_id": 113, "promotion_id": 24, "coupon_code": "DOCS-EXAMPLE-10", "times_used": 0, "date_created": "2026-08-15T19:26:03Z", "date_updated": "2026-08-15T19:26:03Z" } ] } ``` ### Retrieve one `GET /promotions/24/coupons/113` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/promotions/24/coupons/113' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/promotions/24/coupons/113", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "coupon_id": 113, "promotion_id": 24, "coupon_code": "DOCS-EXAMPLE-10", "times_used": 0, "date_created": "2026-08-15T19:26:03Z", "date_updated": "2026-08-15T19:26:03Z" } ``` ### Create `POST /promotions/24/coupons/create` **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/promotions/24/coupons/create' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "coupon_code": "DOCS-EXAMPLE-10" }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/promotions/24/coupons/create", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "coupon_code": "DOCS-EXAMPLE-10" }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "coupon_id": 119, "promotion_id": 24, "coupon_code": "docs-example-promotion_coupons-tmp", "times_used": 0, "date_created": "2026-08-16T12:09:25Z", "date_updated": "2026-08-16T12:09:25Z" } ``` ### Update `POST /promotions/24/coupons/113` Updates merge: fields absent from the request are left untouched. **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/promotions/24/coupons/113' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "coupon_code": "DOCS-EXAMPLE-20" }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/promotions/24/coupons/113", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "coupon_code": "DOCS-EXAMPLE-20" }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "coupon_id": 119, "promotion_id": 24, "coupon_code": "DOCS-EXAMPLE-20", "times_used": 0, "date_created": "2026-08-16T12:09:25Z", "date_updated": "2026-08-16T12:09:25Z" } ``` ### Delete `DELETE /promotions/24/coupons/113` **curl** ```bash curl -X DELETE \ 'https://api.shopamine.com/www.example.com/api/v1/promotions/24/coupons/113' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.delete( "https://api.shopamine.com/www.example.com/api/v1/promotions/24/coupons/113", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` --- Source: [https://misc.shopamine.com/restapi/#promotions](https://misc.shopamine.com/restapi/#promotions) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — Timed discounts Time-boxed discounts. Uses ISO datetimes, unlike promotions. **timed discounts** - **Path:** `[URL_BASE]/timed_discounts/` - **Scope:** `settings` — a request without it returns `403 You need scope "settings"` - **Operations:** `list`, `get`, `create`, `update`, `delete` **Standard operations — timed discounts** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/timed_discounts/list` | List, paginated | | `GET` | `[URL_BASE]/timed_discounts/[id]` | Retrieve one | | `POST` | `[URL_BASE]/timed_discounts/create` | Create | | `POST` | `[URL_BASE]/timed_discounts/[id]` | Update (merge: absent fields untouched, explicit null clears) | | `DELETE` | `[URL_BASE]/timed_discounts/[id]` | Delete | **Base path:** `[URL_BASE]/timed_discounts/…` Time-limited price adjustments that automatically apply to matching items during a defined window. Unlike promotions, they are applied at the **item price level** rather than at the basket level. | Method | Endpoint | Description | |---|---|---| | `GET` | `[URL_BASE]/timed_discounts/list` | Retrieves the list of timed discounts. | | `POST` | `[URL_BASE]/timed_discounts/create` | Creates a new timed discount. | | `GET, POST, DELETE` | `[URL_BASE]/timed_discounts/{timed_discount_id}` | Retrieve, update or delete one timed discount. | | `POST` | `[URL_BASE]/timed_discounts/{timed_discount_id}/pause` | Pauses a timed discount — sets status to `PAUSED`. | | `POST` | `[URL_BASE]/timed_discounts/{timed_discount_id}/unpause` | Resumes a paused timed discount — sets status to `ACTIVE`. | - **Page size** — default **100**, maximum **500** - **Sort fields** — `start_at`, `end_at`, `status`, `date_created` ### Fields **Timed discount object** | Field | Required | Description | |---|---|---| | timed_discount_id | Read-only | Shopamine's ID number for this timed discount. | | name | On create | [Localized](https://misc.shopamine.com/restapi/#local_strings) name of the timed discount. | | start_at | On create | Start of the active time window (ISO 8601 datetime). | | end_at | On create | End of the active time window (ISO 8601 datetime). | | status | Optional | `ACTIVE` or `PAUSED`. Defaults to `ACTIVE` on create. | | paused | Optional | Boolean shorthand for status. `true` = PAUSED, `false` = ACTIVE. Takes precedence over `status` if both are provided. | | user_condition | Optional | Filters which users the discount applies to. Uses the same condition structure as promotions. | | item_condition | Optional | Filters which items the discount applies to. Uses the same condition structure as promotions. | | discount_config | Required | How the discount is calculated. See below. | | date_created | Read-only | | | date_updated | Read-only | | ### Discount config | Field | Description | |---|---| | store_price_fields | Which store price and discount fields to use. Contains `price_field` (integer) and `discount_field` (integer). | | supplier_config | Supplier/B2B pricing configuration: `price_calculation_mode` (`DISCOUNT`, `MARKUP` or `FIXED`), `price_adjustment_mode` (`PERCENT` or `VALUE`), `percentage_adjustment` (decimal 0–1), `fixed_value_adjustment`, `fixed_selling_price` and `list_price`. `list_price` is deprecated: it is accepted and returned but ignored, and changes no price. | | skin_stickers | Array of UI sticker/badge configurations. Each entry contains `skin_id` and `sticker_index`. | *timed_discounts.json* ```json { timed_discount_id: 1, name: { '__': 'Summer Sale', 'en': 'Summer Sale', 'sl': 'Poletna razprodaja' }, start_at: '2025-06-01T00:00:00Z', end_at: '2025-08-31T23:59:59Z', status: 'ACTIVE', paused: false, user_condition: { condition_type: 'USER_LOGGED_IN' }, item_condition: { condition_type: 'ITEM_CATEGORY_ONE_OF', ids: [12, 45, 78] }, discount_config: { store_price_fields: { price_field: 1, discount_field: 1 }, supplier_config: { price_calculation_mode: 'DISCOUNT', price_adjustment_mode: 'PERCENT', percentage_adjustment: 0.15 }, skin_stickers: [ { skin_id: 1, sticker_index: 2 } ] }, date_created: '2025-05-01T10:00:00Z', date_updated: '2025-05-15T14:30:00Z' } ``` ## Examples ### List timed_discounts `GET /timed_discounts/list` The response is an object with a single `data` array. **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/timed_discounts/list?limit=20&offset=0' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/timed_discounts/list?limit=20&offset=0", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "data": [ { "timed_discount_id": 1, "name": { "__": "Example Timed Discount" }, "start_at": "2026-01-01T00:00:00Z", "end_at": "2030-01-01T00:00:00Z", "status": "ACTIVE", "paused": false, "discount_config": { "store_price_fields": { "price_field": 1, "discount_field": 1 } }, "date_created": "2026-08-15T19:25:20Z", "date_updated": "2026-08-15T19:25:20Z" } ] } ``` ### Retrieve one `GET /timed_discounts/1` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/timed_discounts/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/timed_discounts/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "timed_discount_id": 1, "name": { "__": "Example Timed Discount" }, "start_at": "2026-01-01T00:00:00Z", "end_at": "2030-01-01T00:00:00Z", "status": "ACTIVE", "paused": false, "discount_config": { "store_price_fields": { "price_field": 1, "discount_field": 1 } }, "date_created": "2026-08-15T19:25:20Z", "date_updated": "2026-08-15T19:25:20Z" } ``` ### Create `POST /timed_discounts/create` **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/timed_discounts/create' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "external_id": "TD-01", "admin_label": "Example Timed Discount", "name": { "__": "Example Timed Discount" }, "start_at": "2026-01-01T00:00:00Z", "end_at": "2030-01-01T00:00:00Z", "discount_config": { "store_price_fields": { "price_field": 1, "discount_field": 1 } } }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/timed_discounts/create", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "external_id": "TD-01", "admin_label": "Example Timed Discount", "name": { "__": "Example Timed Discount" }, "start_at": "2026-01-01T00:00:00Z", "end_at": "2030-01-01T00:00:00Z", "discount_config": { "store_price_fields": { "price_field": 1, "discount_field": 1 } } }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "timed_discount_id": 6, "name": { "__": "Example Timed Discount" }, "start_at": "2026-01-01T00:00:00Z", "end_at": "2030-01-01T00:00:00Z", "status": "ACTIVE", "paused": false, "discount_config": { "store_price_fields": { "price_field": 1, "discount_field": 1 } }, "date_created": "2026-08-16T12:09:29Z", "date_updated": "2026-08-16T12:09:29Z" } ``` ### Update `POST /timed_discounts/1` Updates merge: fields absent from the request are left untouched. Send an explicit `null` to clear a field. **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/timed_discounts/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "paused": true }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/timed_discounts/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "paused": true }, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "timed_discount_id": 6, "name": { "__": "Example Timed Discount" }, "start_at": "2026-01-01T00:00:00Z", "end_at": "2030-01-01T00:00:00Z", "status": "PAUSED", "paused": true, "discount_config": { "store_price_fields": { "price_field": 1, "discount_field": 1 } }, "date_created": "2026-08-16T12:09:29Z", "date_updated": "2026-08-16T12:09:29Z" } ``` ### Delete `DELETE /timed_discounts/1` Clients that cannot send DELETE may use `POST /timed_discounts/{id}?method=delete`. **curl** ```bash curl -X DELETE \ 'https://api.shopamine.com/www.example.com/api/v1/timed_discounts/1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.delete( "https://api.shopamine.com/www.example.com/api/v1/timed_discounts/1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "status": "ok" } ``` --- Source: [https://misc.shopamine.com/restapi/#timed_discounts](https://misc.shopamine.com/restapi/#timed_discounts) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — Payment options Configured payment methods. Read-only over the API. **payment options** - **Path:** `[URL_BASE]/payment_options/` - **Scope:** `settings` — a request without it returns `403 You need scope "settings"` - **Operations:** `list`, `get` **Standard operations — payment options** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/payment_options/list` | List, paginated | | `GET` | `[URL_BASE]/payment_options/[id]` | Retrieve one | **Base path:** `[URL_BASE]/payment_options/…` **Read only.** `create`, update and delete requests answer with `405`. The `createUpdateBulk` path exists but is not implemented and answers with an error. A token with the `settings` scope is required. | Method | Endpoint | Description | |---|---|---| | `GET` | `[URL_BASE]/payment_options/list` | Retrieves the list of payment options. | | `GET` | `[URL_BASE]/payment_options/{payment_option_id}` | Retrieves data for one payment option. | - **Page size** — default **100**, maximum **500** - **Sort fields** — `id`, `name`, `type` - **startId / endId** — No effect here — use `limit` and `offset`. **Payment option object** | Field | Description | |---|---| | id | Shopamine's ID number for this payment option. | | type | The kind of payment option — one of the values listed below. | | name | The name of this payment option, as a [localized string](https://misc.shopamine.com/restapi/#local_strings). | ### Payment option types `adyen`, `bank_koper`, `bank_koper_v2`, `bankart`, `bankart_v3`, `braintree`, `braintree_local_payment`, `corvus_pay`, `leanpay`, `megapos`, `paypal`, `paypal_wp_standard`, `stripe`, `tmobile`, `ujp`, `valu_moneta`, `unhandled`. *payment_options.json* ```json { "id": 3, "type": "bank_koper_v2", "name": { "__": "Credit card", "sl": "Kreditna kartica" } } ``` ## Examples ### List payment_options `GET /payment_options/list` The response is an object with a single `data` array. **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/payment_options/list?limit=20&offset=0' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/payment_options/list?limit=20&offset=0", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response (1 of 4 entries shown)** ```json { "data": [ { "id": 17, "type": "unhandled", "name": { "__": "Bank transfer" } } ] } ``` ### Retrieve one `GET /payment_options/17` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/payment_options/17' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/payment_options/17", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 17, "type": "unhandled", "name": { "__": "Bank transfer" } } ``` --- Source: [https://misc.shopamine.com/restapi/#payment_options](https://misc.shopamine.com/restapi/#payment_options) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — Shipping options Configured delivery methods. Read-only over the API. **shipping options** - **Path:** `[URL_BASE]/shipping_options/` - **Scope:** `settings` — a request without it returns `403 You need scope "settings"` - **Operations:** `list`, `get` **Standard operations — shipping options** | Method | Path | Operation | |---|---|---| | `GET` | `[URL_BASE]/shipping_options/list` | List, paginated | | `GET` | `[URL_BASE]/shipping_options/[id]` | Retrieve one | **Base path:** `[URL_BASE]/shipping_options/…` **Read only**, like payment options: `create`, update and delete answer with `405`, and `createUpdateBulk` is not implemented. A token with the `settings` scope is required. | Method | Endpoint | Description | |---|---|---| | `GET` | `[URL_BASE]/shipping_options/list` | Retrieves the list of shipping options. | | `GET` | `[URL_BASE]/shipping_options/{shipping_option_id}` | Retrieves data for one shipping option. | - **Page size** — default **100**, maximum **500** - **Sort fields** — `id`, `name`, `type` - **startId / endId** — No effect here — use `limit` and `offset`. **Shipping option object** | Field | Required | Description | |---|---|---| | id | Read-only | Shopamine's ID number for this shipping option. | | type | Read-only | The kind of shipping option — one of the values listed below. | | name | Read-only | The name shown to shoppers, as a [localized string](https://misc.shopamine.com/restapi/#local_strings). | | label | Read-only | The internal label used in the administration. May be `null` when none is set. | | active | Read-only | `false` when the shipping option is switched off in the administration. | | skip_address | Read-only | `true` when this option needs no delivery address — for example in-store pick-up. | | order_weight | Read-only | The rank by which shipping options are ordered in the shop; lower comes first. | ### Shipping option types `flat_rate`, `free`, `international`, `item_number_based`, `price_based`, `simple`, `weight_based`. *shipping_options.json* ```json { "id": 1, "type": "simple", "name": { "__": "Standard shipping", "sl": "Standardna dostava" }, "label": "Standard shipping", "active": true, "skip_address": false, "order_weight": 1 } ... //a second option: in-store pick-up, currently switched off { "id": 2, "type": "free", "name": { "__": "In-store pick-up" }, "label": null, "active": false, "skip_address": true, "order_weight": 2 } ``` ## Examples ### List shipping_options `GET /shipping_options/list` The response is an object with a single `data` array. **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/shipping_options/list?limit=20&offset=0' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/shipping_options/list?limit=20&offset=0", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response (1 of 5 entries shown)** ```json { "data": [ { "id": 4, "type": "simple", "name": { "__": "GLS" }, "label": "Sam day delivery", "active": true, "skip_address": false, "order_weight": 0 } ] } ``` ### Retrieve one `GET /shipping_options/4` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/shipping_options/4' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/shipping_options/4", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "id": 4, "type": "simple", "name": { "__": "GLS" }, "label": "Sam day delivery", "active": true, "skip_address": false, "order_weight": 0 } ``` --- Source: [https://misc.shopamine.com/restapi/#shipping_options](https://misc.shopamine.com/restapi/#shipping_options) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — Tax rates mapping Territory-to-tax-rate lookup helper. **tax rates mapping** - **Path:** `[URL_BASE]/misc/tax_rates_mapping/` - **Scope:** `settings` — a request without it returns `403 You need scope "settings"` **Base path:** `[URL_BASE]/misc/tax_rates_mapping` A helper endpoint for synchronisation tools that know a product's *tax rate* but not which Shopamine [tax class](https://misc.shopamine.com/restapi/#tax_classes) to put it in. It answers with the rate-to-tax-class mapping derived from the shop's active tax zones and rates. This is **not a standard entity**: there is no `list` path and no pagination — the endpoint returns a single object with one field, `rates`. `GET` is the only allowed method (anything else answers `405`) and a token with the `settings` scope is required. **Response object** | Field | Description | |---|---| | rates | Array of mapping entries, ordered from the lowest tax rate upwards. Empty when the shop has no active tax rates. | | rates[].max | Upper bound of this entry as a decimal rate — `0.22` means 22%. Use the first entry whose `max` is greater than or equal to your tax rate. The bounds sit halfway between two configured tax rates, so a rate that is slightly off still maps to the nearest tax class. The last entry always has `max` = `1` and acts as the catch-all. | | rates[].tax_class_id | The [tax class](https://misc.shopamine.com/restapi/#tax_classes) ID to use for rates falling into this entry. | *tax_rates_mapping.json* ```json ... //a shop with tax rates 5%, 9.5% and 22% mapped to tax classes 3, 2 and 1 { "rates": [ { "max": 0.0725, "tax_class_id": 3 }, { "max": 0.1575, "tax_class_id": 2 }, { "max": 1, "tax_class_id": 1 } ] } ... //a shop with a single tax rate { "rates": [ { "max": 1, "tax_class_id": 1 } ] } ``` ## Examples ### Retrieve the rate-to-tax-class mapping `GET /misc/tax_rates_mapping` Not a standard entity: no list path and no pagination. Returns a single object with one field, `rates`. GET is the only method allowed — anything else answers `405`. **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/misc/tax_rates_mapping' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/misc/tax_rates_mapping", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` **Response** ```json { "rates": [ { "max": 0.0475, "tax_class_id": 3 }, { "max": 0.1575, "tax_class_id": 2 }, { "max": 1, "tax_class_id": 1 } ] } ``` --- Source: [https://misc.shopamine.com/restapi/#tax_rates_mapping](https://misc.shopamine.com/restapi/#tax_rates_mapping) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — Affiliates Affiliate payouts and clawbacks. Requires the `enablePublicApi` flag. **affiliates** - **Path:** `[URL_BASE]/affiliates/payouts/` - **Scope:** `settings` — a request without it returns `403 You need scope "settings"` **affiliates** - **Path:** `[URL_BASE]/affiliates/clawbacks/` - **Scope:** `settings` — a request without it returns `403 You need scope "settings"` **Base path:** `[URL_BASE]/affiliates/…` Payout and clawback bookkeeping for the affiliate program. A token with the `settings` scope is required. **Must be enabled first.** These endpoints sit behind a public-API switch in the shop's affiliate program settings. While it is off, every call answers with `403` and `Affiliate public API is not enabled.` Contact [support@shopamine.com](mailto:support@shopamine.com) to have it enabled. **These endpoints do not follow the conventions used everywhere else.** Lists answer with a bare JSON array instead of an object with a `data` field; they support no pagination and no sorting (every matching row is returned); field names are `camelCase`; amounts are integer **micros** (1 EUR = `1000000`) instead of decimals; and all dates are integer **milliseconds since the Unix epoch** instead of [ISO 8601](https://misc.shopamine.com/restapi/#other_types) strings. Fields without a value are left out of the response entirely. Affiliates ## Payouts | Method | Endpoint | Description | |---|---|---| | `GET` | `[URL_BASE]/affiliates/payouts` | Retrieves payouts as a JSON array. Optional filters: `?affiliateId=[id]` and `?status=[status]` — case-sensitive, must be one of the status values below. | | `POST` | `[URL_BASE]/affiliates/payouts` | Creates a payout, answering `201` with the created payout. Required: `affiliateId`, `amount`, `currency`, `periodStart`, `periodEnd`; optional: `paymentReference`, `notes`. Status is always `PENDING` on create. An unknown `affiliateId` answers `404`. | | `PATCH` | `[URL_BASE]/affiliates/payouts/{payout_id}` | Updates a payout. Only `status`, `paymentReference` and `notes` are read from the body; any other field is ignored. An unknown ID answers `404`. | **Payout object** | Field | Required | Description | |---|---|---| | id | Read-only | Shopamine's ID number for this payout. | | affiliateId | On create | The affiliate this payout belongs to. | | affiliateName | Read-only | Name of the affiliate's user account. | | amount | On create | The payout amount in micros — 12.50 is sent as `12500000`. | | currency | On create | Currency of the amount, for example `EUR`. | | status | Read-only | One of `PENDING`, `PROCESSING`, `COMPLETED`, `FAILED`, `CANCELLED`. Always `PENDING` after create; changed with `PATCH`. | | periodStart | On create | Start of the period this payout covers, in ms since the Unix epoch. | | periodEnd | On create | End of the period this payout covers, in ms since the Unix epoch. | | paidDate | Read-only | When the payout was paid out, in ms since the Unix epoch. | | paymentReference | Optional | Your reference for the transfer, for example a bank transaction ID. | | payoutMethod | Read-only | One of `BANK_TRANSFER`, `PAYPAL`, `STORE_CREDIT`, `CHECK`, `OTHER`. Cannot be set through this API. | | details | Read-only | Method-specific details object. Cannot be set through this API. | | notes | Optional | Free-text note. | | processedBy | Read-only | ID of the administrator who processed the payout, when it was processed in the administration. | | tcreated / tupdated | Read-only | Creation and last-change time, in ms since the Unix epoch. | Affiliates ## Clawbacks A clawback reverses a commission that should not have been earned. Creating one marks the original commission as clawed back, books a negative adjustment commission for the same amount, and returns the resulting audit record. | Method | Endpoint | Description | |---|---|---| | `GET` | `[URL_BASE]/affiliates/clawbacks` | Retrieves clawbacks as a JSON array. Optional filter: `?affiliateId=[id]`. | | `POST` | `[URL_BASE]/affiliates/clawbacks` | Creates a clawback, answering `201` with the created record. Required: `commissionId` and `reason`; optional: `notes`. | Only commissions whose status is `PENDING`, `APPROVED` or `PAID` can be clawed back — anything else is rejected with a message naming the current status. Creating clawbacks additionally requires the clawbacks feature to be switched on for the shop; otherwise the answer is `403` and `Clawbacks are not enabled.` **Clawback object** | Field | Required | Description | |---|---|---| | id | Read-only | Shopamine's ID number for this clawback. | | affiliateId | Read-only | The affiliate whose commission was clawed back. Taken from the original commission. | | commissionId | On create | Body field only: the commission to claw back. Not part of the response — see `originalCommissionId`. | | originalCommissionId | Read-only | The commission that was clawed back. Its status becomes `CLAWED_BACK`. | | adjustmentCommissionId | Read-only | The negative adjustment commission booked by this clawback. | | amount | Read-only | The reversed amount in micros — always negative. | | reason | On create | One of `ORDER_REFUNDED`, `ORDER_CANCELLED`, `CHARGEBACK`, `FRAUD`, `MANUAL_ADJUSTMENT`. | | purchaseId | Read-only | The [purchase](https://misc.shopamine.com/restapi/#purchases) the original commission was earned on, when it has one. | | notes | Optional | Free-text note. Stored both on the clawback and on the adjustment commission. | | processedBy | Read-only | ID of the administrator who processed the clawback. Clawbacks created through this API carry `0`. | | tcreated | Read-only | Creation time, in ms since the Unix epoch. | *affiliates.json* ```json ... //GET [URL_BASE]/affiliates/payouts [ { "id": 12, "affiliateId": 4, "affiliateName": "Ana Novak", "amount": 125500000, "currency": "EUR", "status": "PENDING", "periodStart": 1751328000000, "periodEnd": 1753920000000, "paymentReference": "SEPA-2026-07-04", "payoutMethod": "BANK_TRANSFER", "notes": "July payout", "tcreated": 1754006400000, "tupdated": 1754006400000 } ] ... //POST [URL_BASE]/affiliates/payouts - request body { "affiliateId": 4, "amount": 125500000, "currency": "EUR", "periodStart": 1751328000000, "periodEnd": 1753920000000, "paymentReference": "SEPA-2026-07-04", "notes": "July payout" } ... //GET [URL_BASE]/affiliates/clawbacks [ { "id": 5, "affiliateId": 4, "originalCommissionId": 88, "adjustmentCommissionId": 91, "amount": -18000000, "reason": "ORDER_REFUNDED", "purchaseId": 10432, "notes": "Customer returned the order", "processedBy": 0, "tcreated": 1754092800000 } ] ... //POST [URL_BASE]/affiliates/clawbacks - request body { "commissionId": 88, "reason": "ORDER_REFUNDED", "notes": "Customer returned the order" } ``` ## Examples ### List payouts `GET /affiliates/payouts` Returns a JSON array. `status` is case-sensitive. Requires the `enablePublicApi` flag. **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/affiliates/payouts?affiliateId=1&status=PENDING' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/affiliates/payouts?affiliateId=1&status=PENDING", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` ### Create a payout `POST /affiliates/payouts` Answers `201` with the created payout. **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/affiliates/payouts' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "affiliateId": 1, "amount": 25.0, "currency": "EUR" }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/affiliates/payouts", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "affiliateId": 1, "amount": 25.0, "currency": "EUR" }, timeout=30, ) res.raise_for_status() data = res.json() ``` ### List clawbacks `GET /affiliates/clawbacks` **curl** ```bash curl -X GET \ 'https://api.shopamine.com/www.example.com/api/v1/affiliates/clawbacks?affiliateId=1' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` **Python** ```python import requests res = requests.get( "https://api.shopamine.com/www.example.com/api/v1/affiliates/clawbacks?affiliateId=1", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, timeout=30, ) res.raise_for_status() data = res.json() ``` ### Create a clawback `POST /affiliates/clawbacks` Reverses a commission: marks the original as clawed back, books a negative adjustment for the same amount, and returns the audit record. **curl** ```bash curl -X POST \ 'https://api.shopamine.com/www.example.com/api/v1/affiliates/clawbacks' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "commissionId": 1, "reason": "Order returned" }' ``` **Python** ```python import requests res = requests.post( "https://api.shopamine.com/www.example.com/api/v1/affiliates/clawbacks", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, json={ "commissionId": 1, "reason": "Order returned" }, timeout=30, ) res.raise_for_status() data = res.json() ``` --- Source: [https://misc.shopamine.com/restapi/#affiliates](https://misc.shopamine.com/restapi/#affiliates) · index: [llms.txt](https://misc.shopamine.com/restapi/llms.txt) · generated from the page, never hand-edited. Examples here are curl and Python; the page carries JavaScript, PHP, Java and Windows curl too. # Shopamine REST API v1 — Web hooks Purchase, item, user and purchase-attempt web hooks - Shopamine calls YOUR endpoint. Configured by Shopamine support. **webhooks** - **Path:** `[URL_BASE]/webhooks/` - **Scope:** `settings` — a request without it returns `403 You need scope "settings"` **webhooks** - **Path:** `[URL_BASE]/webhooks/` - **Scope:** `settings` — a request without it returns `403 You need scope "settings"` **webhooks** - **Path:** `[URL_BASE]/webhooks/` - **Scope:** `settings` — a request without it returns `403 You need scope "settings"` **webhooks** - **Path:** `[URL_BASE]/webhooks/` - **Scope:** `settings` — a request without it returns `403 You need scope "settings"` ## Purchase webhook To see this request for your own settings, open the [webhook playground](https://misc.shopamine.com/restapi/playground.html#pg-webhooks) and pick **Purchase (order)** as the entity. ### Purchase ID as a URL query parameter Your endpoint is called with an additional `purchase_id` parameter: *URL* ``` https://www.example.com/your/path?purchase_id=123 ``` ### Entire purchase JSON entity The purchase entity is sent as the POST body to `https://www.example.com/your/path`. ### Firing on a specific status change The call can be restricted to specific purchase statuses and/or payment statuses — when both lists are configured, the hook fires when *either* matches. See the [purchase sample object](https://misc.shopamine.com/restapi/#purchases_sample) for the status fields. Manually re-triggered purchase webhooks carry two extra headers so receivers can tell them apart from automatic calls: | Header | Value | |---|---| | X-Shopamine-Webhook-Trigger | `manual` | | X-Shopamine-Webhook-Event | `create` or `update` — which webhook the manual send stands in for. | A manual send is delivered **only** to the destination URLs configured for that event: a `create` trigger never calls change-webhook URLs, and vice versa. ## Item webhook To see this request for your own settings, open the [webhook playground](https://misc.shopamine.com/restapi/playground.html#pg-webhooks) and pick **Item** as the entity. ### Item ID as a URL query parameter Your endpoint is called with an additional `item_id` parameter: *URL* ``` https://www.example.com/your/path?item_id=123 ``` ### Entire item JSON entity The [item](https://misc.shopamine.com/restapi/#items) entity is sent as the POST body to `https://www.example.com/your/path`. ## User webhook To see this request for your own settings, open the [webhook playground](https://misc.shopamine.com/restapi/playground.html#pg-webhooks) and pick **User** as the entity. ### User ID as a URL query parameter Your endpoint is called with an additional `user_id` parameter: *URL* ``` https://www.example.com/your/path?user_id=123 ``` ### Entire user JSON entity The [user](https://misc.shopamine.com/restapi/#users) entity is sent as the POST body to `https://www.example.com/your/path`. ## Purchase attempt webhook To see this request for your own settings, open the [webhook playground](https://misc.shopamine.com/restapi/playground.html#pg-webhooks) and pick **Purchase attempt (cart)** as the entity. ### Purchase attempt ID as a URL query parameter Your endpoint is called with an additional `purchase_attempt_id` parameter: *URL* ``` https://www.example.com/your/path?purchase_attempt_id=123 ``` ### Entire purchase attempt JSON entity The [purchase attempt](https://misc.shopamine.com/restapi/#purchases_attempts) entity is sent as the POST body to `https://www.example.com/your/path`. ## Examples ### Purchase web hook `POST` Shopamine → your endpoint Shopamine POSTs the entity to the URL you configure. The body is identical to a `GET` of that entity, with no envelope. If the hook is configured without a body it is sent as a `GET` with `?purchase_id=…` instead. Answer `200` once you have stored it: any HTTP answer, even an error status, ends delivery and is not retried. **curl** ```bash # Simulate Shopamine calling your endpoint curl -X POST \ 'https://your-service.example.com/shopamine-hook' \ -H 'Content-Type: application/json' \ -d '{"id":1,"purchase_attempt_id":2,"user_id":2,"shipping_address_id":1,"billing_address_id":1,"date_bought":"2023-12-18T08:55:03Z","domain":"www.example.com","locale":"en","status":"finished","payment_status":"payment_allocated","approval_status":"approved","items":[{"item_id":133,"item_sku":"123SKU123","item_name":"Product 06","quantity":1,"customization":{"values":{},"configuration":{"apply_after_discounts":false}},"price_unconfigured":{"value":5,"currency":"EUR","base":5,"base_with_discounts":5,"base_with_taxes":5},"price_single":{"value":5,"currency":"EUR","base":5,"base_with_discounts":5,"base_with_taxes":5},"price_total":{"value":5,"currency":"EUR","base":5,"base_with_discounts":5,"base_with_taxes":5},"tax_class_id":3,"tax_inclusive":true}],"shipping":{"type":"simple","name":{"__":"Standard shipping"},"shipping_id":1,"cost":{"value":4,"currency":"EUR","base":4,"base_with_discounts":4,"base_with_taxes":4,"taxes_applied":[{"tax_rate_id":1,"base":4,"rate":0,"amount":0}]},"tax_class_id":1,"tax_inclusive":false,"allows_partial_shipping":false},"payment":{"type":"unhandled","name":{"__":"Wire transfer"},"payment_id":1,"cost":{"value":0,"currency":"EUR","base":0,"base_with_discounts":0,"base_with_taxes":0}},"items_total":{"value":5,"currency":"EUR","base":5,"base_with_discounts":5,"base_with_taxes":5},"grand_total":{"value":9,"currency":"EUR","base":9,"base_with_discounts":9,"base_with_taxes":9,"taxes_applied":[{"tax_rate_id":1,"base":4,"rate":0,"amount":0}]},"tax_conf_snapshot":{"zone":{"id":1,"name":"World","order_rank":1},"classes":[{"id":1,"name":"Tax products"},{"id":3,"name":"Tax-exempt products"}],"rates":[{"id":1,"name":{"__":"VAT"},"tax_zone_id":1,"order_weight":1,"values":[{"tax_class_id":1,"rate":0}]}]},"purchase_documents":[]}' ``` **Python** ```python from flask import Flask, request, jsonify app = Flask(__name__) @app.post('/shopamine-hook') def shopamine_hook(): payload = request.get_json() # ... handle the payload ... return '', 200 ``` ### Item web hook `POST` Shopamine → your endpoint Shopamine POSTs the entity to the URL you configure. The body is identical to a `GET` of that entity, with no envelope. If the hook is configured without a body it is sent as a `GET` with `?item_id=…` instead. Answer `200` once you have stored it: any HTTP answer, even an error status, ends delivery and is not retried. **curl** ```bash # Simulate Shopamine calling your endpoint curl -X POST \ 'https://your-service.example.com/shopamine-hook' \ -H 'Content-Type: application/json' \ -d '{"id":127,"type":"physical","name":{"__":"Product 01 M"},"list_desc":{"__":""},"short_desc":{"__":"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas odio nisi, dignissim sed blandit et, sodales luctus diam. Vestibulum pharetra blandit diam. Proin eget ante eu massa sollicitudin cursus a a orci. Aliquam sollicitudin eget mi eget vestibulum. Etiam erat eros, semper sed diam iaculis, sollicitudin porta justo. Phasellus consectetur tempor justo, ac pulvinar tellus tincidunt quis. Nam molestie risus tellus, id imperdiet nibh maximus ac. Proin faucibus aliquet risus eu venenatis. Suspendisse id blandit ex. Nam ultrices justo quis tortor tristique, vel hendrerit ante egestas.
"},"long_desc":{"__":"Vestibulum pharetra blandit diam. Proin eget ante eu massa sollicitudin cursus a a orci. Aliquam sollicitudin eget mi eget vestibulum. Etiam erat eros, semper sed diam iaculis, sollicitudin porta justo. Phasellus consectetur tempor justo, ac pulvinar tellus tincidunt quis. Nam molestie risus tellus, id imperdiet nibh maximus ac. Proin faucibus aliquet risus eu venenatis. Suspendisse id blandit ex. Nam ultrices justo quis tortor tristique, vel hendrerit ante egestas.