API Documentation for SPY Systems
SPY System API V1 Documentation: Sales and Purchase Operations
This document provides detailed information for developers on authenticating and interacting with the SPY System's API V1, which is primarily designed for managing transactional sales and purchase data.
OpenAPI Specification (OAS)
We utilize Swagger to generate and publish an OpenAPI Specification (OAS) document for the SPY System API. This specification is compatible with a wide range of tools, enabling you to:
- View and Test Resources: Use tools like Swagger UI, Postman, or similar to explore and test API endpoints before integration.
- Generate Client Libraries: Automatically generate client libraries in various programming languages (e.g., PHP, Ruby, Python, Go, C#, and many more) using tools like OpenAPI Generator.
Critical Order and Delivery Flow
Understanding the order and delivery lifecycle within the SPY System is crucial for successful integration.
- Order Creation: Once an order is created via the API, it's imported into the SPY System and awaits packing.
- Packing Notification: Upon packing completion, a webhook event is triggered, notifying your system that the order has been packed and requires acceptance before shipment. At this stage, the delivery status is pending.
- Accepting Delivery: Change the delivery status to
acceptedto signal to the SPY System that the delivery is approved for shipment and invoicing. - Rejecting Delivery: Changing the status to
rejectedwill cancel the specific delivery, making it immutable. To re-attempt delivery for the order, a new delivery must be created (not a new order). - Status Flexibility:
- You can toggle a delivery's status between
acceptedandpendingas needed. - A
rejectedstatus is final and locks the delivery.
- You can toggle a delivery's status between
New Webhook Model (Introduced v1.3.0)
We have introduced a new, more robust webhook model utilizing Svix as an intermediary layer between the SPY System and your service.
How it Works:
- SPY to Svix: The SPY System sends webhook events to Svix.
- Svix to Your Service: You subscribe to desired events within Svix, which then forwards them to your configured endpoint.
Accessing Your Svix Portal:
- Initial Access: To gain access to your dedicated Svix portal (where you manage webhooks for your integration), call the
POST /webhook-portalendpoint. This will return a secure, single-use link. - Subsequent Access: If you need to access the portal again later, simply call the
POST /webhook-portalendpoint once more to generate a new single-use link.
Within the Svix Portal, you can:
- Configure Endpoints: Define the URL(s) where you want to receive webhooks.
- Subscribe to Events: Select which specific event types you wish to receive for each endpoint.
- Monitor and Resend Events: View a history of received and sent events, and re-send any if necessary for testing or troubleshooting.
Changelog
This section outlines significant changes and additions to API V1.
Version 1.4.12
- Create Order Response: Added delivery references for deliveries created synchronously with the order.
Version 1.4.11
- Pending Refund Support:
- New Endpoints:
POST /orders/{orderId}/pending-refundsGET /orders/{orderId}/pending-refundsGET /orders/{orderId}/pending-refunds/{pendingRefundId}
- Refund Fields: Added
pendingRefundIdto theSalesOrderRefundschema when a confirmed refund was created from a pending refund.
- New Endpoints:
Version 1.4.9
- Variant Stock Endpoints:
- Added optional query parameter
includeVariantsOnOrderto the stock variant endpoints:GET /variants/stockGET /variants/stock/{barcode}
- Note: Add
includeVariantsOnOrder=trueto the query string to include variants from the customer's running sales orders in the response withquantity=0.
- Added optional query parameter
Version 1.4.4
- Create Order Response: Added the full Sales Order to the response object.
Version 1.4.1
- Variant Fields: Added
b2cSalePriceto the Variant schema.
Version 1.4.0
- Variant Stock and Season Data:
- New Endpoints:
GET /variants/stockGET /variants/stock/{barcode}GET /variants/seasonGET /variants/season/{barcode}
- Deprecated Endpoints:
GET /variants(useGET /variants/stockinstead)GET /variants/{barcode}(useGET /variants/stock/{barcode}instead)
- Note: New endpoints (stock/season) by default return only
barcodeandquantity. Adddetailed=trueto the query string for full variant details.
- New Endpoints:
- Pre-Order Support:
- Enabled by adding
SeasonNameto the order andDeliveryNameto each order line. - Season and Delivery names can be retrieved via
GET /seasons.
- Enabled by adding
Version 1.3.3
- Freight Requirement:
Freightis no longer a mandatory field when creating an order. (Note: System configuration may still enforce it).
Version 1.3.0
- Schema Name Changes: Some schema names have been updated.
- New Order and Refund Endpoints:
GET /ordersGET /orders/{orderId}GET /orders/{orderId}/deliveriesGET /orders/{orderId}/deliveries/{orderDeliveryId}POST /orders/{orderId}/deliveries/{orderDeliveryId}GET /orders/{orderId}/refundsGET /orders/{orderId}/refunds/{orderRefundId}POST /orders/{orderId}/refunds/{orderRefundId}
- New Webhook Model (Beta):
- Requires explicit access in the SPY System.
- Access the Svix portal via
POST /webhook-portal. - Webhooks are now documented here.
Version 1.2.56
- Variant Fields: Added
colorCodeand care label fields (careLabelWash,careLabelIron,careLabelDry,careLabelDryClean,careLabelBleach) to the Variant schema.
Version 1.2.55
- OrderData:
shippingAddressis no longer a required field onOrderData.
Version 1.2.54
- Freight Field: Added
warehouseCodeto theFreightschema.
Version 1.2.50
- Variant Field: Added
priceOriginalto the Variant schema.
Version 1.2.45
- Style Field: Added
designerto the Style schema.
Version 1.2.38
- Variant Field: Added
seasonNameto the Variant schema.
Version 1.2.37
- Variant Field: Added
wspPriceto the Variant schema.
Version 1.2.17
- Delivery Endpoint: Added endpoint for getting a single delivery.
- Variant Information: Added more details to Variants:
B2B Hidden,Color Active,Tags,Customs Tariff Number,Country of Origin,Weight.
Version 1.2.14
- Variant Field: Added
variantTypeto the Variant schema.
Version 1.2.8
- Variant Information: Added more details to Variants:
Style Description,Wash,Category,Quality,Type,Gender.
Version 1.2.7
- New Endpoints: Added
FreightandBrandsendpoints.
Version 1.2.6
- New Endpoints: Added
Variants,Delivery, andOrdersendpoints.

