{"id":2596,"date":"2024-12-31T20:23:15","date_gmt":"2024-12-31T20:23:15","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/magento-2-api-create-a-shipment\/"},"modified":"2025-01-02T09:59:53","modified_gmt":"2025-01-02T09:59:53","slug":"magento-2-api-create-a-shipment","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/magento-2-api-create-a-shipment\/","title":{"rendered":"Magento 2 API &#8211; Create a Shipment"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hello Magento peeps!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I am back with another blog post on&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/magento-2-api\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 API<\/a>. My last post was about creating invoices using Magento 2 API. Today, in this blog post, I will show you how you can use&nbsp;<em><strong>Magento 2 API to Create a Shipment<\/strong><\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s go through the Magento 2 API to Create a Shipment.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Create a Shipment Using Magento 2 API?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Creating a shipment in Magento 2 is an admin-level action; therefore, the API request requires the admin access token. You can use&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/magento-2-api-get-admin-token\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 API to get an admin access token<\/a>&nbsp;by passing the admin credentials through a GET request. To&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/auto-generate-invoices-and-shipments-for-backend-orders-in-magento-2\/\">generate shipment in Magento 2<\/a>&nbsp;through REST API, the client needs to send a POST request with the&nbsp;<em>order_item_id<\/em>, along with the admin access token. The response will return the shipment id.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Method:&nbsp;<\/strong>POST<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>URL:&nbsp;<\/strong><em>store_url\/rest\/V1\/order\/&lt;order_item_id&gt;\/ship<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Headers:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Content Type:&nbsp;<\/strong>application\/json<\/li>\n\n\n\n<li><strong>Authorization:&nbsp;<\/strong>Bearer &lt;admin token&gt;<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Response:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once authorized, the API request will create a shipment and return the shipment ID.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Once the customer has placed the order on your Magento 2 store and completed the payment, it\u2019s 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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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!  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, do not forget to share this Magento 2 API tutorial with your developer friends through social media.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks for reading!  <\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button btn-orange\"><a class=\"wp-block-button__link wp-element-button\">Magento 2 API \u2013 Create an Invoice<\/a><\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hello Magento peeps! I am back with another blog post on&nbsp;Magento 2 API. My last post was about creating invoices using Magento 2 API. Today,&#8230;<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-2596","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2596","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=2596"}],"version-history":[{"count":1,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2596\/revisions"}],"predecessor-version":[{"id":3860,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2596\/revisions\/3860"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=2596"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=2596"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=2596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}