# AnonymousOrders

Guest/anonymous order operations

## Query order by number and email (guest users)

> Allows guest users to retrieve their order details by providing\
> the order number and email address used during checkout.\
> \
> \*\*Access Restriction:\*\*\
> Only returns orders where user type is 'guest'. Orders from registered\
> users cannot be queried through this endpoint.\
> \
> \*\*Validation:\*\*\
> \- Order must exist and belong to a guest user\
> \- Email must exactly match the order's user\_email field\
> \- Email format must be valid\
> \
> \*\*Response:\*\*\
> Returns array with single order object if found.

```json
{"openapi":"3.1.0","info":{"title":"Users API - Authentication, Password, Orders, and Hooks","version":"1.0.0"},"tags":[{"name":"AnonymousOrders","description":"Guest/anonymous order operations"}],"servers":[{"description":"Default commerce site","url":"https://{commerce_url}","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce storefront hostname"}}}],"paths":{"/users/orders/anonymous/":{"post":{"tags":["AnonymousOrders"],"operationId":"queryAnonymousOrder","summary":"Query order by number and email (guest users)","description":"Allows guest users to retrieve their order details by providing\nthe order number and email address used during checkout.\n\n**Access Restriction:**\nOnly returns orders where user type is 'guest'. Orders from registered\nusers cannot be queried through this endpoint.\n\n**Validation:**\n- Order must exist and belong to a guest user\n- Email must exactly match the order's user_email field\n- Email format must be valid\n\n**Response:**\nReturns array with single order object if found.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnonymousOrderQuery"}}}},"responses":{"200":{"description":"Order details retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserOrder"},"description":"Array containing the matched order (always single item if successful)"}}}},"400":{"description":"Validation errors:\n- Order number doesn't exist or doesn't belong to a guest user\n- Email doesn't match order's user_email\n- Invalid email format"}}}}},"components":{"schemas":{"AnonymousOrderQuery":{"type":"object","required":["number","email"],"properties":{"number":{"type":"string","description":"Order number"},"email":{"type":"string","format":"email","description":"Email address used for the order (must match)"}}},"UserOrder":{"type":"object","description":"User order with all related data including items, discounts, addresses, and payment details.","properties":{"pk":{"type":"integer","description":"Order ID"},"number":{"type":"string","description":"Order number (unique identifier)"},"status":{"$ref":"#/components/schemas/EnumValue"},"currency":{"$ref":"#/components/schemas/EnumValue"},"amount":{"type":"string","description":"Order total amount"},"discount_amount":{"type":"string","description":"Total discount applied"},"amount_without_discount":{"type":"string","description":"Amount before discounts (computed field)"},"shipping_amount":{"type":"string","description":"Shipping cost"},"shipping_tax_rate":{"type":["string","null"],"description":"Tax rate for shipping"},"refund_amount":{"type":"string","description":"Total refund amount"},"discount_refund_amount":{"type":"string","description":"Refunded discount amount"},"shipping_refund_amount":{"type":"string","description":"Refunded shipping amount"},"is_cancelled":{"type":"boolean","description":"Whether order is fully cancelled"},"is_cancellable":{"type":"boolean","description":"Whether order can be cancelled"},"is_refundable":{"type":"boolean","description":"Whether order is eligible for refund"},"is_payable":{"type":"boolean","description":"Whether order has pending payment"},"tracking_url":{"type":["string","null"],"format":"uri","description":"Shipment tracking URL"},"tracking_number":{"type":["string","null"],"description":"Shipment tracking number"},"invoice_number":{"type":["string","null"],"description":"Invoice number"},"invoice_date":{"type":["string","null"],"format":"date-time","description":"Invoice date"},"e_archive_url":{"type":["string","null"],"format":"uri","description":"E-Archive document URL"},"order_type":{"oneOf":[{"$ref":"#/components/schemas/EnumValue"},{"type":"null"}],"description":"Type of order. Possible values:\n- `regular`: Standard order placed by customer\n- `addon`: Additional items added to an existing order\n- `replacement`: Replacement order for defective/incorrect items\n\nField can be null for legacy orders created before order_type was introduced."},"user_email":{"type":"string","format":"email","description":"Email address used for order"},"has_gift_box":{"type":["boolean","null"],"description":"Whether order includes gift box"},"gift_box_note":{"type":["string","null"],"description":"Gift box message/note"},"notes":{"type":["string","null"],"description":"Order delivery instructions"},"installment_count":{"type":"integer","description":"Number of payment installments"},"installment_interest_amount":{"type":"string","description":"Interest amount for installment payment"},"bin_number":{"type":["string","null"],"description":"Credit card BIN number (first 6-8 digits)"},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"shipping_address":{"$ref":"#/components/schemas/Address"},"billing_address":{"$ref":"#/components/schemas/Address"},"shipping_company":{"oneOf":[{"$ref":"#/components/schemas/EnumValue"},{"type":"null"}]},"client_type":{"$ref":"#/components/schemas/EnumValue"},"payment_option":{"$ref":"#/components/schemas/PaymentOptionSummary"},"bank":{"oneOf":[{"$ref":"#/components/schemas/BankSummary"},{"type":"null"}],"description":"Bank information (null if not credit card payment)"},"extra_field":{"type":["object","null"],"description":"Additional order data (rewards, custom fields, etc.)"},"orderitem_set":{"type":"array","items":{"$ref":"#/components/schemas/UserOrderItem"}},"discountitem_set":{"type":"array","items":{"$ref":"#/components/schemas/DiscountItem"}},"loyaltytransaction_set":{"type":"array","items":{"$ref":"#/components/schemas/LoyaltyTransaction"}}}},"EnumValue":{"type":"object","description":"Enum representation with value and label","properties":{"value":{"type":"string","description":"Enum internal value"},"label":{"type":"string","description":"Human-readable label"}}},"Address":{"type":"object","description":"Address details with location references","properties":{"pk":{"type":"integer"},"email":{"type":["string","null"],"format":"email"},"phone_number":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"country":{"$ref":"#/components/schemas/LocationSummary"},"city":{"$ref":"#/components/schemas/LocationSummary"},"line":{"type":"string","description":"Full address line"},"title":{"type":"string","description":"Address title/label"},"township":{"oneOf":[{"$ref":"#/components/schemas/LocationSummary"},{"type":"null"}]},"district":{"oneOf":[{"$ref":"#/components/schemas/LocationSummary"},{"type":"null"}]},"postcode":{"type":["string","null"]},"notes":{"type":["string","null"],"description":"Additional delivery instructions"},"company_name":{"type":["string","null"],"description":"Company name for corporate addresses"},"tax_office":{"type":["string","null"]},"tax_no":{"type":["string","null"]},"e_bill_taxpayer":{"type":["boolean","null"],"description":"E-bill taxpayer status"},"hash_data":{"type":"string","description":"Address hash for deduplication"},"address_type":{"$ref":"#/components/schemas/EnumValue"},"retail_store":{"oneOf":[{"type":"object","description":"Retail store details for store pickup addresses"},{"type":"null"}]},"remote_id":{"type":["string","null"],"description":"Remote system identifier"},"identity_number":{"type":["string","null"],"description":"Identity/tax number"},"extra_field":{"type":["object","null"],"description":"Additional custom fields"},"user":{"type":["integer","null"],"description":"User ID who owns this address"},"is_corporate":{"type":["boolean","null"],"description":"Whether this is a corporate address"},"primary":{"type":["boolean","null"],"description":"Whether this is the primary address"}}},"LocationSummary":{"type":"object","properties":{"pk":{"type":"integer"},"name":{"type":"string"},"code":{"type":"string"}}},"PaymentOptionSummary":{"type":"object","properties":{"pk":{"type":"integer"},"name":{"type":"string"},"payment_type":{"type":"string"},"slug":{"type":"string"}}},"BankSummary":{"type":"object","description":"Bank information for payment","properties":{"pk":{"type":"integer"},"name":{"type":"string"},"slug":{"type":"string"},"logo":{"type":["string","null"],"format":"uri","description":"Bank logo image URL"},"logo_path":{"type":["string","null"],"description":"Alternative path for bank logo"}}},"UserOrderItem":{"type":"object","description":"Order item within an order. Includes product details, pricing, status, and cancellation information.","properties":{"pk":{"type":"integer","description":"Order item ID"},"product":{"$ref":"#/components/schemas/UserOrderProduct"},"order":{"type":"integer","description":"Parent order ID"},"price":{"type":"string","description":"Total price for this order item"},"tax_rate":{"type":"string","description":"Tax rate applied"},"retail_price":{"type":["string","null"],"description":"Original retail price before discounts"},"discount_amount":{"type":["string","null"],"description":"Discount applied to this item"},"discounted_price":{"type":"string","description":"Final price after discount (computed field)"},"status":{"$ref":"#/components/schemas/EnumValue"},"price_currency":{"$ref":"#/components/schemas/EnumValue"},"is_cancelled":{"type":"boolean","description":"Whether item is cancelled"},"is_cancellable":{"type":"boolean","description":"Whether item can be cancelled"},"is_refundable":{"type":"boolean","description":"Whether item is eligible for refund"},"is_tradable":{"type":"boolean","description":"Whether item is eligible for trade-in"},"tracking_url":{"type":["string","null"],"format":"uri","description":"Shipment tracking URL for this item"},"tracking_number":{"type":["string","null"],"description":"Shipment tracking number"},"invoice_number":{"type":["string","null"],"description":"Invoice number for this item"},"invoice_date":{"type":["string","null"],"format":"date-time","description":"Invoice date"},"e_archive_url":{"type":["string","null"],"format":"uri","description":"E-Archive document URL"},"shipping_company":{"oneOf":[{"$ref":"#/components/schemas/EnumValue"},{"type":"null"}]},"shipping_option_group":{"oneOf":[{"$ref":"#/components/schemas/ShippingOptionGroup"},{"type":"null"}]},"estimated_delivery_date":{"type":["string","null"],"format":"date","description":"Estimated delivery date"},"shipped_date":{"type":["string","null"],"format":"date-time","description":"Date when item was shipped"},"delivered_date":{"type":["string","null"],"format":"date-time","description":"Date when item was delivered"},"image":{"type":["string","null"],"format":"uri","description":"Order item image (may differ from product image)"},"attributes":{"type":["object","null"],"description":"Item-specific attributes (e.g., trade-in inquiry data)"},"attributes_kwargs":{"type":["object","null"],"description":"Attribute configuration parameters"},"extra_field":{"type":["object","null"],"description":"Additional item data"},"cancellationrequest_set":{"type":"array","items":{"$ref":"#/components/schemas/CancellationRequest"}},"active_cancellation_request":{"oneOf":[{"$ref":"#/components/schemas/CancellationRequest"},{"type":"null"}],"description":"Most recent active cancellation request if exists"},"available_easy_return_shipping_companies":{"type":"array","items":{"$ref":"#/components/schemas/EasyReturnShippingCompany"},"description":"Available shipping companies for easy return"},"datasource_detailed":{"type":["object","null"],"description":"Data source information (if applicable)"},"extra_product_stock_detailed":{"type":["object","null"],"description":"Extra product stock details (if applicable)"},"extra_product_price_detailed":{"type":["object","null"],"description":"Extra product price details (if applicable)"}}},"UserOrderProduct":{"type":"object","description":"Product information in order context, including translations and attributes.","properties":{"pk":{"type":"integer","description":"Product ID"},"sku":{"type":"string","description":"Stock keeping unit"},"base_code":{"type":"string","description":"Product base code"},"name":{"type":"string","description":"Product name (translated)"},"image":{"type":["string","null"],"format":"uri","description":"Product image URL"},"absolute_url":{"type":"string","description":"Product detail page URL"},"attributes":{"type":"object","description":"Product attributes as key-value pairs"},"attributes_kwargs":{"type":"object","description":"Attribute configuration parameters"},"form_schema":{"type":"array","description":"Form configuration for product attributes"},"data_source":{"type":["object","null"],"description":"Data source information"},"extra_attributes":{"type":"object","description":"Additional product attributes"},"category":{"type":["object","null"],"description":"Main category information"},"attribute_set":{"type":"array","description":"Product attribute set"}}},"ShippingOptionGroup":{"type":"object","description":"Shipping option group information for order item","properties":{"pk":{"type":"integer","description":"Shipping option group ID"},"amount":{"type":"string","description":"Shipping amount"},"shipping_option_name":{"type":"string","description":"Name of shipping option"},"shipping_option_logo":{"type":["string","null"],"format":"uri","description":"Logo/icon of shipping option"}}},"CancellationRequest":{"type":"object","description":"Cancellation request record (response)","properties":{"pk":{"type":"integer"},"uuid":{"type":"string","format":"uuid","description":"Unique identifier for the cancellation request"},"order_item":{"type":"integer","description":"Order item ID"},"reason":{"type":"integer","description":"Cancellation reason ID"},"cancellation_type":{"$ref":"#/components/schemas/EnumValue"},"status":{"$ref":"#/components/schemas/EnumValue"},"description":{"type":["string","null"],"description":"User-provided cancellation description"},"iban":{"type":["string","null"],"description":"IBAN for refund (for cash payment orders)"},"holder_name":{"type":["string","null"],"description":"Account holder name for refund"},"easy_return":{"oneOf":[{"$ref":"#/components/schemas/CancellationEasyReturn"},{"type":"null"}],"description":"Easy return shipping information (for refund type cancellations)"},"quantity":{"type":["integer","null"],"description":"Quantity being cancelled (for mergeable order items)"},"fully_refund_as_loyalty_money":{"type":["boolean","null"],"description":"Whether refund is issued as loyalty points"},"cancellation_request_image_set":{"type":"array","items":{"$ref":"#/components/schemas/CancellationRequestImage"},"description":"Images attached to the cancellation request"},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"}}},"CancellationEasyReturn":{"type":"object","description":"Easy return shipping details","properties":{"shipping_company":{"$ref":"#/components/schemas/EnumValue"},"code":{"type":"string","description":"Easy return code/reference"},"start_date":{"type":["string","null"],"format":"date-time","description":"Pickup window start date"},"end_date":{"type":["string","null"],"format":"date-time","description":"Pickup window end date"},"status":{"$ref":"#/components/schemas/EnumValue"},"tracking_number":{"type":["string","null"],"description":"Shipment tracking number"},"tracking_url":{"type":["string","null"],"format":"uri","description":"Shipment tracking URL"},"pickup_date":{"type":["object","null"],"description":"Selected pickup date and time slot","properties":{"date":{"type":"string","format":"date","description":"Pickup date in YYYY-MM-DD format"},"hour_range":{"type":"object","properties":{"start":{"type":"string","description":"Start time in HH:MM format"},"end":{"type":"string","description":"End time in HH:MM format"}}}}}}},"CancellationRequestImage":{"type":"object","description":"Image attached to a cancellation request","properties":{"pk":{"type":"integer"},"cancellation_request":{"type":"integer","description":"Parent cancellation request ID"},"image":{"type":"string","format":"uri","description":"URL to the uploaded image"},"description":{"type":["string","null"],"description":"Optional description for the image"},"is_uploaded_by_user":{"type":"boolean","description":"Whether image was uploaded by user (vs system/admin)"},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"}}},"EasyReturnShippingCompany":{"type":"object","description":"Easy return shipping company option","properties":{"pk":{"type":"integer","description":"Shipping company ID"},"shipping_company":{"$ref":"#/components/schemas/EnumValue"},"name":{"type":"string","description":"Shipping company name"}}},"DiscountItem":{"type":"object","description":"Discount applied to an order.","properties":{"name":{"type":"string","description":"Discount name/label"},"amount":{"type":"string","description":"Discount amount"},"created_date":{"type":"string","format":"date-time","description":"When discount was created"},"order_number":{"type":"string","description":"Order number this discount applies to"},"currency":{"$ref":"#/components/schemas/EnumValue"}}},"LoyaltyTransaction":{"type":"object","description":"Loyalty points transaction associated with an order.","properties":{"pk":{"type":"integer","description":"Transaction ID"},"uuid":{"type":"string","format":"uuid","description":"Unique transaction identifier"},"amount":{"type":"string","description":"Loyalty points amount"},"order":{"type":["integer","null"],"description":"Associated order ID"},"user":{"type":["integer","null"],"description":"Associated user ID"},"user_email":{"type":["string","null"],"format":"email","description":"User email for transaction"},"reference":{"type":["string","null"],"description":"Transaction reference"}}}}}}
```

