> For the complete documentation index, see [llms.txt](https://developer.esw.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.esw.com/package-management/package-management-api/api-methods/create-a-new-package.md).

# Create a New Package

Create packages for checkout orders using the ESW Package Management API.

Create new packages in the ESW system using the  POST  method. You can create packages for the following types of orders:

* **Checkout**: This indicates orders that are placed through the ESW checkout.
* **Non-checkout**: This indicates orders that are placed through the retailer’s platform but delivered to the shopper by ESW. *(Coming soon)*

{% hint style="info" %}

#### Note

The documentation below covers only **Checkout Orders**.
{% endhint %}

* `tenantCode`, `orderReference`, `packageReference`, and `weight` parameters are required to create a package. If the mandatory request parameters are missing, the API returns a 400 - Bad Request message.
* If the consignee/shopper's address collected at the checkout has changed and needs to be updated, then the consignee object and its required parameters must be included in the request.
* The `packageItems` object is optional if all remaining shippable items in the order are contained in the package. If the package does not contain all remaining shippable items, then the `packageItems` object and its attributes must be included in the request.

### Handle the create response and retrieve documents

After a successful create call, read `outcome` and operation `status`. Save `package.packageReference` and `package.eShopPackageReference`. Then interpret `package.shippingStatus` separately. It reports fulfillment readiness, not label readiness.

Retrieve labels and supporting documents with:

`GET /packagemanagement/v1/{tenantCode}/documentation/{eShopPackageReference}`

The operation requires `tenantCode` and `eShopPackageReference`. It has no document-type request parameter. Select the requested record from the response by `type`, such as `ShippingLabel` or `SupportingDocumentation`. A record supplies `document`, `link`, `format`, and `documentStatus`.

| Result                                         | Action                                                                                                                           |
| ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `PackageAndLabelCreated`                       | Retrieve the requested document. Print only when its `documentStatus` is `Created`.                                              |
| `PackageCreated`                               | Save the references. Retrieve the requested document when required. A package alone does not confirm a label.                    |
| `PackageCreatedAndLabelOnHold`                 | Do not print or dispatch. Escalate the hold through the supported fulfillment process.                                           |
| `PackageCreatedAndLabelError`                  | Stop label processing. Correct the request when the error identifies a correction. Otherwise escalate.                           |
| Retrieval record has `documentStatus: Created` | The document is ready. Use its `document` or `link`.                                                                             |
| Retrieval record has `documentStatus: Error`   | Stop processing that document and escalate.                                                                                      |
| No requested record is returned                | The contract defines no processing or not-ready `documentStatus`. Wait only under an approved retry policy, then retrieve again. |

The contract does not designate any `status`, HTTP error, or document state as retryable. Honor server retry instructions when present. Use bounded backoff, never a tight polling loop. Stop and escalate when a retrieval record has `documentStatus: Error`.

When escalating, capture the tenant, order reference, package reference, `eShopPackageReference`, outcome, operation status, HTTP response, and any returned correlation or request ID.

## POST /packagemanagement/v1/{tenantCode}/orders/{orderReference}/packages

> Creates a new package for a specified tenant and order reference.

```json
{"openapi":"3.0.4","info":{"title":"Package Management API","version":"1"},"servers":[{"url":"https://api.sandbox.esw.com"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","description":"Please insert JWT with Bearer into field","name":"Authorization","in":"header"}},"schemas":{"Logistics.PackageManagement.WebApiService.Models.Requests.CreatePackageRequest":{"required":["packageReference","weight"],"type":"object","properties":{"packageReference":{"type":"string","description":"The unique reference for the package."},"weight":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Common.WeightInfo"},"shippingStatus":{"type":"string","description":"The shipping status of the package."},"goodsDescription":{"type":"string","description":"A description of the goods in the package."},"serviceLevel":{"type":"string","description":"The service level for shipping (e.g., standard, express)."},"parentOrderReference":{"type":"string","description":"The reference of the parent order associated with this package."},"eswCarrierIdentifier":{"type":"string","description":"The identifier for the carrier (e.g., ESW carrier code)."},"carrierReference":{"type":"string","description":"The carrier's reference for the package."},"originFulfillmentCentreCode":{"type":"string","description":"The code of the origin fulfillment center."},"shippingInfo":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Common.PriceInfo"},"insuranceInfo":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Common.PriceInfo"},"dangerousGoodsInfo":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Common.DangerousGoodsInfo"},"dimensionInfo":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Requests.DimensionInfoRequest"},"consigneeAddress":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Common.Address"},"packageItems":{"type":"array","items":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Common.PackageItem"},"description":"A list of items contained within the package."},"metaData":{"type":"string","description":"Additional metadata related to the package.","format":"json"}},"additionalProperties":false,"description":"Represents the request payload for creating a package."},"Logistics.PackageManagement.WebApiService.Models.Common.WeightInfo":{"required":["weight","weightUnit"],"type":"object","properties":{"weight":{"type":"number","description":"The weight value of the package or item.","format":"double"},"weightUnit":{"type":"string","description":"The unit of measurement for the weight (e.g., kg, lb)."}},"additionalProperties":false,"description":"Represents the weight information of a package or item."},"Logistics.PackageManagement.WebApiService.Models.Common.PriceInfo":{"required":["amount","currency"],"type":"object","properties":{"amount":{"type":"number","description":"The monetary amount of the price.","format":"decimal"},"currency":{"type":"string","description":"The currency code (e.g., USD, EUR) for the price."}},"additionalProperties":false,"description":"Represents pricing information including amount and currency."},"Logistics.PackageManagement.WebApiService.Models.Common.DangerousGoodsInfo":{"type":"object","properties":{"dangerousGoods":{"type":"boolean","description":"Indicates whether the package contains dangerous goods."},"dangerousGoodsClassificationCode":{"type":"string","description":"The classification code for the dangerous goods."},"dangerousGoodsUnNumber":{"type":"string","description":"The United Nations (UN) number assigned to the dangerous goods."},"dangerousGoodsContentId":{"type":"string","description":"The content ID associated with the dangerous goods."}},"additionalProperties":false,"description":"Represents details about dangerous goods contained in the package."},"Logistics.PackageManagement.WebApiService.Models.Requests.DimensionInfoRequest":{"required":["height","length","measurementUnit","width"],"type":"object","properties":{"length":{"type":"number","description":"The length of the package.","format":"double"},"width":{"type":"number","description":"The width of the package.","format":"double"},"height":{"type":"number","description":"The height of the package.","format":"double"},"measurementUnit":{"type":"string","description":"The unit of measurement for the dimensions (e.g., cm, inches)."},"weight":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Common.WeightInfo"}},"additionalProperties":false},"Logistics.PackageManagement.WebApiService.Models.Common.Address":{"required":["address1","city","countryIso","email","firstName","lastName","telephone"],"type":"object","properties":{"firstName":{"type":"string","description":"The first name of the recipient."},"lastName":{"type":"string","description":"The last name of the recipient."},"address1":{"type":"string","description":"The first line of the address."},"address2":{"type":"string","description":"The second line of the address (optional)."},"address3":{"type":"string","description":"The third line of the address (optional)."},"city":{"type":"string","description":"The city of the address."},"poBox":{"type":"string","description":"The Post Office (PO) Box number, if applicable."},"region":{"type":"string","description":"The region or state of the address."},"postalCode":{"type":"string","description":"The postal or ZIP code of the address."},"countryIso":{"type":"string","description":"The alpha-2 character ISO code of the country."},"email":{"type":"string","description":"The email address of the recipient."},"telephone":{"type":"string","description":"The telephone number of the recipient."}},"additionalProperties":false,"description":"Represents the address information of a consignee."},"Logistics.PackageManagement.WebApiService.Models.Common.PackageItem":{"required":["productCode","quantity"],"type":"object","properties":{"productCode":{"type":"string","description":"The unique product code for the item."},"lineItemId":{"type":"integer","description":"The line item ID associated with the item, if applicable.","format":"int32"},"quantity":{"type":"integer","description":"The quantity of the item included in the package.","format":"int32"},"productDescription":{"type":"string","description":"A description of the product."},"productCustomsDescription":{"type":"string","description":"A description of the product for customs purposes."},"countryOfOriginIso":{"type":"string","description":"The ISO code of the country where the product originated."},"weight":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Common.WeightInfo"},"unitPriceInfo":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Common.PriceInfo"},"dangerousGoods":{"type":"boolean","description":"Indicates if the item is classified as dangerous goods."},"hsCode":{"type":"string","description":"The Harmonized System (HS) code for the item."},"metaData":{"type":"string","description":"Additional metaDataParsed associated with the item.","format":"json"}},"additionalProperties":false,"description":"Represents an individual item within a package."},"Logistics.PackageManagement.WebApiService.Models.Responses.CreatePackageResponse":{"type":"object","properties":{"outcome":{"$ref":"#/components/schemas/Logistics.PackageManagement.Domain.Enums.Outcome"},"status":{"type":"string","description":"The status of the shipping documentation generation."},"package":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Responses.PackageResponse"}},"additionalProperties":false,"description":"Represents the response returned after creating a package."},"Logistics.PackageManagement.Domain.Enums.Outcome":{"enum":["PackageCreated","PackageAndLabelCreated","PackageCreatedAndLabelError","PackageCreatedAndLabelOnHold","PackageAndLabelUpdated","PackageUpdatedAndLabelError","PackageUpdated"],"type":"string"},"Logistics.PackageManagement.WebApiService.Models.Responses.PackageResponse":{"type":"object","properties":{"tenantCode":{"type":"string","description":"The tenant code associated with the packageWithShippingDoc."},"orderReference":{"type":"string","description":"The order reference associated with the packageWithShippingDoc."},"packageReference":{"type":"string","description":"A unique reference for the packageWithShippingDoc."},"eShopPackageReference":{"type":"string","description":"A unique eShop packageWithShippingDoc reference."},"eswCarrierIdentifier":{"type":"string","description":"The carrier identifier used by ESW for the packageWithShippingDoc."},"carrierReference":{"type":"string","description":"The carrier reference number for the packageWithShippingDoc."},"parcelCarrierReference":{"type":"string","description":"The parcel carrier reference number for the packageWithShippingDoc."},"weight":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Common.WeightInfo"},"shippingStatus":{"$ref":"#/components/schemas/Logistics.PackageManagement.Domain.Enums.ShippingStatus"},"goodsDescription":{"type":"string","description":"A description of the goods contained in the packageWithShippingDoc."},"originFulfillmentCentreCode":{"type":"string","description":"The code of the origin fulfillment center."},"serviceLevel":{"$ref":"#/components/schemas/Logistics.PackageManagement.Domain.Enums.ServiceLevel"},"dangerousGoods":{"type":"boolean","description":"Indicates if the packageWithShippingDoc contains dangerous goods."},"dimensionInfo":{"type":"array","items":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Responses.DimensionInfoResponse"},"description":"A list of dimensions for the packageWithShippingDoc."},"holdReleaseStatus":{"$ref":"#/components/schemas/Logistics.PackageManagement.Domain.Enums.HoldReleaseStatus"},"palletIdentifier":{"type":"string","description":"A unique identifier for the pallet associated with the packageWithShippingDoc."},"trackingUrl":{"type":"string","description":"The tracking URL for the packageWithShippingDoc.","format":"uri"},"consigneeAddress":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Common.Consignee"},"shippingInfo":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Common.PriceInfo"},"packageItems":{"type":"array","items":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Common.PackageItem"},"description":"A list of items contained in the packageWithShippingDoc."},"metaData":{"type":"string","description":"Additional metadata associated with the packageWithShippingDoc."},"shippingDocumentation":{"type":"array","items":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Responses.DocumentResponse"},"description":"Shipping documentation details for the packageWithShippingDoc."}},"additionalProperties":false,"description":"Represents a packageWithShippingDoc with its associated details."},"Logistics.PackageManagement.Domain.Enums.ShippingStatus":{"enum":["Complete","Pending"],"type":"string"},"Logistics.PackageManagement.Domain.Enums.ServiceLevel":{"enum":["POST","EXP2","PUDO"],"type":"string"},"Logistics.PackageManagement.WebApiService.Models.Responses.DimensionInfoResponse":{"required":["height","length","measurementUnit","width"],"type":"object","properties":{"source":{"type":"string","description":"The source of the dimension information, such as the carrier or system that provided it.","readOnly":true},"length":{"type":"number","description":"The length of the package.","format":"double"},"width":{"type":"number","description":"The width of the package.","format":"double"},"height":{"type":"number","description":"The height of the package.","format":"double"},"measurementUnit":{"type":"string","description":"The unit of measurement for the dimensions (e.g., cm, inches)."},"weight":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Common.WeightInfo"}},"additionalProperties":false},"Logistics.PackageManagement.Domain.Enums.HoldReleaseStatus":{"enum":["Release","Hold","ReturnToRetailer"],"type":"string"},"Logistics.PackageManagement.WebApiService.Models.Common.Consignee":{"type":"object","properties":{"firstName":{"type":"string","description":"The first name of the consignee."},"lastName":{"type":"string","description":"The last name of the consignee."},"address1":{"type":"string","description":"The first line of the consignee's address."},"address2":{"type":"string","description":"The second line of the consignee's address (optional)."},"address3":{"type":"string","description":"The third line of the consignee's address (optional)."},"city":{"type":"string","description":"The city where the consignee resides."},"postalCode":{"type":"string","description":"The postal or ZIP code of the consignee's address."},"poBox":{"type":"string","description":"The Post Office (PO) Box number, if applicable."},"region":{"type":"string","description":"The region or state where the consignee resides."},"countryIso":{"type":"string","description":"The alpha-2 character ISO code of the country."},"email":{"type":"string","description":"The email address of the consignee."},"telephone":{"type":"string","description":"The telephone number of the consignee."}},"additionalProperties":false,"description":"Represents information about the consignee (recipient) of a package."},"Logistics.PackageManagement.WebApiService.Models.Responses.DocumentResponse":{"type":"object","properties":{"document":{"type":"string","description":"The content of the document."},"type":{"$ref":"#/components/schemas/Logistics.PackageManagement.Domain.Enums.DocumentType"},"format":{"$ref":"#/components/schemas/Logistics.PackageManagement.Domain.Enums.LabelFormat"},"link":{"type":"string","description":"A link to the document, if available."},"documentStatus":{"$ref":"#/components/schemas/Logistics.PackageManagement.Domain.Enums.DocumentStatus"}},"additionalProperties":false,"description":"Represents the shipping documentation details for a package."},"Logistics.PackageManagement.Domain.Enums.DocumentType":{"enum":["HubHandlingLabel","ShippingLabel","SupportingDocumentation","AdditionalDocumentation"],"type":"string"},"Logistics.PackageManagement.Domain.Enums.LabelFormat":{"enum":["Zpl","Pdf","NoLabel"],"type":"string"},"Logistics.PackageManagement.Domain.Enums.DocumentStatus":{"enum":["Created","Error"],"type":"string"},"Logistics.PackageManagement.WebApiService.Models.Responses.ErrorResponse":{"type":"object","properties":{"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"description":"A collection of errors where the key is the field name and the value is a list of error messages."},"type":{"type":"string","description":"The type of error encountered."},"title":{"type":"string","description":"A brief title or summary of the error."},"status":{"type":"integer","description":"The HTTP status code associated with the error.","format":"int32"},"detail":{"type":"string","description":"Detailed information about the error."},"instance":{"type":"string","description":"An instance identifier for tracing the error."},"additionalProp1":{"type":"string","description":"Additional property 1, used for custom data."},"additionalProp2":{"type":"string","description":"Additional property 2, used for custom data."},"additionalProp3":{"type":"string","description":"Additional property 3, used for custom data."},"traceId":{"type":"string","description":"A trace identifier for debugging or logging purposes."}},"additionalProperties":false,"description":"Represents an error response containing detailed information about validation or server errors."}}},"paths":{"/packagemanagement/v1/{tenantCode}/orders/{orderReference}/packages":{"post":{"tags":["Package"],"summary":"Creates a new package for a specified tenant and order reference.","parameters":[{"name":"tenantCode","in":"path","required":true,"schema":{"type":"string"}},{"name":"orderReference","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"The request payload containing package details.","content":{"application/json-patch+json":{"schema":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Requests.CreatePackageRequest"}},"application/json":{"schema":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Requests.CreatePackageRequest"}},"text/json":{"schema":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Requests.CreatePackageRequest"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Requests.CreatePackageRequest"}}}},"responses":{"201":{"description":"Package created successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Responses.CreatePackageResponse"}}}},"400":{"description":"Invalid request payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Responses.ErrorResponse"}}}},"401":{"description":"Unauthenticated client.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Responses.ErrorResponse"}}}},"403":{"description":"Client does not have access rights to the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Responses.ErrorResponse"}}}},"404":{"description":"Requested resource does not exist (tenantCode or orderReference).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Responses.ErrorResponse"}}}},"409":{"description":"Package already exists with the package reference supplied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Responses.ErrorResponse"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Responses.ErrorResponse"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.esw.com/package-management/package-management-api/api-methods/create-a-new-package.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
