Magento 2 API - Create shipping not updating order status

Magento 2 API - Create shipping not updating order status

September 19, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento 2 API - Create shipping not updating order status

Magento 2 API: Creating Shipments and Updating Order Status

In Magento 2, the REST API provides a convenient way to manage various aspects of your store, including creating shipments for orders. However, when using the /V1/shipment endpoint to update shipping information, you might encounter situations where the order status fails to change to ‘Complete’ (or ‘Closed’) after the successful creation of the shipment.

Understanding the Issue

The problem likely arises from how Magento handles the relationship between shipments and order status updates. When a shipment is created via the API, it triggers an event that should update the order’s status accordingly. However, there are a few potential reasons why this update might not occur:

  1. API Configuration Issues: Ensure your API configuration is correct and that you have enabled the necessary permissions for the user making the request.

  2. Event observers not configured properly: Magento relies on event observers to update the order status after a shipment is created. If these observers are not configured correctly, or if there are conflicts with other extensions, the status update might fail.

  3. Missing required fields in the JSON payload: While your current JSON request seems valid, double-check that you have included all necessary fields and data types as per the API documentation.

Correcting the Order Status Update

To ensure that the order status is updated correctly after creating a shipment via the API, consider these steps:

Step 1: Verify the API Endpoint

Ensure you are using the correct endpoint for your Magento version. For Magento 2.3 and later, use /rest/V1/shipments.

Step 2: Check Your JSON Payload

Review your JSON payload carefully to ensure it matches the format expected by the API. In your current request, the tracks array is empty but present in your JSON object. If you don’t have any tracking information to include, consider removing this field entirely.

Here’s a revised version of your JSON:

{
    "entity": {
        "billingAddressId": 4,
        "comments": [],
        "items": [
            {
                "orderItemId": 2,
                "qty": 2
            }
        ],
        "orderId": 2,
        "shippingAddressId": 3,
        "totalQty": 2
    }
}

Step 3: Debug the API Response

When creating a shipment, Magento returns a response with details about the created shipment. Inspect this response for any error messages or status codes that might indicate why the order status update failed.

Step 4: Check Event Observers and Logs

If you suspect an issue with event observers or configuration conflicts, enable Magento logging and check the var/log directory after making a shipment API call. Look for any exceptions or errors related to order status updates.

Conclusion

When working with the Magento 2 REST API to create shipments and update order statuses, it’s crucial to ensure that your API requests are correctly formatted and that all necessary configuration settings are in place.

If you continue to encounter issues after verifying your JSON payload and checking for common problems, consider consulting the official Magento 2 documentation or seeking support from a Magento development expert. At Laravel Company, our team specializes in Magento development services and can help you diagnose and resolve complex API-related issues.

In most cases, carefully reviewing your API requests and ensuring that the Magento configuration is in order should lead to successful shipment creation and automated order status updates.

Magento 2 Security API Extensions

Our network