# Multi Basket

## List Active Baskets

> This method retrieves a list of all active baskets for the current session.\
> \
> Returns basic information about each basket including the primary key and namespace.\
> This is useful for displaying available baskets to users or for basket management interfaces.\
> \
> \*\*Use Cases:\*\*\
> \* Display user's available baskets\
> \* Basket switching interfaces\
> \* Administrative basket overview

```json
{"openapi":"3.0.3","info":{"title":"Basket API","version":"1.0.0"},"servers":[{"description":"Server base URL for basket operations","url":"https://{commerce_url}/baskets","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce server URL"}}}],"security":[{"commerceSessionAuth":[]}],"components":{"securitySchemes":{"commerceSessionAuth":{"type":"apiKey","in":"cookie","name":"osessionid","description":"Session-based authentication using osessionid cookie"}},"schemas":{"BasketListResponse":{"type":"object","properties":{"baskets":{"type":"array","items":{"$ref":"#/components/schemas/BasketList"},"description":"List of active baskets"}}},"BasketList":{"type":"object","properties":{"pk":{"type":"integer","description":"Unique identifier for the basket"},"namespace":{"type":"string","nullable":true,"description":"Namespace identifier for the basket"}}}}},"paths":{"/basket-list/":{"get":{"summary":"List Active Baskets","description":"This method retrieves a list of all active baskets for the current session.\n\nReturns basic information about each basket including the primary key and namespace.\nThis is useful for displaying available baskets to users or for basket management interfaces.\n\n**Use Cases:**\n* Display user's available baskets\n* Basket switching interfaces\n* Administrative basket overview","operationId":"list_active_baskets","responses":{"200":{"description":"Successfully retrieved basket list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasketListResponse"}}}}},"tags":["multi-basket"]}}}}
```

## Set Main Basket by ID

> This method sets a specific basket as the main/active basket using its primary key (ID).\
> \
> When a basket is set as main, it becomes the default basket for the current session.\
> The basket's namespace is stored in the user's session for subsequent operations.\
> \
> \*\*Use Cases:\*\*\
> \* Switch between different user baskets\
> \* Set a saved basket as the current active basket\
> \* Restore a previous shopping session

