🔥 Just Launched! Werra Premium Template for HyväSee it in Action

Magento 2 API – Create a Shipment

By Jignesh ParmarUpdated on Jan 02, 2025 2 min read

Hello Magento peeps!

I am back with another blog post on Magento 2 API. My last post was about creating invoices using Magento 2 API. Today, in this blog post, I will show you how you can use Magento 2 API to Create a Shipment.

In Magento 2, the store admins can create shipments from the backend admin panel once the order is placed, invoiced, and ready to ship. However, if you are developing a custom backend, you may require to use the Magento 2 API to Create a Shipment. The Magento 2 APIs enable the developers to access the functionalities and features from other platforms. In this blog post, I will guide you on how you can create a shipment using REST API in Magento 2.

Let’s go through the Magento 2 API to Create a Shipment.

How to Create a Shipment Using Magento 2 API?

Creating a shipment in Magento 2 is an admin-level action; therefore, the API request requires the admin access token. You can use Magento 2 API to get an admin access token by passing the admin credentials through a GET request. To generate shipment in Magento 2 through REST API, the client needs to send a POST request with the order_item_id, along with the admin access token. The response will return the shipment id.

Method: POST

URL: store_url/rest/V1/order/<order_item_id>/ship

Headers:

  • Content Type: application/json
  • Authorization: Bearer <admin token>

Response:

Once authorized, the API request will create a shipment and return the shipment ID.

Conclusion

Once the customer has placed the order on your Magento 2 store and completed the payment, it’s time to ship it. You can use the Magento 2 API to make a POST request and create a shipment for specific orders. Moreover, you can also enter additional information about the shipment tracking in the payload to add to the shipment.

I hope this blog post will help you create a shipment using Magento 2 API. If you still have doubts or stumble upon any errors, feel free to comment. I will be happy to help you!

Also, do not forget to share this Magento 2 API tutorial with your developer friends through social media.

Thanks for reading!

Jignesh Parmar Full Image
Article byJignesh Parmar

An expert in his field, Jignesh is the team leader at Meetanshi and a certified Magento developer. His passion for Magento has inspired others in the team too. Apart from work, he is a cricket lover.