> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://developer-stage.shipbob.dev/experimental/api/kitting/create-work-order-from-existing/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developer-stage.shipbob.dev/_mcp/server. # Create Work Order from Existing POST https://sandbox-api.shipbob.com/Experimental/kitting:createFromExisting Content-Type: application/json Creates a kitting work order based on an existing shipment, including steps, line items, fulfillment center, and product details. Reference: https://developer-stage.shipbob.dev/experimental/api/kitting/create-work-order-from-existing ## Authentication - `Authorization` header (bearer token, required) — Authentication using Personal Access Token (PAT) token - `Authorization` header (bearer token, required) — OAuth2 authentication using JWT tokens ## Request ### Body (application/json) This endpoint expects a Kitting.PublicKittingWorkOrderCopyRequest. - `fulfillment_center_id` (integer, required) — The fulfillment center id associated with the work order. - `shipment_id` (integer, required) — Id of the shipment to copy line items and details from when creating the kitting work order. - `end_kitted_quantity` (integer, optional, nullable) — Number of end-kitted units to produce. When provided, overrides both the quantity and expected quantity from the original shipment. If not provided, the original shipment's quantity and expected quantity are used. - `line_item_lots` (list of Kitting.PublicKittingLineItemLotRequest, optional, nullable) — Optional per-component lot overrides. Each entry's inventory_id must match a component on the source shipment, and inventory_id must not repeat across entries. Entries with a lot_number are validated against GlobalInventory before the request is accepted; entries with only an inventory_id are a no-op. A lot_date without a lot_number is rejected. Components not listed here use the default lot-selection strategy. - `lot_date` (datetime, optional, nullable) — Lot expiration date to be associated with the work order. - `lot_number` (string, optional, nullable) — Lot number to be associated with the work order. ## Response ### 201 Success - `shipment_id` (integer, optional) — Id of the created shipment ## Errors ### 500 Internal Server Error Server Error - `details` (any, optional, nullable) - `errors` (list of string, optional) - `message` (string, optional) - `stackTrace` (string, optional, nullable) ## Types ### Kitting.PublicKittingLineItemLotRequest Specifies which lot to source a component from when copying a kitting work order from an existing shipment. - `inventory_id` (integer, required) — The inventory identifier of the component on the source shipment to apply this lot override to. - `lot_date` (datetime, optional, nullable) — Expiration date of the lot to source for this component. Requires lot_number to also be set — a lot_date with no lot_number is rejected. Only the date is used — any time component is discarded, so lot matching is by calendar date rather than by instant. - `lot_number` (string, optional, nullable) — Lot to source for this component. Validated against GlobalInventory before the work order is created. ## Examples **Request** ```json { "fulfillment_center_id": 1, "shipment_id": 5001, "end_kitted_quantity": 10, "line_item_lots": [ { "inventory_id": 8001, "lot_date": "2024-01-15T09:00:00+00:00", "lot_number": "LOT-2024-B2B" } ], "lot_date": "2024-01-15T09:00:00+00:00", "lot_number": "LOT-2024-001" } ``` **Response** ```json { "shipment_id": 0 } ``` **SDK Code** ```python default import requests url = "https://sandbox-api.shipbob.com/Experimental/kitting:createFromExisting" payload = { "fulfillment_center_id": 1, "shipment_id": 5001, "end_kitted_quantity": 10, "line_item_lots": [ { "inventory_id": 8001, "lot_date": "2024-01-15T09:00:00+00:00", "lot_number": "LOT-2024-B2B" } ], "lot_date": "2024-01-15T09:00:00+00:00", "lot_number": "LOT-2024-001" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript default const url = 'https://sandbox-api.shipbob.com/Experimental/kitting:createFromExisting'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"fulfillment_center_id":1,"shipment_id":5001,"end_kitted_quantity":10,"line_item_lots":[{"inventory_id":8001,"lot_date":"2024-01-15T09:00:00+00:00","lot_number":"LOT-2024-B2B"}],"lot_date":"2024-01-15T09:00:00+00:00","lot_number":"LOT-2024-001"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go default package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://sandbox-api.shipbob.com/Experimental/kitting:createFromExisting" payload := strings.NewReader("{\n \"fulfillment_center_id\": 1,\n \"shipment_id\": 5001,\n \"end_kitted_quantity\": 10,\n \"line_item_lots\": [\n {\n \"inventory_id\": 8001,\n \"lot_date\": \"2024-01-15T09:00:00+00:00\",\n \"lot_number\": \"LOT-2024-B2B\"\n }\n ],\n \"lot_date\": \"2024-01-15T09:00:00+00:00\",\n \"lot_number\": \"LOT-2024-001\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby default require 'uri' require 'net/http' url = URI("https://sandbox-api.shipbob.com/Experimental/kitting:createFromExisting") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"fulfillment_center_id\": 1,\n \"shipment_id\": 5001,\n \"end_kitted_quantity\": 10,\n \"line_item_lots\": [\n {\n \"inventory_id\": 8001,\n \"lot_date\": \"2024-01-15T09:00:00+00:00\",\n \"lot_number\": \"LOT-2024-B2B\"\n }\n ],\n \"lot_date\": \"2024-01-15T09:00:00+00:00\",\n \"lot_number\": \"LOT-2024-001\"\n}" response = http.request(request) puts response.read_body ``` ```java default import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://sandbox-api.shipbob.com/Experimental/kitting:createFromExisting") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"fulfillment_center_id\": 1,\n \"shipment_id\": 5001,\n \"end_kitted_quantity\": 10,\n \"line_item_lots\": [\n {\n \"inventory_id\": 8001,\n \"lot_date\": \"2024-01-15T09:00:00+00:00\",\n \"lot_number\": \"LOT-2024-B2B\"\n }\n ],\n \"lot_date\": \"2024-01-15T09:00:00+00:00\",\n \"lot_number\": \"LOT-2024-001\"\n}") .asString(); ``` ```php default request('POST', 'https://sandbox-api.shipbob.com/Experimental/kitting:createFromExisting', [ 'body' => '{ "fulfillment_center_id": 1, "shipment_id": 5001, "end_kitted_quantity": 10, "line_item_lots": [ { "inventory_id": 8001, "lot_date": "2024-01-15T09:00:00+00:00", "lot_number": "LOT-2024-B2B" } ], "lot_date": "2024-01-15T09:00:00+00:00", "lot_number": "LOT-2024-001" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp default using RestSharp; var client = new RestClient("https://sandbox-api.shipbob.com/Experimental/kitting:createFromExisting"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"fulfillment_center_id\": 1,\n \"shipment_id\": 5001,\n \"end_kitted_quantity\": 10,\n \"line_item_lots\": [\n {\n \"inventory_id\": 8001,\n \"lot_date\": \"2024-01-15T09:00:00+00:00\",\n \"lot_number\": \"LOT-2024-B2B\"\n }\n ],\n \"lot_date\": \"2024-01-15T09:00:00+00:00\",\n \"lot_number\": \"LOT-2024-001\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift default import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "fulfillment_center_id": 1, "shipment_id": 5001, "end_kitted_quantity": 10, "line_item_lots": [ [ "inventory_id": 8001, "lot_date": "2024-01-15T09:00:00+00:00", "lot_number": "LOT-2024-B2B" ] ], "lot_date": "2024-01-15T09:00:00+00:00", "lot_number": "LOT-2024-001" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox-api.shipbob.com/Experimental/kitting:createFromExisting")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```