Error while creating Fulfillment via API

Topic summary

A developer is encountering a 422 error when attempting to create a fulfillment via API. The error message states “Fulfillment payloads fulfillment order must be greater than 0.”

Root Cause:
The request is missing the required fulfillment_order_id parameter in the line_items_by_fulfillment_order array.

Recommended Solution:

  • Include the fulfillment_order_id for each line item in the request payload
  • If the fulfillment order ID is unknown, retrieve it first by making a GET request to the Fulfillment Orders endpoint: GET /admin/api/2023-10/orders/{order_id}/fulfillment_orders.json
  • Ensure the request structure follows the correct format with all required parameters
  • Consult the official Shopify Fulfillment API documentation for detailed parameter requirements

Status: The issue remains unresolved pending implementation of the suggested fixes.

Summarized with AI on November 5. AI used: claude-sonnet-4-5-20250929.

Using the fullfillment API , to create fullfillment but getting :

422 Unprocessable Content

{
“errors”: [
“Fulfillment payloads fulfillment order must be greater than 0”
]
}

Request :

{
“fulfillment”: {
“location_id”: 78882865367,
“tracking_number”: “123456789”,

“line_items_by_fulfillment_order”: [
{
“id”: 14073330565335,
“quantity”: 1
}
]
}
}

This is Amelia from PageFly - Landing Page Builder App

To troubleshoot and resolve this issue, please follow these steps:

  1. Include Fulfillment Order ID:
    Ensure that the line_items_by_fulfillment_order array contains the fulfillment_order_id for each line item. This ID is crucial for the API to process the fulfillment correctly.

  2. Correct Request Format:
    Make sure your request includes the fulfillment_order_id. Here’s an example of how your request should be structured:

    json

{
  "fulfillment": {
    "location_id": 78882865367,
    "tracking_number": "123456789",
    "line_items_by_fulfillment_order": [
      {
        "fulfillment_order_id": 1234567890,  // Replace with the actual fulfillment order ID
        "line_items": [
          {
            "id": 14073330565335,
            "quantity": 1
          }
        ]
      }
    ]
  }
}​

Please review this AI-generated code and use it carefully. For more information, refer to the FAQ.

  1. Retrieve Fulfillment Order ID:
    If you don’t have the fulfillment_order_id, you’ll need to retrieve it first. Make a GET request to the Fulfillment Orders endpoint using the following format:
GET /admin/api/2023-10/orders/{order_id}/fulfillment_orders.json

This will return a list of fulfillment orders for the specified order, allowing you to obtain the fulfillment_order_id.

  1. Consult API Documentation:
    Refer to the Shopify Fulfillment API documentation for detailed information regarding the required parameters and request structure.

Hope that my solution works for you.

Best regards,

Amelia | PageFly

1 Like