```json
{"openapi":"3.0.3","info":{"title":"Basket API","version":"1.0.0"},"servers":[{"description":"Server base URL for basket operations","url":"https://{commerce_url}/baskets","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce server URL"}}}],"security":[{"commerceSessionAuth":[],"csrfCookie":[]}],"components":{"securitySchemes":{"commerceSessionAuth":{"type":"apiKey","in":"cookie","name":"osessionid","description":"Session-based authentication using osessionid cookie"}},"schemas":{"BasketResponse":{"type":"object","properties":{"basket":{"$ref":"#/components/schemas/Basket"}}},"Basket":{"type":"object","properties":{"pk":{"type":"integer","description":"Basket unique identifier"},"namespace":{"type":"string","nullable":true,"description":"Basket namespace for logical separation"},"basketitem_set":{"type":"array","items":{"$ref":"#/components/schemas/BasketItem"},"description":"List of basket items"},"total_quantity":{"type":"integer","description":"Total quantity of all items in basket"},"total_amount":{"type":"string","description":"Total amount after all discounts"},"total_discount_amount":{"type":"string","description":"Total discount amount applied to basket"},"total_product_amount":{"type":"string","description":"Total product amount before discounts"},"discounts":{"type":"array","items":{"$ref":"#/components/schemas/Discount"},"description":"List of applied discounts"},"upsell_details":{"type":"array","items":{"$ref":"#/components/schemas/UpsellDetail"},"description":"Upsell messages for offers that almost qualified"},"voucher_code":{"type":"string","nullable":true,"description":"Applied voucher code"},"created_date":{"type":"string","format":"date-time","description":"Basket creation timestamp"},"modified_date":{"type":"string","format":"date-time","description":"Last modification timestamp"},"segment":{"$ref":"#/components/schemas/Segment"},"unavailable_basket_products":{"type":"array","items":{"$ref":"#/components/schemas/UnavailableProduct"},"description":"Products that were removed due to unavailability"}}},"BasketItem":{"type":"object","properties":{"id":{"type":"integer","description":"Basket item unique identifier"},"product":{"$ref":"#/components/schemas/ProductDetail"},"quantity":{"type":"number","multipleOf":0.01,"description":"Quantity of the product"},"unit_price":{"type":"string","description":"Unit price of the product (before discounts)"},"price":{"type":"string","description":"Current unit price (same as unit_price)"},"retail_price":{"type":"string","description":"Retail price of the product"},"discounted_price":{"type":"string","description":"Unit price after discounts"},"tax_rate":{"type":"string","description":"Tax rate applied (as decimal)"},"currency_type":{"$ref":"#/components/schemas/CurrencyTypeEnum"},"total_amount":{"type":"string","description":"Total amount for this item (quantity × discounted_price)"},"discount_amount":{"type":"string","description":"Total discount amount for this item"},"stock":{"type":"integer","description":"Available stock for this product"},"attributes":{"type":"object","description":"Custom attributes for the basket item (gift notes, etc.)","nullable":true},"attributes_kwargs":{"type":"object","description":"Formatted attributes for display","nullable":true},"shipping_discount":{"$ref":"#/components/schemas/ShippingDiscount"},"offer_badges":{"type":"array","items":{"$ref":"#/components/schemas/Discount"},"description":"List of offer badges applied to this item"},"image":{"type":"string","nullable":true,"description":"Primary image for the item"},"parent":{"type":"integer","nullable":true,"description":"Parent basket item ID (for sub-items)"},"datasource":{"$ref":"#/components/schemas/DataSource"},"extra_product_stock_detailed":{"type":"object","nullable":true,"description":"Extra product stock details (marketplace)"},"extra_product_price_detailed":{"type":"object","nullable":true,"description":"Extra product price details (marketplace)"}}},"ProductDetail":{"type":"object","properties":{"pk":{"type":"integer","description":"Product unique identifier"},"sku":{"type":"string","description":"Stock Keeping Unit"},"name":{"type":"string","description":"Product name"},"base_code":{"type":"string","description":"Product base code"},"product_type":{"$ref":"#/components/schemas/ProductTypeEnum"},"productimage_set":{"type":"array","items":{"type":"object","properties":{"image":{"type":"string","description":"Product image URL"}}},"description":"Product images"},"attributes":{"type":"object","description":"Product attributes and metadata"},"is_active":{"type":"boolean","description":"Product active status"},"attribute_set":{"type":"integer","nullable":true,"description":"Attribute set ID"}}},"ProductTypeEnum":{"type":"string","description":"Type of product that determines its behavior and structure.\n\nProduct type definitions:\n* `simple` (0) - Standard standalone product with single SKU\n* `bundle` (2) - Bundle product requiring form completion with chapters and attributes\n* `grouped` (3) - Grouped product that contains multiple related products\n* `product_meta` (1) - Meta product used for organizational purposes (not purchasable)\n* `miscellaneous` (4) - Special miscellaneous product (e.g., gift wrap, services)\n* `offer` (5) - Special offer product that may contain promotional items\n* `pre_product` (-1) - Pre-release or pre-order product\n* `pre_miscellaneous` (-2) - Pre-release miscellaneous product\n\n**Important notes:**\n* `product_meta` and `grouped` types cannot be added to basket directly\n* `bundle` type requires form completion with chapter data\n* `miscellaneous` and `offer` types are typically used as sub-items","enum":["-1","0","1","2","3","-2","4","5"]},"CurrencyTypeEnum":{"type":"string","description":"Currency type using ISO 4217 currency codes.\n\nSupported currencies:\n* `try` - Turkish Lira (TRY)\n* `eur` - Euro (EUR)\n* `usd` - US Dollar (USD)\n* `gbp` - British Pound Sterling (GBP)\n* `egp` - Egyptian Pound (EGP)\n* `mad` - Moroccan Dirham (MAD)\n* `pln` - Polish Zloty (PLN)\n* `sar` - Saudi Riyal (SAR)\n* `ron` - Romanian Leu (RON)\n* `uah` - Ukrainian Hryvnia (UAH)\n* `czk` - Czech Koruna (CZK)\n* `huf` - Hungarian Forint (HUF)\n* `rub` - Russian Ruble (RUB)\n* `bgn` - Bulgarian Lev (BGN)\n* `iqd` - Iraqi Dinar (IQD)\n* `kwd` - Kuwaiti Dinar (KWD)\n* `bhd` - Bahraini Dinar (BHD)\n* `omr` - Omani Rial (OMR)\n* `qar` - Qatari Riyal (QAR)\n* `aed` - UAE Dirham (AED)\n* `ngn` - Nigerian Naira (NGN)\n* `inr` - Indian Rupee (INR)\n* `lei` - Moldovan Leu (LEI)\n* `kzt` - Kazakhstani Tenge (KZT)\n* `jod` - Jordanian Dinar (JOD)\n* `rsd` - Serbian Dinar (RSD)","enum":["try","eur","usd","gbp","egp","mad","pln","sar","ron","uah","czk","huf","rub","bgn","iqd","kwd","bhd","omr","qar","aed","ngn","inr","lei","kzt","jod","rsd"]},"ShippingDiscount":{"type":"object","properties":{"description":{"type":"string","nullable":true,"description":"Shipping discount description"},"discount":{"type":"string","description":"Shipping discount amount"},"affects":{"$ref":"#/components/schemas/ApplicationResultTypeEnum"}}},"ApplicationResultTypeEnum":{"type":"string","description":"Type of discount application result that determines what the discount affects.\n\nApplication types:\n* `basket` - Discount applied to basket items (reduces product prices)\n* `shipping` - Discount applied to shipping costs (free or reduced shipping)\n* `post_order` - Discount applied after order completion (cashback, loyalty points)\n* `sample_product` - Free sample product added to basket as promotional item\n\n**Usage in responses:**\n* Basket discounts reduce the total_amount\n* Shipping discounts appear in shipping_discount field on items\n* Sample products appear as separate basket items with special pricing\n* Post-order benefits are tracked separately for future application","enum":["basket","shipping","post_order","sample_product"]},"Discount":{"type":"object","properties":{"description":{"type":"string","description":"Description of the discount"},"discount":{"type":"string","description":"Discount amount"},"affects":{"$ref":"#/components/schemas/ApplicationResultTypeEnum"}}},"DataSource":{"type":"object","properties":{"pk":{"type":"integer","description":"Datasource unique identifier"},"name":{"type":"string","description":"Datasource/seller name"},"erp_code":{"type":"string","nullable":true,"description":"ERP code for the datasource"}}},"UpsellDetail":{"type":"object","properties":{"message":{"type":"string","description":"Upsell message for failed offer"},"params":{"type":"object","description":"Parameters for the upsell message"}}},"Segment":{"type":"object","properties":{"pk":{"type":"integer","nullable":true,"description":"Segment primary key"},"price_list":{"type":"integer","nullable":true,"description":"Price list ID for the segment"},"stock_list":{"type":"integer","nullable":true,"description":"Stock list ID for the segment"}}},"UnavailableProduct":{"type":"object","properties":{"pk":{"type":"integer","description":"Product ID"},"name":{"type":"string","description":"Product name"},"unavailable_quantity":{"type":"number","description":"Quantity that was removed due to unavailability"}}},"ErrorResponse":{"type":"object","properties":{"detail":{"type":"string","description":"Error message"},"errors":{"type":"object","description":"Field-specific validation errors"}}}}},"paths":{"/basket-list/id/{pk}/main/":{"post":{"summary":"Set Main Basket by ID","description":"This method sets a specific basket as the main/active basket using its primary key (ID).\n\nWhen a basket is set as main, it becomes the default basket for the current session.\nThe basket's namespace is stored in the user's session for subsequent operations.\n\n**Use Cases:**\n* Switch between different user baskets\n* Set a saved basket as the current active basket\n* Restore a previous shopping session","operationId":"set_main_basket_by_id","parameters":[{"name":"pk","in":"path","required":true,"description":"Primary key (ID) of the basket to set as main","schema":{"type":"integer"}}],"responses":{"200":{"description":"Successfully set basket as main","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasketResponse"}}}},"404":{"description":"Basket not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"tags":["multi-basket"]}}}}
```

