Zoho Inventory Sales Order Custom Status API

The official Zoho Inventory API documentation for updating Sales Orders details using a PUT request to the /inventory/v1/salesorders/{salesorder_id}
endpoint.
To update a custom sub-status, you'd typically include the order_sub_status_id field with its numeric ID in the JSON payload. However, this does not work to change the order status. By inspecting the network traffic (F12 -> Network Tab) generated when manually changing the sub-status using the admin UI, we discovered:
https://{your-inventory-domain}/api/v1/salesorders/{salesorder_id}/substatus/{status_code}
Key differences:
- It uses the POST method, not PUT.
- It appends /substatus/ followed by the text-based status_code (e.g., cs_new) to the URL path, rather than sending the numeric status_id in the payload.
- The request requires no payload/parameters beyond authentication handled by the connection.
// Configuration - Use the status_code found in the GET response's sub_statuses array
targetStatusCode = "cs_new"; // Corresponds to 'New'
// Construct API URL using status code
// Using zohoapis.com domain as recommended for API calls, invokeUrl should handle it.
updateApiUrl = "https://www.zohoapis.com/inventory/v1/salesorders/" + soId + "/substatus/" + targetStatusCode + "?organization_id=" + orgId;
info "Attempting to set custom sub-status via POST to URL (UI method): " + updateApiUrl;
// Call Invoke URL (POST with no parameters, status code is in URL)
try
{
statusUpdateResponse = invokeUrl
[
url :updateApiUrl
type :POST
connection: "zoho_inventory"
];
info "Custom sub-status update response (POST UI method) for SO ID " + soId + ": " + statusUpdateResponse;
}
catch (e)
{
info "Error updating custom sub-status via invokeUrl POST (UI method) for SO ID " + soId + ": " + e;
}
info "Finished update_order_status script execution for SO ID: " + soId;
return;