## Create cancellation request for guest order

> Allows guest users to request cancellation of order items.\
> Requires order number and email for verification.\
> \
> \*\*Validation:\*\*\
> \- Order must exist and belong to a guest user\
> \- Email must match order's user\_email\
> \- Order item must belong to the specified order\
> \- Order item cannot already have an active cancellation request\
> \
> \*\*Cancellation Types:\*\*\
> \- \`cancel\`: Simple cancellation without refund process\
> \- \`refund\`: Refund request (requires shipping\_company for easy return)\
> \
> \*\*Shipping Company Requirement:\*\*\
> For refund type cancellations, shipping\_company is required for easy return process.\
> \
> \*\*Error Codes:\*\*\
> \- \`cancellation\_request\_100\_1\`: Cancellation request already exists for this order item

```json
{"openapi":"3.1.0","info":{"title":"Users API - Authentication, Password, Orders, and Hooks","version":"1.0.0"},"tags":[{"name":"AnonymousOrders","description":"Guest/anonymous order operations"}],"servers":[{"description":"Default commerce site","url":"https://{commerce_url}","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce storefront hostname"}}}],"paths":{"/users/orders/anonymous/cancellation_requests/":{"post":{"tags":["AnonymousOrders"],"operationId":"cancelAnonymousOrder","summary":"Create cancellation request for guest order","description":"Allows guest users to request cancellation of order items.\nRequires order number and email for verification.\n\n**Validation:**\n- Order must exist and belong to a guest user\n- Email must match order's user_email\n- Order item must belong to the specified order\n- Order item cannot already have an active cancellation request\n\n**Cancellation Types:**\n- `cancel`: Simple cancellation without refund process\n- `refund`: Refund request (requires shipping_company for easy return)\n\n**Shipping Company Requirement:**\nFor refund type cancellations, shipping_company is required for easy return process.\n\n**Error Codes:**\n- `cancellation_request_100_1`: Cancellation request already exists for this order item","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnonymousCancellationRequest"}}}},"responses":{"201":{"description":"Cancellation request created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancellationRequest"}}}},"400":{"description":"Validation errors:\n- Order not found or doesn't belong to guest user\n- Email doesn't match order\n- Order item doesn't exist or doesn't belong to order\n- Cancellation request already exists (error_code: cancellation_request_100_1)\n- Missing required fields for refund type\n- Invalid quantity (exceeds order item quantity for mergeable items)"}}}}},"components":{"schemas":{"AnonymousCancellationRequest":{"type":"object","required":["number","email","order_item","reason","cancellation_type"],"properties":{"number":{"type":"string","description":"Order number"},"email":{"type":"string","format":"email","description":"Email address (must match order)"},"order_item":{"type":"integer","description":"Order item ID to cancel"},"reason":{"type":"integer","description":"Cancellation reason ID"},"cancellation_type":{"type":"string","enum":["cancel","refund"],"description":"Type of cancellation.\n- cancel: Simple cancellation\n- refund: Cancellation with refund (easy return)"},"description":{"type":"string","description":"Optional cancellation description"},"shipping_company":{"type":"integer","description":"Easy return shipping company ID (required for refund type).\nMust be an active EasyReturnShippingCompany."},"pickup_date":{"type":"object","description":"Pickup date and time slot information for easy return shipping.\n\n**Required for**: Refund-type cancellations when using easy return.\n\n**How to obtain available time slots:**\nCall the appointment dates endpoint: `POST /shippings/easy-return-appointment-dates`\n\nRequest body:\n- shipping_company: The easy return shipping company ID (integer)\n- pickup_address: Customer's address ID for pickup (integer)\n- start_datetime: Start of date range (YYYY-MM-DD)\n- end_datetime: End of date range (YYYY-MM-DD)\n\nResponse: Array of available dates, each containing:\n- date: Available pickup date (YYYY-MM-DD)\n- hourRanges: Array of time slots with {start, end} times in HH:MM format\n\nSelect one date and one hour_range from this response to populate this field.\n\n**Data Structure:**\nThis field stores the selected pickup appointment as a JSON object.","properties":{"date":{"type":"string","format":"date","description":"Pickup date in YYYY-MM-DD format.\nMust be one of the available dates returned from the appointment dates query."},"hour_range":{"type":"object","description":"Time slot for pickup.\nMust be one of the hourRanges returned for the selected date from the appointment dates query.","required":["start","end"],"properties":{"start":{"type":"string","description":"Start time of pickup window in HH:MM format (24-hour).\nObtained from the shipping company's available time slots."},"end":{"type":"string","description":"End time of pickup window in HH:MM format (24-hour).\nObtained from the shipping company's available time slots."}}}}},"quantity":{"type":"integer","minimum":1,"description":"Quantity to cancel (for mergeable order items).\nCannot exceed order item quantity."},"iban":{"type":"string","maxLength":34,"description":"IBAN for refund (for cash payment orders)"},"holder_name":{"type":"string","maxLength":255,"description":"Account holder name for refund"},"cancellation_request_image_set":{"type":"array","description":"Images for cancellation request (e.g., product damage photos).\nImages must be Base64 encoded strings.\nMaximum count per item controlled by CANCELLATION_REQUEST_MAX_IMAGE_COUNT_PER_ORDER_ITEM setting.","items":{"type":"object","required":["image"],"properties":{"image":{"type":"string","description":"Base64 encoded image data.\nFormat: \"data:image/jpeg;base64,/9j/4AAQSkZJRg...\" or just the Base64 string without prefix.\nSupported formats: JPEG, PNG, GIF, etc."},"description":{"type":"string","description":"Optional description for the image"}}}}}},"CancellationRequest":{"type":"object","description":"Cancellation request record (response)","properties":{"pk":{"type":"integer"},"uuid":{"type":"string","format":"uuid","description":"Unique identifier for the cancellation request"},"order_item":{"type":"integer","description":"Order item ID"},"reason":{"type":"integer","description":"Cancellation reason ID"},"cancellation_type":{"$ref":"#/components/schemas/EnumValue"},"status":{"$ref":"#/components/schemas/EnumValue"},"description":{"type":["string","null"],"description":"User-provided cancellation description"},"iban":{"type":["string","null"],"description":"IBAN for refund (for cash payment orders)"},"holder_name":{"type":["string","null"],"description":"Account holder name for refund"},"easy_return":{"oneOf":[{"$ref":"#/components/schemas/CancellationEasyReturn"},{"type":"null"}],"description":"Easy return shipping information (for refund type cancellations)"},"quantity":{"type":["integer","null"],"description":"Quantity being cancelled (for mergeable order items)"},"fully_refund_as_loyalty_money":{"type":["boolean","null"],"description":"Whether refund is issued as loyalty points"},"cancellation_request_image_set":{"type":"array","items":{"$ref":"#/components/schemas/CancellationRequestImage"},"description":"Images attached to the cancellation request"},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"}}},"EnumValue":{"type":"object","description":"Enum representation with value and label","properties":{"value":{"type":"string","description":"Enum internal value"},"label":{"type":"string","description":"Human-readable label"}}},"CancellationEasyReturn":{"type":"object","description":"Easy return shipping details","properties":{"shipping_company":{"$ref":"#/components/schemas/EnumValue"},"code":{"type":"string","description":"Easy return code/reference"},"start_date":{"type":["string","null"],"format":"date-time","description":"Pickup window start date"},"end_date":{"type":["string","null"],"format":"date-time","description":"Pickup window end date"},"status":{"$ref":"#/components/schemas/EnumValue"},"tracking_number":{"type":["string","null"],"description":"Shipment tracking number"},"tracking_url":{"type":["string","null"],"format":"uri","description":"Shipment tracking URL"},"pickup_date":{"type":["object","null"],"description":"Selected pickup date and time slot","properties":{"date":{"type":"string","format":"date","description":"Pickup date in YYYY-MM-DD format"},"hour_range":{"type":"object","properties":{"start":{"type":"string","description":"Start time in HH:MM format"},"end":{"type":"string","description":"End time in HH:MM format"}}}}}}},"CancellationRequestImage":{"type":"object","description":"Image attached to a cancellation request","properties":{"pk":{"type":"integer"},"cancellation_request":{"type":"integer","description":"Parent cancellation request ID"},"image":{"type":"string","format":"uri","description":"URL to the uploaded image"},"description":{"type":["string","null"],"description":"Optional description for the image"},"is_uploaded_by_user":{"type":"boolean","description":"Whether image was uploaded by user (vs system/admin)"},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"}}}}}}
```