## Get Detailed Basket Discounts

> This method retrieves detailed information about discounts applied to a specific basket.\
> \
> Returns comprehensive discount information including sample products, allowed quantities,\
> and detailed breakdown of promotional benefits. This is particularly useful for \
> understanding complex promotional structures and sample product offerings.\
> \
> \*\*Use Cases:\*\*\
> \* Display detailed discount information to users\
> \* Promotional analysis and reporting\
> \* Sample product management\
> \* Marketing campaign effectiveness tracking

```json
{"openapi":"3.0.3","info":{"title":"Basket API","version":"1.0.0"},"servers":[{"description":"Server base URL for basket operations","url":"https://{commerce_url}/baskets","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce server URL"}}}],"security":[{"commerceSessionAuth":[]}],"components":{"securitySchemes":{"commerceSessionAuth":{"type":"apiKey","in":"cookie","name":"osessionid","description":"Session-based authentication using osessionid cookie"}},"schemas":{"DetailedDiscount":{"allOf":[{"$ref":"#/components/schemas/Discount"},{"type":"object","properties":{"sample_products":{"type":"array","items":{"type":"object"},"description":"Sample products for the discount"},"allowed_quantity":{"type":"integer","description":"Allowed quantity for the discount"}}}]},"Discount":{"type":"object","properties":{"description":{"type":"string","description":"Description of the discount"},"discount":{"type":"string","description":"Discount amount"},"affects":{"$ref":"#/components/schemas/ApplicationResultTypeEnum"}}},"ApplicationResultTypeEnum":{"type":"string","description":"Type of discount application result that determines what the discount affects.\n\nApplication types:\n* `basket` - Discount applied to basket items (reduces product prices)\n* `shipping` - Discount applied to shipping costs (free or reduced shipping)\n* `post_order` - Discount applied after order completion (cashback, loyalty points)\n* `sample_product` - Free sample product added to basket as promotional item\n\n**Usage in responses:**\n* Basket discounts reduce the total_amount\n* Shipping discounts appear in shipping_discount field on items\n* Sample products appear as separate basket items with special pricing\n* Post-order benefits are tracked separately for future application","enum":["basket","shipping","post_order","sample_product"]},"ErrorResponse":{"type":"object","properties":{"detail":{"type":"string","description":"Error message"},"errors":{"type":"object","description":"Field-specific validation errors"}}}}},"paths":{"/basket-list/id/{pk}/detailed_discounts/":{"get":{"summary":"Get Detailed Basket Discounts","description":"This method retrieves detailed information about discounts applied to a specific basket.\n\nReturns comprehensive discount information including sample products, allowed quantities,\nand detailed breakdown of promotional benefits. This is particularly useful for \nunderstanding complex promotional structures and sample product offerings.\n\n**Use Cases:**\n* Display detailed discount information to users\n* Promotional analysis and reporting\n* Sample product management\n* Marketing campaign effectiveness tracking","operationId":"get_detailed_basket_discounts","parameters":[{"name":"pk","in":"path","required":true,"description":"Primary key (ID) of the basket","schema":{"type":"integer"}}],"responses":{"200":{"description":"Successfully retrieved detailed discounts","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DetailedDiscount"}}}}},"404":{"description":"Basket not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"tags":["multi-basket"]}}}}
```

## Set Main Basket by Namespace

