# Create Tracking

**URL:** <https://community.shopify.dev/t/create-tracking/20705>\
**Category:** GraphQL Admin API Troubleshooting\
**Tags:** general-gql-troubles\
**Created:** [August 6, 2025, 8:55am UTC](https://community.shopify.dev/t/create-tracking/20705 "2025-08-06T08:55:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Wolf](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@Paul\_Wolf](https://community.shopify.dev/u/Paul_Wolf)\
**Post date:** [August 6, 2025, 8:55am UTC](https://community.shopify.dev/t/create-tracking/20705/1 "2025-08-06T08:55:16Z")

</div>

Hi everyone,

I’m trying to add tracking information to a paid fulfillment order using the Shopify API. I send a POST request to the fulfillment orders endpoint with the following payload and code. However, I don’t get any useful error message or response indicating success or failure.

Here is the code I use:

php

KopierenBearbeiten

```auto
$data = [
    'fulfillment' => [
        'message' => 'The package was shipped this morning.',
        'notify_customer' => false,
        'tracking_info' => [
            'number' => '00340434467160030320',
            'company' => 'DHL'
        ],
        'line_items_by_fulfillment_order' => [[
            'fulfillment_order_id' => 11708472918365,
            'fulfillment_order_line_items' => [[
                'id' => 34823647822173,
                'quantity' => 1
            ]]
        ]]
    ]
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url . '/fulfillments.json');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'X-Shopify-Access-Token: ' . $access_token,
    'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Curl error: ' . curl_error($ch);
}

curl_close($ch);

$shopify_response = json_decode($response, true);
echo "<pre>";
print_r($shopify_response);
echo "</pre>";

```

I expect either a confirmation or an error message, but the response is either empty or unclear. Has anyone encountered this before or knows what might be missing?

Thanks in advance!

* * *

Would you like me to help you tweak the code or check for common pitfalls in this request?

---

<div class="post-metadata">

**Author:** ![Luke](https://sea1.discourse-cdn.com/shopifycommunity/user_avatar/community.shopify.dev/luke/32/22023_2.png) [@Luke](https://community.shopify.dev/u/Luke)\
**Post date:** [August 6, 2025, 9:47am UTC](https://community.shopify.dev/t/create-tracking/20705/2 "2025-08-06T09:47:30Z")

</div>

I’d probably look at moving over to GraphQL first as REST is now deprecated.

> **[fulfillmentCreateV2 - GraphQL Admin](https://shopify.dev/docs/api/admin-graphql/latest/mutations/fulfillmentCreateV2)**
>
> Creates a fulfillment for one or many fulfillment orders.
> The fulfillment orders are associated with the same order and are assigned to the same location.

---

<div class="post-metadata">

**Author:** ![Paul\_Wolf](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@Paul\_Wolf](https://community.shopify.dev/u/Paul_Wolf)\
**Post date:** [August 6, 2025, 11:19am UTC](https://community.shopify.dev/t/create-tracking/20705/3 "2025-08-06T11:19:33Z")

</div>

I have already tried it with GraphQL unfortunately without success

I’m starting to wonder if I’m using the right call I’ve already tried everything I could think of

// GraphQL-Mutation  
$query = \<\<\<GQL  
mutation fulfillmentCreate($fulfillment: FulfillmentInput!, $message: String) {  
fulfillmentCreate(fulfillment: $fulfillment, message: $message) {  
fulfillment {  
id  
status  
trackingInfo {  
number  
url  
company  
}  
}  
userErrors {  
field  
message  
}  
}  
}  
GQL;

// Variablen für die Mutation  
$variables = [  
‘fulfillment’ =\> [  
‘trackingInfo’ =\> [  
‘number’ =\> ‘00340434467160030320’,  
‘url’ =\> ‘[DHL Sendungsverfolgung - den Status Ihrer Pakete verfolgen | DHL](https://www.dhl.de/de/privatkunden/dhl-sendungsverfolgung.html?piececode=00340434467160030320)’,  
‘company’ =\> ‘DHL’,  
],  
‘notifyCustomer’ =\> true,  
‘lineItemsByFulfillmentOrder’ =\> [  
[  
‘fulfillmentOrderId’ =\> ‘gid://shopify/Order/11708472918365’,  
‘fulfillmentOrderLineItems’ =\> [  
// Mindestens ein LineItem notwendig, sonst schlägt es fehl  
[  
‘id’ =\> ‘gid://shopify/LineItem/34823647822173’, // ← Anpassen  
‘quantity’ =\> 1  
]  
]  
]  
]  
],  
‘message’ =\> ‘Deine Bestellung wurde versendet!’  
];

// API-Anfrage vorbereiten  
$payload = json\_encode([  
‘query’ =\> $query,  
‘variables’ =\> $variables  
]);

$ch = curl\_init(“https://$shop/admin/api/2023-10/graphql.json”);  
curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, true);  
curl\_setopt($ch, CURLOPT\_POSTFIELDS, $payload);  
curl\_setopt($ch, CURLOPT\_HTTPHEADER, [  
“Content-Type: application/json”,  
“X-Shopify-Access-Token: $accessToken”  
]);

// Anfrage ausführen  
$response = curl\_exec($ch);  
$httpCode = curl\_getinfo($ch, CURLINFO\_HTTP\_CODE);  
curl\_close($ch);

// Antwort anzeigen  
$shopify\_orders = json\_decode($response, TRUE);  
echo “

```
”;print_r($shopify_orders);echo “
```
”;

//Response  
Array  
(  
[errors] =\> Array  
(  
[0] =\> Array  
(  
[message] =\> invalid id  
[locations] =\> Array  
(  
[0] =\> Array  
(  
[line] =\> 3  
[column] =\> 3  
)

```
                    )

                [path] => Array
                    (
                        [0] => fulfillmentCreate
                    )

                [extensions] => Array
                    (
                        [code] => RESOURCE_NOT_FOUND
                    )

            )

    )

[data] => Array
    (
        [fulfillmentCreate] => 
    )

[extensions] => Array
    (
        [cost] => Array
            (
                [requestedQueryCost] => 11
                [actualQueryCost] => 1
                [throttleStatus] => Array
                    (
                        [maximumAvailable] => 2000
                        [currentlyAvailable] => 1999
                        [restoreRate] => 100
                    )

            )

    )

```

)

---

<div class="post-metadata">

**Author:** ![Luke](https://sea1.discourse-cdn.com/shopifycommunity/user_avatar/community.shopify.dev/luke/32/22023_2.png) [@Luke](https://community.shopify.dev/u/Luke)\
**Post date:** [August 6, 2025, 11:28am UTC](https://community.shopify.dev/t/create-tracking/20705/4 "2025-08-06T11:28:49Z")

</div>

You’re not passing the right IDs.

`fulfillmentOrderId` should be like `gid://shopify/FulfillmentOrder/7808748126545`

And `id` for the line items should be like `gid://shopify/FulfillmentOrderLineItem/17009801462097`

---

<div class="post-metadata">

**Author:** ![Paul\_Wolf](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@Paul\_Wolf](https://community.shopify.dev/u/Paul_Wolf)\
**Post date:** [August 6, 2025, 11:48am UTC](https://community.shopify.dev/t/create-tracking/20705/5 "2025-08-06T11:48:56Z")

</div>

> [@Luke](#):
>
> `fulfillmentOrderId` should be like `gid://shopify/FulfillmentOrder/7808748126545`
> 
> And `id` for the line items should be like `gid://shopify/FulfillmentOrderLineItem/17009801462097`

when i change it to that i get the following error message i already tried that too i double and triple checked the ids it’s the orderids and the line ids am i missing a step in between?

Array  
(  
[data] =\> Array  
(  
[fulfillmentCreate] =\> Array  
(  
[fulfillment] =\>  
[userErrors] =\> Array  
(  
[0] =\> Array  
(  
[field] =\> Array  
(  
[0] =\> fulfillment  
)

```
                                [message] => Fulfillment order does not exist.
                            )

                    )

            )

    )

[extensions] => Array
    (
        [cost] => Array
            (
                [requestedQueryCost] => 11
                [actualQueryCost] => 10
                [throttleStatus] => Array
                    (
                        [maximumAvailable] => 2000
                        [currentlyAvailable] => 1990
                        [restoreRate] => 100
                    )

            )

    )

```

)

---

<div class="post-metadata">

**Author:** ![Luke](https://sea1.discourse-cdn.com/shopifycommunity/user_avatar/community.shopify.dev/luke/32/22023_2.png) [@Luke](https://community.shopify.dev/u/Luke)\
**Post date:** [August 6, 2025, 12:00pm UTC](https://community.shopify.dev/t/create-tracking/20705/6 "2025-08-06T12:00:55Z")

</div>

Have you actually used the correct ID though? Not just changed it from `Order` to `FulfillmentOrder`? They will be completley different IDs.

I suggest looking into how fulfillments work.

> **[FulfillmentOrder - GraphQL Admin](https://shopify.dev/docs/api/admin-graphql/latest/objects/FulfillmentOrder)**
>
> The FulfillmentOrder object represents either an item or a group of items in an
> \[Order\](https://shopify.dev/api/admin-graphql/latest/objects/Order)
> that are expected to be fulfilled from the same location.
> There can be more than one fulfillment order...

 ![image](https://global.discourse-cdn.com/shopifycommunity/original/2X/9/97f1dad4fda0ff5879dd116d75074e8f2097e7ae.png)

---

<div class="post-metadata">

**Author:** ![Paul\_Wolf](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@Paul\_Wolf](https://community.shopify.dev/u/Paul_Wolf)\
**Post date:** [August 6, 2025, 12:25pm UTC](https://community.shopify.dev/t/create-tracking/20705/7 "2025-08-06T12:25:25Z")

</div>

> [@Luke](#):
>
> FulfillmentOrder

thanks it worked now but it is very cumbersome because every order and every article has two different ids and you have to query them in two different ways makes no sense

thank you very much for your help