## Create bulk cancellation requests for guest order

> Allows guest users to request cancellation of multiple order items\
> in a single request. Requires order number and email for verification.\
> \
> \*\*Validation:\*\*\
> \- Order must exist and belong to a guest user\
> \- Email must match order's user\_email\
> \- All order items must belong to the specified order\
> \- At least one order item must be provided\
> \- Order items cannot already have active cancellation requests\
> \
> \*\*Structure:\*\*\
> Request contains array of \`cancel\_order\_items\`, where each item can have:\
> \- Required: order\_item, reason, cancellation\_type\
> \- Optional: description, shipping\_company, pickup\_date, quantity, cancellation\_request\_image\_set\
> \
> \*\*Pickup Address:\*\*\
> Optional shared pickup address for all items (for easy return refunds).\
> \
> \*\*Loyalty Money Refund:\*\*\
> Set \`fully\_refund\_as\_loyalty\_money\` to refund entire amount as loyalty points.

```json
{"openapi":"3.1.0","info":{"title":"Users API - Authentication, Password, Orders, and Hooks","version":"1.0.0"},"tags":[{"name":"AnonymousOrders","description":"Guest/anonymous order operations"}],"servers":[{"description":"Default commerce site","url":"https://{commerce_url}","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce storefront hostname"}}}],"paths":{"/users/orders/anonymous/bulk_cancellation_requests/":{"post":{"tags":["AnonymousOrders"],"operationId":"bulkCancelAnonymousOrder","summary":"Create bulk cancellation requests for guest order","description":"Allows guest users to request cancellation of multiple order items\nin a single request. Requires order number and email for verification.\n\n**Validation:**\n- Order must exist and belong to a guest user\n- Email must match order's user_email\n- All order items must belong to the specified order\n- At least one order item must be provided\n- Order items cannot already have active cancellation requests\n\n**Structure:**\nRequest contains array of `cancel_order_items`, where each item can have:\n- Required: order_item, reason, cancellation_type\n- Optional: description, shipping_company, pickup_date, quantity, cancellation_request_image_set\n\n**Pickup Address:**\nOptional shared pickup address for all items (for easy return refunds).\n\n**Loyalty Money Refund:**\nSet `fully_refund_as_loyalty_money` to refund entire amount as loyalty points.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnonymousBulkCancellationRequest"}}}},"responses":{"201":{"description":"Cancellation requests created successfully for all items","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CancellationRequest"},"description":"Array of created cancellation requests"}}}},"400":{"description":"Validation errors:\n- Order not found or doesn't belong to guest user\n- Email doesn't match order\n- Empty cancel_order_items array\n- Order item doesn't exist or doesn't belong to order\n- Missing required fields (order_item, reason, cancellation_type)\n- Invalid quantity for mergeable items\n- Too many images per item (exceeds CANCELLATION_REQUEST_MAX_IMAGE_COUNT_PER_ORDER_ITEM)"}}}}},"components":{"schemas":{"AnonymousBulkCancellationRequest":{"type":"object","required":["number","email","cancel_order_items"],"properties":{"number":{"type":"string","description":"Order number"},"email":{"type":"string","format":"email","description":"Email address (must match order)"},"cancel_order_items":{"type":"array","minItems":1,"description":"Array of order items to cancel","items":{"type":"object","required":["order_item","reason","cancellation_type"],"properties":{"order_item":{"type":"integer","description":"Order item ID"},"reason":{"type":"integer","description":"Cancellation reason ID"},"cancellation_type":{"type":"string","enum":["cancel","refund"],"description":"Type of cancellation (cancel or refund)"},"description":{"type":"string","description":"Optional cancellation description"},"shipping_company":{"type":"integer","description":"Easy return shipping company ID (required for refund type)"},"pickup_date":{"type":"object","description":"Pickup date and time slot for easy return.\n\n**Required for**: Refund-type cancellations.\n\n**Obtaining available time slots:**\nEndpoint: `POST /shippings/easy-return-appointment-dates`\n\nRequest: shipping_company (ID), pickup_address (ID), \nstart_datetime (YYYY-MM-DD), end_datetime (YYYY-MM-DD)\n\nResponse: Array of {date, hourRanges[{start, end}]}\n\nSelect one date and hour_range from the response for this field.","properties":{"date":{"type":"string","format":"date","description":"Pickup date (must be from available dates returned by appointment query)"},"hour_range":{"type":"object","description":"Pickup time window (must be from hourRanges returned for the selected date)","required":["start","end"],"properties":{"start":{"type":"string","description":"Start time in HH:MM format"},"end":{"type":"string","description":"End time in HH:MM format"}}}}},"quantity":{"type":"integer","minimum":1,"description":"Quantity to cancel (for mergeable items)"},"iban":{"type":"string","maxLength":34,"description":"IBAN for refund"},"holder_name":{"type":"string","maxLength":255,"description":"Account holder name"},"cancellation_request_image_set":{"type":"array","description":"Images for this cancellation request.\nImages must be Base64 encoded.\nMaximum count controlled by CANCELLATION_REQUEST_MAX_IMAGE_COUNT_PER_ORDER_ITEM setting.","items":{"type":"object","required":["image"],"properties":{"image":{"type":"string","description":"Base64 encoded image data.\nFormat: \"data:image/jpeg;base64,...\" or raw Base64 string."},"description":{"type":"string","description":"Optional image description"}}}}}}},"pickup_address":{"type":"integer","description":"Optional shared pickup address ID for all items.\nMust be a customer address belonging to the user."},"fully_refund_as_loyalty_money":{"type":"boolean","default":false,"description":"Whether to refund entire amount as loyalty points"}}},"CancellationRequest":{"type":"object","description":"Cancellation request record (response)","properties":{"pk":{"type":"integer"},"uuid":{"type":"string","format":"uuid","description":"Unique identifier for the cancellation request"},"order_item":{"type":"integer","description":"Order item ID"},"reason":{"type":"integer","description":"Cancellation reason ID"},"cancellation_type":{"$ref":"#/components/schemas/EnumValue"},"status":{"$ref":"#/components/schemas/EnumValue"},"description":{"type":["string","null"],"description":"User-provided cancellation description"},"iban":{"type":["string","null"],"description":"IBAN for refund (for cash payment orders)"},"holder_name":{"type":["string","null"],"description":"Account holder name for refund"},"easy_return":{"oneOf":[{"$ref":"#/components/schemas/CancellationEasyReturn"},{"type":"null"}],"description":"Easy return shipping information (for refund type cancellations)"},"quantity":{"type":["integer","null"],"description":"Quantity being cancelled (for mergeable order items)"},"fully_refund_as_loyalty_money":{"type":["boolean","null"],"description":"Whether refund is issued as loyalty points"},"cancellation_request_image_set":{"type":"array","items":{"$ref":"#/components/schemas/CancellationRequestImage"},"description":"Images attached to the cancellation request"},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"}}},"EnumValue":{"type":"object","description":"Enum representation with value and label","properties":{"value":{"type":"string","description":"Enum internal value"},"label":{"type":"string","description":"Human-readable label"}}},"CancellationEasyReturn":{"type":"object","description":"Easy return shipping details","properties":{"shipping_company":{"$ref":"#/components/schemas/EnumValue"},"code":{"type":"string","description":"Easy return code/reference"},"start_date":{"type":["string","null"],"format":"date-time","description":"Pickup window start date"},"end_date":{"type":["string","null"],"format":"date-time","description":"Pickup window end date"},"status":{"$ref":"#/components/schemas/EnumValue"},"tracking_number":{"type":["string","null"],"description":"Shipment tracking number"},"tracking_url":{"type":["string","null"],"format":"uri","description":"Shipment tracking URL"},"pickup_date":{"type":["object","null"],"description":"Selected pickup date and time slot","properties":{"date":{"type":"string","format":"date","description":"Pickup date in YYYY-MM-DD format"},"hour_range":{"type":"object","properties":{"start":{"type":"string","description":"Start time in HH:MM format"},"end":{"type":"string","description":"End time in HH:MM format"}}}}}}},"CancellationRequestImage":{"type":"object","description":"Image attached to a cancellation request","properties":{"pk":{"type":"integer"},"cancellation_request":{"type":"integer","description":"Parent cancellation request ID"},"image":{"type":"string","format":"uri","description":"URL to the uploaded image"},"description":{"type":["string","null"],"description":"Optional description for the image"},"is_uploaded_by_user":{"type":"boolean","description":"Whether image was uploaded by user (vs system/admin)"},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"}}}}}}
```