> This method sets a specific basket as the main/active basket using its namespace identifier.\
> \
> Namespaces allow for logical separation of baskets (e.g., "main", "wishlist", "saved").\
> When a basket is set as main by namespace, it becomes the default basket for the current session.\
> \
> \*\*Special handling:\*\*\
> \* Use "null" as namespace parameter to select baskets with null namespace\
> \* The namespace is stored in the user's session for subsequent operations\
> \
> \*\*Use Cases:\*\*\
> \* Switch between thematic baskets (main cart vs wishlist)\
> \* Restore namespace-specific shopping sessions\
> \* Multi-store or multi-context basket management

```json
{"openapi":"3.0.3","info":{"title":"Basket API","version":"1.0.0"},"servers":[{"description":"Server base URL for basket operations","url":"https://{commerce_url}/baskets","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce server URL"}}}],"security":[{"commerceSessionAuth":[],"csrfCookie":[]}],"components":{"securitySchemes":{"commerceSessionAuth":{"type":"apiKey","in":"cookie","name":"osessionid","description":"Session-based authentication using osessionid cookie"}},"schemas":{"BasketResponse":{"type":"object","properties":{"basket":{"$ref":"#/components/schemas/Basket"}}},"Basket":{"type":"object","properties":{"pk":{"type":"integer","description":"Basket unique identifier"},"namespace":{"type":"string","nullable":true,"description":"Basket namespace for logical separation"},"basketitem_set":{"type":"array","items":{"$ref":"#/components/schemas/BasketItem"},"description":"List of basket items"},"total_quantity":{"type":"integer","description":"Total quantity of all items in basket"},"total_amount":{"type":"string","description":"Total amount after all discounts"},"total_discount_amount":{"type":"string","description":"Total discount amount applied to basket"},"total_product_amount":{"type":"string","description":"Total product amount before discounts"},"discounts":{"type":"array","items":{"$ref":"#/components/schemas/Discount"},"description":"List of applied discounts"},"upsell_details":{"type":"array","items":{"$ref":"#/components/schemas/UpsellDetail"},"description":"Upsell messages for offers that almost qualified"},"voucher_code":{"type":"string","nullable":true,"description":"Applied voucher code"},"created_date":{"type":"string","format":"date-time","description":"Basket creation timestamp"},"modified_date":{"type":"string","format":"date-time","description":"Last modification timestamp"},"segment":{"$ref":"#/components/schemas/Segment"},"unavailable_basket_products":{"type":"array","items":{"$ref":"#/components/schemas/UnavailableProduct"},"description":"Products that were removed due to unavailability"}}},"BasketItem":{"type":"object","properties":{"id":{"type":"integer","description":"Basket item unique identifier"},"product":{"$ref":"#/components/schemas/ProductDetail"},"quantity":{"type":"number","multipleOf":0.01,"description":"Quantity of the product"},"unit_price":{"type":"string","description":"Unit price of the product (before discounts)"},"price":{"type":"string","description":"Current unit price (same as unit_price)"},"retail_price":{"type":"string","description":"Retail price of the product"},"discounted_price":{"type":"string","description":"Unit price after discounts"},"tax_rate":{"type":"string","description":"Tax rate applied (as decimal)"},"currency_type":{"$ref":"#/components/schemas/CurrencyTypeEnum"},"total_amount":{"type":"string","description":"Total amount for this item (quantity × discounted_price)"},"discount_amount":{"type":"string","description":"Total discount amount for this item"},"stock":{"type":"integer","description":"Available stock for this product"},"attributes":{"type":"object","description":"Custom attributes for the basket item (gift notes, etc.)","nullable":true},"attributes_kwargs":{"type":"object","description":"Formatted attributes for display","nullable":true},"shipping_discount":{"$ref":"#/components/schemas/ShippingDiscount"},"offer_badges":{"type":"array","items":{"$ref":"#/components/schemas/Discount"},"description":"List of offer badges applied to this item"},"image":{"type":"string","nullable":true,"description":"Primary image for the item"},"parent":{"type":"integer","nullable":true,"description":"Parent basket item ID (for sub-items)"},"datasource":{"$ref":"#/components/schemas/DataSource"},"extra_product_stock_detailed":{"type":"object","nullable":true,"description":"Extra product stock details (marketplace)"},"extra_product_price_detailed":{"type":"object","nullable":true,"description":"Extra product price details (marketplace)"}}},"ProductDetail":{"type":"object","properties":{"pk":{"type":"integer","description":"Product unique identifier"},"sku":{"type":"string","description":"Stock Keeping Unit"},"name":{"type":"string","description":"Product name"},"base_code":{"type":"string","description":"Product base code"},"product_type":{"$ref":"#/components/schemas/ProductTypeEnum"},"productimage_set":{"type":"array","items":{"type":"object","properties":{"image":{"type":"string","description":"Product image URL"}}},"description":"Product images"},"attributes":{"type":"object","description":"Product attributes and metadata"},"is_active":{"type":"boolean","description":"Product active status"},"attribute_set":{"type":"integer","nullable":true,"description":"Attribute set ID"}}},"ProductTypeEnum":{"type":"string","description":"Type of product that determines its behavior and structure.\n\nProduct type definitions:\n* `simple` (0) - Standard standalone product with single SKU\n* `bundle` (2) - Bundle product requiring form completion with chapters and attributes\n* `grouped` (3) - Grouped product that contains multiple related products\n* `product_meta` (1) - Meta product used for organizational purposes (not purchasable)\n* `miscellaneous` (4) - Special miscellaneous product (e.g., gift wrap, services)\n* `offer` (5) - Special offer product that may contain promotional items\n* `pre_product` (-1) - Pre-release or pre-order product\n* `pre_miscellaneous` (-2) - Pre-release miscellaneous product\n\n**Important notes:**\n* `product_meta` and `grouped` types cannot be added to basket directly\n* `bundle` type requires form completion with chapter data\n* `miscellaneous` and `offer` types are typically used as sub-items","enum":["-1","0","1","2","3","-2","4","5"]},"CurrencyTypeEnum":{"type":"string","description":"Currency type using ISO 4217 currency codes.\n\nSupported currencies:\n* `try` - Turkish Lira (TRY)\n* `eur` - Euro (EUR)\n* `usd` - US Dollar (USD)\n* `gbp` - British Pound Sterling (GBP)\n* `egp` - Egyptian Pound (EGP)\n* `mad` - Moroccan Dirham (MAD)\n* `pln` - Polish Zloty (PLN)\n* `sar` - Saudi Riyal (SAR)\n* `ron` - Romanian Leu (RON)\n* `uah` - Ukrainian Hryvnia (UAH)\n* `czk` - Czech Koruna (CZK)\n* `huf` - Hungarian Forint (HUF)\n* `rub` - Russian Ruble (RUB)\n* `bgn` - Bulgarian Lev (BGN)\n* `iqd` - Iraqi Dinar (IQD)\n* `kwd` - Kuwaiti Dinar (KWD)\n* `bhd` - Bahraini Dinar (BHD)\n* `omr` - Omani Rial (OMR)\n* `qar` - Qatari Riyal (QAR)\n* `aed` - UAE Dirham (AED)\n* `ngn` - Nigerian Naira (NGN)\n* `inr` - Indian Rupee (INR)\n* `lei` - Moldovan Leu (LEI)\n* `kzt` - Kazakhstani Tenge (KZT)\n* `jod` - Jordanian Dinar (JOD)\n* `rsd` - Serbian Dinar (RSD)","enum":["try","eur","usd","gbp","egp","mad","pln","sar","ron","uah","czk","huf","rub","bgn","iqd","kwd","bhd","omr","qar","aed","ngn","inr","lei","kzt","jod","rsd"]},"ShippingDiscount":{"type":"object","properties":{"description":{"type":"string","nullable":true,"description":"Shipping discount description"},"discount":{"type":"string","description":"Shipping discount amount"},"affects":{"$ref":"#/components/schemas/ApplicationResultTypeEnum"}}},"ApplicationResultTypeEnum":{"type":"string","description":"Type of discount application result that determines what the discount affects.\n\nApplication types:\n* `basket` - Discount applied to basket items (reduces product prices)\n* `shipping` - Discount applied to shipping costs (free or reduced shipping)\n* `post_order` - Discount applied after order completion (cashback, loyalty points)\n* `sample_product` - Free sample product added to basket as promotional item\n\n**Usage in responses:**\n* Basket discounts reduce the total_amount\n* Shipping discounts appear in shipping_discount field on items\n* Sample products appear as separate basket items with special pricing\n* Post-order benefits are tracked separately for future application","enum":["basket","shipping","post_order","sample_product"]},"Discount":{"type":"object","properties":{"description":{"type":"string","description":"Description of the discount"},"discount":{"type":"string","description":"Discount amount"},"affects":{"$ref":"#/components/schemas/ApplicationResultTypeEnum"}}},"DataSource":{"type":"object","properties":{"pk":{"type":"integer","description":"Datasource unique identifier"},"name":{"type":"string","description":"Datasource/seller name"},"erp_code":{"type":"string","nullable":true,"description":"ERP code for the datasource"}}},"UpsellDetail":{"type":"object","properties":{"message":{"type":"string","description":"Upsell message for failed offer"},"params":{"type":"object","description":"Parameters for the upsell message"}}},"Segment":{"type":"object","properties":{"pk":{"type":"integer","nullable":true,"description":"Segment primary key"},"price_list":{"type":"integer","nullable":true,"description":"Price list ID for the segment"},"stock_list":{"type":"integer","nullable":true,"description":"Stock list ID for the segment"}}},"UnavailableProduct":{"type":"object","properties":{"pk":{"type":"integer","description":"Product ID"},"name":{"type":"string","description":"Product name"},"unavailable_quantity":{"type":"number","description":"Quantity that was removed due to unavailability"}}},"ErrorResponse":{"type":"object","properties":{"detail":{"type":"string","description":"Error message"},"errors":{"type":"object","description":"Field-specific validation errors"}}}}},"paths":{"/basket-list/ns/{namespace}/main/":{"post":{"summary":"Set Main Basket by Namespace","description":"This method sets a specific basket as the main/active basket using its namespace identifier.\n\nNamespaces allow for logical separation of baskets (e.g., \"main\", \"wishlist\", \"saved\").\nWhen a basket is set as main by namespace, it becomes the default basket for the current session.\n\n**Special handling:**\n* Use \"null\" as namespace parameter to select baskets with null namespace\n* The namespace is stored in the user's session for subsequent operations\n\n**Use Cases:**\n* Switch between thematic baskets (main cart vs wishlist)\n* Restore namespace-specific shopping sessions\n* Multi-store or multi-context basket management","operationId":"set_main_basket_by_namespace","parameters":[{"name":"namespace","in":"path","required":true,"description":"Namespace identifier for the basket. Use \"null\" for baskets with null namespace.","schema":{"type":"string"}}],"responses":{"200":{"description":"Successfully set basket as main","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasketResponse"}}}},"404":{"description":"Basket not found for the specified namespace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"tags":["multi-basket"]}}}}
```

