Why am I receiving Python API HTTP Error 404 when setting inventory levels?

Topic summary

A developer is encountering an HTTP 404 error when attempting to set inventory levels via Shopify’s Python API using the ShopifyAPI module.

Key Details:

  • Authentication credentials are confirmed working (can successfully export data)
  • location_id and inventory_item_id values are verified as correct
  • Admin API has read and write permissions for inventory
  • Error occurs specifically when calling shopify.InventoryLevel.set()

Code Context:
The implementation uses session activation and the set_inventory_level() function with parameters including inventory_item_id, location_id, and disconnect_if_necessary flag.

Current Status:

  • One commenter requested store credentials via private message to investigate
  • The issue remains unresolved with the original poster seeking additional help
  • No solution or root cause has been identified yet
Summarized with AI on November 19. AI used: claude-sonnet-4-5-20250929.

Hoping someone can please be of help. We are building a basic API to set inventory levels on Shopify. We are new at this so please mind our code, if it’s wrong we would love some advice.

We are using the ShopifyApi module for python.

When we run the below code we get an error code “urllib.error.HTTPError: HTTP Error 404: Not Found”

We can confirm all of our credentials are correct as we can export from Shopify but not set inventory levels. The ‘location_id’ and ‘inventory_item_id’ are all correct as per an export we ran also.

Our admin api has inventory permissions to read and write aswell.

import shopify
import os
from dotenv import load_dotenv

load_dotenv()

token = os.getenv('TOKEN')
merchant = os.getenv('MERCHANT')

session = shopify.Session(merchant, '2023-04', token)
shopify.ShopifyResource.activate_session(session)

def set_inventory_level():
    shopify.InventoryLevel.set(78463762749, 44730407518525, 555, disconnect_if_necessary=True)

set_inventory_level()

Hi @wolfchester_aus
Can you kindly share your store link (with the password, if any) with us? We will check it and suggest you a solution if possible.

We have sent you a private message

Anybody out there that can help please?