curl --request POST \
--url https://app.solya.app/api/plans/from-recommendation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"discountPercent": 30,
"domain": "markdown",
"planId": "550e8400-e29b-41d4-a716-446655440003",
"shopId": "550e8400-e29b-41d4-a716-446655440020",
"variantId": "550e8400-e29b-41d4-a716-446655440010"
}
'{
"itemId": "550e8400-e29b-41d4-a716-446655440013",
"planId": "550e8400-e29b-41d4-a716-446655440003",
"planType": "MARKDOWN",
"wasCreated": false
}Create or append to a plan from an AI recommendation
Converts an AI recommendation (decision vector) into a concrete plan item in a single request. The caller provides the decision domain, variantId, and shopId from GET /api/intelligence/decision-vectors. The server resolves brandId, collectionId, and sizeId from the gold layer automatically. For the restock domain, a plan is auto-created when planId is omitted. For rebalance and markdown, an existing planId is required. All business-rule hooks and audit logging fire through the existing operations layer.
curl --request POST \
--url https://app.solya.app/api/plans/from-recommendation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"discountPercent": 30,
"domain": "markdown",
"planId": "550e8400-e29b-41d4-a716-446655440003",
"shopId": "550e8400-e29b-41d4-a716-446655440020",
"variantId": "550e8400-e29b-41d4-a716-446655440010"
}
'{
"itemId": "550e8400-e29b-41d4-a716-446655440013",
"planId": "550e8400-e29b-41d4-a716-446655440003",
"planType": "MARKDOWN",
"wasCreated": false
}Authorizations
User session token issued by NextAuth. For human users accessing Solya via the web application.
Body
Decision domain driving the recommendation. 'restock' replenishes a shop from a supplier, 'rebalance' transfers stock between shops, 'markdown' marks down an item's price.
restock, rebalance, markdown Shop identifier as returned by GET /api/intelligence/decision-vectors. For restock this is the destination shop; for rebalance the source shop.
1Product variant identifier as returned by GET /api/intelligence/decision-vectors.
1Markdown discount percentage in the range [0, 100]. Required for the markdown domain; ignored for restock and rebalance.
0 <= x <= 100Existing plan to append the item to. Required for rebalance and markdown domains. For restock: when omitted a new plan is auto-created using the brand and collection resolved from the decision vector.
Number of units to restock or rebalance. Required for the restock and rebalance domains; ignored for markdown.
x <= 9007199254740991