## Delete Basket

> This method permanently deletes a specific basket identified by its ID.\
> \
> Once deleted, the basket and all its items are removed from the system.\
> This operation cannot be undone, so use with caution.\
> \
> \*\*Use Cases:\*\*\
> \* Clean up abandoned or unwanted baskets\
> \* User-initiated basket deletion\
> \* Administrative basket management\
> \* Session cleanup operations

```json
{"openapi":"3.0.3","info":{"title":"Basket API","version":"1.0.0"},"servers":[{"description":"Server base URL for basket operations","url":"https://{commerce_url}/baskets","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce server URL"}}}],"security":[{"commerceSessionAuth":[],"csrfCookie":[]}],"components":{"securitySchemes":{"commerceSessionAuth":{"type":"apiKey","in":"cookie","name":"osessionid","description":"Session-based authentication using osessionid cookie"}},"schemas":{"ErrorResponse":{"type":"object","properties":{"detail":{"type":"string","description":"Error message"},"errors":{"type":"object","description":"Field-specific validation errors"}}}}},"paths":{"/basket-list/{basket_id}/":{"delete":{"summary":"Delete Basket","description":"This method permanently deletes a specific basket identified by its ID.\n\nOnce deleted, the basket and all its items are removed from the system.\nThis operation cannot be undone, so use with caution.\n\n**Use Cases:**\n* Clean up abandoned or unwanted baskets\n* User-initiated basket deletion\n* Administrative basket management\n* Session cleanup operations","operationId":"delete_basket","parameters":[{"name":"basket_id","in":"path","required":true,"description":"Unique identifier of the basket to delete","schema":{"type":"integer"}}],"responses":{"204":{"description":"Basket successfully deleted (no content returned)"},"404":{"description":"Basket not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"tags":["multi-basket"]}}}}
```

## Get Basket Detail by Namespace

> This method retrieves comprehensive details about a specific basket using its namespace identifier.\
> \
> Returns complete basket information including all items, pricing, discounts, and metadata.\
> The endpoint also handles unavailable products by removing them from the basket automatically\
> and applies current promotional offers.\
> \
> \*\*Special handling:\*\*\
> \* Use "null" as namespace parameter to access baskets with null namespace\
> \* Unavailable products are automatically removed from the basket\
> \* Promotional offers are automatically applied before returning data\
> \
> \*\*Use Cases:\*\*\
> \* Display full basket details to users\
> \* Checkout page data loading\
> \* Basket review and modification interfaces\
> \* Order preparation workflows

```json
{"openapi":"3.0.3","info":{"title":"Basket API","version":"1.0.0"},"servers":[{"description":"Server base URL for basket operations","url":"https://{commerce_url}/baskets","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce server URL"}}}],"security":[{"commerceSessionAuth":[]}],"components":{"securitySchemes":{"commerceSessionAuth":{"type":"apiKey","in":"cookie","name":"osessionid","description":"Session-based authentication using osessionid cookie"}},"schemas":{"BasketResponse":{"type":"object","properties":{"basket":{"$ref":"#/components/schemas/Basket"}}},"Basket":{"type":"object","properties":{"pk":{"type":"integer","description":"Basket unique identifier"},"namespace":{"type":"string","nullable":true,"description":"Basket namespace for logical separation"},"basketitem_set":{"type":"array","items":{"$ref":"#/components/schemas/BasketItem"},"description":"List of basket items"},"total_quantity":{"type":"integer","description":"Total quantity of all items in basket"},"total_amount":{"type":"string","description":"Total amount after all discounts"},"total_discount_amount":{"type":"string","description":"Total discount amount applied to basket"},"total_product_amount":{"type":"string","description":"Total product amount before discounts"},"discounts":{"type":"array","items":{"$ref":"#/components/schemas/Discount"},"description":"List of applied discounts"},"upsell_details":{"type":"array","items":{"$ref":"#/components/schemas/UpsellDetail"},"description":"Upsell messages for offers that almost qualified"},"voucher_code":{"type":"string","nullable":true,"description":"Applied voucher code"},"created_date":{"type":"string","format":"date-time","description":"Basket creation timestamp"},"modified_date":{"type":"string","format":"date-time","description":"Last modification timestamp"},"segment":{"$ref":"#/components/schemas/Segment"},"unavailable_basket_products":{"type":"array","items":{"$ref":"#/components/schemas/UnavailableProduct"},"description":"Products that were removed due to unavailability"}}},"BasketItem":{"type":"object","properties":{"id":{"type":"integer","description":"Basket item unique identifier"},"product":{"$ref":"#/components/schemas/ProductDetail"},"quantity":{"type":"number","multipleOf":0.01,"description":"Quantity of the product"},"unit_price":{"type":"string","description":"Unit price of the product (before discounts)"},"price":{"type":"string","description":"Current unit price (same as unit_price)"},"retail_price":{"type":"string","description":"Retail price of the product"},"discounted_price":{"type":"string","description":"Unit price after discounts"},"tax_rate":{"type":"string","description":"Tax rate applied (as decimal)"},"currency_type":{"$ref":"#/components/schemas/CurrencyTypeEnum"},"total_amount":{"type":"string","description":"Total amount for this item (quantity × discounted_price)"},"discount_amount":{"type":"string","description":"Total discount amount for this item"},"stock":{"type":"integer","description":"Available stock for this product"},"attributes":{"type":"object","description":"Custom attributes for the basket item (gift notes, etc.)","nullable":true},"attributes_kwargs":{"type":"object","description":"Formatted attributes for display","nullable":true},"shipping_discount":{"$ref":"#/components/schemas/ShippingDiscount"},"offer_badges":{"type":"array","items":{"$ref":"#/components/schemas/Discount"},"description":"List of offer badges applied to this item"},"image":{"type":"string","nullable":true,"description":"Primary image for the item"},"parent":{"type":"integer","nullable":true,"description":"Parent basket item ID (for sub-items)"},"datasource":{"$ref":"#/components/schemas/DataSource"},"extra_product_stock_detailed":{"type":"object","nullable":true,"description":"Extra product stock details (marketplace)"},"extra_product_price_detailed":{"type":"object","nullable":true,"description":"Extra product price details (marketplace)"}}},"ProductDetail":{"type":"object","properties":{"pk":{"type":"integer","description":"Product unique identifier"},"sku":{"type":"string","description":"Stock Keeping Unit"},"name":{"type":"string","description":"Product name"},"base_code":{"type":"string","description":"Product base code"},"product_type":{"$ref":"#/components/schemas/ProductTypeEnum"},"productimage_set":{"type":"array","items":{"type":"object","properties":{"image":{"type":"string","description":"Product image URL"}}},"description":"Product images"},"attributes":{"type":"object","description":"Product attributes and metadata"},"is_active":{"type":"boolean","description":"Product active status"},"attribute_set":{"type":"integer","nullable":true,"description":"Attribute set ID"}}},"ProductTypeEnum":{"type":"string","description":"Type of product that determines its behavior and structure.\n\nProduct type definitions:\n* `simple` (0) - Standard standalone product with single SKU\n* `bundle` (2) - Bundle product requiring form completion with chapters and attributes\n* `grouped` (3) - Grouped product that contains multiple related products\n* `product_meta` (1) - Meta product used for organizational purposes (not purchasable)\n* `miscellaneous` (4) - Special miscellaneous product (e.g., gift wrap, services)\n* `offer` (5) - Special offer product that may contain promotional items\n* `pre_product` (-1) - Pre-release or pre-order product\n* `pre_miscellaneous` (-2) - Pre-release miscellaneous product\n\n**Important notes:**\n* `product_meta` and `grouped` types cannot be added to basket directly\n* `bundle` type requires form completion with chapter data\n* `miscellaneous` and `offer` types are typically used as sub-items","enum":["-1","0","1","2","3","-2","4","5"]},"CurrencyTypeEnum":{"type":"string","description":"Currency type using ISO 4217 currency codes.\n\nSupported currencies:\n* `try` - Turkish Lira (TRY)\n* `eur` - Euro (EUR)\n* `usd` - US Dollar (USD)\n* `gbp` - British Pound Sterling (GBP)\n* `egp` - Egyptian Pound (EGP)\n* `mad` - Moroccan Dirham (MAD)\n* `pln` - Polish Zloty (PLN)\n* `sar` - Saudi Riyal (SAR)\n* `ron` - Romanian Leu (RON)\n* `uah` - Ukrainian Hryvnia (UAH)\n* `czk` - Czech Koruna (CZK)\n* `huf` - Hungarian Forint (HUF)\n* `rub` - Russian Ruble (RUB)\n* `bgn` - Bulgarian Lev (BGN)\n* `iqd` - Iraqi Dinar (IQD)\n* `kwd` - Kuwaiti Dinar (KWD)\n* `bhd` - Bahraini Dinar (BHD)\n* `omr` - Omani Rial (OMR)\n* `qar` - Qatari Riyal (QAR)\n* `aed` - UAE Dirham (AED)\n* `ngn` - Nigerian Naira (NGN)\n* `inr` - Indian Rupee (INR)\n* `lei` - Moldovan Leu (LEI)\n* `kzt` - Kazakhstani Tenge (KZT)\n* `jod` - Jordanian Dinar (JOD)\n* `rsd` - Serbian Dinar (RSD)","enum":["try","eur","usd","gbp","egp","mad","pln","sar","ron","uah","czk","huf","rub","bgn","iqd","kwd","bhd","omr","qar","aed","ngn","inr","lei","kzt","jod","rsd"]},"ShippingDiscount":{"type":"object","properties":{"description":{"type":"string","nullable":true,"description":"Shipping discount description"},"discount":{"type":"string","description":"Shipping discount amount"},"affects":{"$ref":"#/components/schemas/ApplicationResultTypeEnum"}}},"ApplicationResultTypeEnum":{"type":"string","description":"Type of discount application result that determines what the discount affects.\n\nApplication types:\n* `basket` - Discount applied to basket items (reduces product prices)\n* `shipping` - Discount applied to shipping costs (free or reduced shipping)\n* `post_order` - Discount applied after order completion (cashback, loyalty points)\n* `sample_product` - Free sample product added to basket as promotional item\n\n**Usage in responses:**\n* Basket discounts reduce the total_amount\n* Shipping discounts appear in shipping_discount field on items\n* Sample products appear as separate basket items with special pricing\n* Post-order benefits are tracked separately for future application","enum":["basket","shipping","post_order","sample_product"]},"Discount":{"type":"object","properties":{"description":{"type":"string","description":"Description of the discount"},"discount":{"type":"string","description":"Discount amount"},"affects":{"$ref":"#/components/schemas/ApplicationResultTypeEnum"}}},"DataSource":{"type":"object","properties":{"pk":{"type":"integer","description":"Datasource unique identifier"},"name":{"type":"string","description":"Datasource/seller name"},"erp_code":{"type":"string","nullable":true,"description":"ERP code for the datasource"}}},"UpsellDetail":{"type":"object","properties":{"message":{"type":"string","description":"Upsell message for failed offer"},"params":{"type":"object","description":"Parameters for the upsell message"}}},"Segment":{"type":"object","properties":{"pk":{"type":"integer","nullable":true,"description":"Segment primary key"},"price_list":{"type":"integer","nullable":true,"description":"Price list ID for the segment"},"stock_list":{"type":"integer","nullable":true,"description":"Stock list ID for the segment"}}},"UnavailableProduct":{"type":"object","properties":{"pk":{"type":"integer","description":"Product ID"},"name":{"type":"string","description":"Product name"},"unavailable_quantity":{"type":"number","description":"Quantity that was removed due to unavailability"}}},"ErrorResponse":{"type":"object","properties":{"detail":{"type":"string","description":"Error message"},"errors":{"type":"object","description":"Field-specific validation errors"}}}}},"paths":{"/basket/{namespace}/":{"get":{"summary":"Get Basket Detail by Namespace","description":"This method retrieves comprehensive details about a specific basket using its namespace identifier.\n\nReturns complete basket information including all items, pricing, discounts, and metadata.\nThe endpoint also handles unavailable products by removing them from the basket automatically\nand applies current promotional offers.\n\n**Special handling:**\n* Use \"null\" as namespace parameter to access baskets with null namespace\n* Unavailable products are automatically removed from the basket\n* Promotional offers are automatically applied before returning data\n\n**Use Cases:**\n* Display full basket details to users\n* Checkout page data loading\n* Basket review and modification interfaces\n* Order preparation workflows","operationId":"get_basket_detail_by_namespace","parameters":[{"name":"namespace","in":"path","required":true,"description":"Namespace identifier for the basket. Use \"null\" for baskets with null namespace.","schema":{"type":"string"}}],"responses":{"200":{"description":"Successfully retrieved basket details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasketResponse"}}}},"404":{"description":"Basket not found for the specified namespace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"tags":["multi-basket"]}}}}
```

## Get Mini Basket by Namespace

> This method retrieves minimal basket information using its namespace identifier.\
> \
> Returns only essential basket information like primary key and total quantity,\
> optimized for quick loading scenarios such as header cart indicators or\
> navigation elements where full basket details are not needed.\
> \
> \*\*Special handling:\*\*\
> \* Use "null" as namespace parameter to access baskets with null namespace\
> \* Lightweight response for performance-critical scenarios\
> \
> \*\*Use Cases:\*\*\
> \* Shopping cart icon with item count\
> \* Quick basket status checks\
> \* Mobile app header indicators\
> \* Performance-sensitive basket summaries

```json
{"openapi":"3.0.3","info":{"title":"Basket API","version":"1.0.0"},"servers":[{"description":"Server base URL for basket operations","url":"https://{commerce_url}/baskets","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce server URL"}}}],"security":[{"commerceSessionAuth":[]}],"components":{"securitySchemes":{"commerceSessionAuth":{"type":"apiKey","in":"cookie","name":"osessionid","description":"Session-based authentication using osessionid cookie"}},"schemas":{"ErrorResponse":{"type":"object","properties":{"detail":{"type":"string","description":"Error message"},"errors":{"type":"object","description":"Field-specific validation errors"}}}}},"paths":{"/basket/{namespace}/mini/":{"get":{"summary":"Get Mini Basket by Namespace","description":"This method retrieves minimal basket information using its namespace identifier.\n\nReturns only essential basket information like primary key and total quantity,\noptimized for quick loading scenarios such as header cart indicators or\nnavigation elements where full basket details are not needed.\n\n**Special handling:**\n* Use \"null\" as namespace parameter to access baskets with null namespace\n* Lightweight response for performance-critical scenarios\n\n**Use Cases:**\n* Shopping cart icon with item count\n* Quick basket status checks\n* Mobile app header indicators\n* Performance-sensitive basket summaries","operationId":"get_mini_basket_by_namespace","parameters":[{"name":"namespace","in":"path","required":true,"description":"Namespace identifier for the basket. Use \"null\" for baskets with null namespace.","schema":{"type":"string"}}],"responses":{"200":{"description":"Successfully retrieved mini basket information","content":{"application/json":{"schema":{"type":"object","properties":{"pk":{"type":"integer","description":"Basket unique identifier"},"total_quantity":{"type":"integer","description":"Total quantity of items in basket"}}}}}},"404":{"description":"Basket not found for the specified namespace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"tags":["multi-basket"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.akinon.com/commerce-openapis/basket/multi-basket.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
