Skip to main content
eBay Community logo
  • Home
  • News & Updates
  • Buying & Selling
    • Buying
    • Selling
    • New to selling on eBay
    • Seller Tools
    • Shipping
    • Returns
    • eBay Advertising
    • Payments
    • Mobile Apps
  • Explore Categories
      • eBay Motors
      • Electronics
      • Collectibles & Art
      • Home & Garden
      • Clothing, Shoes & Accessories
      • Toys & Hobbies
      • Sporting Goods
      • Books, Movies & Music
      • Health & Beauty
      • Business & Industrial
      • Jewelry & Watches
      • Specialty Services
      • eBay Partner Network
      • Accessibility
      • eBay Cafe
      • eBay Live
      • Community Mentors
      • APIs Feedback, Comments and Suggestions
      • Post Order APIs
      • RESTful Buy APIs
      • RESTful Sell APIs
      • Token, Messaging, Sandbox Related Issues
      • Traditional APIs
      • eBay APIs
    • Ask a Mentor
  • About
    • About the Community
    • Share Community Platform Feedback
    • Report eBay Technical Issues
    • About eBay
  • Community Events
    • Events
    • Seller Circle Hosts
    • Seller Circles
  • eBay Help
All PostsDiscussionsBlogsIdeasQuestions
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
Discussions
  • Special CategoriesChevronRightIcon
  • eBay Developers ProgramChevronRightIcon
  • RESTful Sell APIsChevronRightIcon
  • Account, Inventory, Catalog and ComplianceChevronRightIcon
Help Needed with "Invalid Request" Error When Creating Inventory Item via eBay API
                 

Hello eBay Developer Community,

 

I'm encountering an issue while attempting to create an inventory item for a sports trading card on eBay via the Sell Inventory API. Despite following the documentation and ensuring all required fields are populated, I keep receiving a `2004: Invalid request` error upon submission.

 

Code

async def create_ebay_inventory_item()-> None:
    sku = "cbfb7f2b-b099-45d1-b45c-a4fe1d488aa6"
    url_create_inventory_item = f"https://api.ebay.com/sell/inventory/v1/inventory_item/{sku}"
    inventory_item_data = {
        "sku": sku,
        "condition": "LIKE_NEW",
        "conditionDescription": "Graded - PSA 9",
        "conditionDescriptors": [
            {
            "name": "Certification Number",
            "value": "55753296"
            },
            {
            "name": "Grading Company",
            "value": "PSA"
            },
            {
            "name": "Grade",
            "value": "9"
            }
        ],
        "availability": {
            "shipToLocationAvailability": {
            "quantity": 1
            }
        },
        "product": {
            "title": "2019 Panini Prizm Goga Bitadze 264 PSA 9",
            "description": "2019 Panini Prizm Goga Bitadze card #264, graded by PSA as 9.0 (Mint). Capture a moment of NBA history with this high-demand rookie card.",
            "brand": "Panini Prizm",
            "imageUrls": [
                "https://example.com/image_front.png",
                "https://example.com/image_back.png"
            ],
            "aspects": {
            "Brand": "Panini Prizm",
            "Year": "2019",
            "Player": "Goga Bitadze",
            "Card Number": "264",
            "Type": "Sports Trading Card",
            "Sport": "Basketball"
            }
        }
    }
    
    headers = {
        'Content-Type': 'application/json',
        'Authorization': f'Bearer {token}',
        'Accept': 'application/json',
    }

    response = requests.post(url=url_create_inventory_item, headers=headers, data=json.dumps(inventory_item_data))
    if response.status_code == 200 or response.status_code == 201:
        print("Inventory item created successfully.")
        print(response)
    else:
        error_details = response.json()
        print("Error details:")
        print(json.dumps(error_details, indent=4))

Error

{
    "errors": [
        {
            "errorId": 2004,
            "domain": "ACCESS",
            "category": "REQUEST",
            "message": "Invalid request",
            "longMessage": "The request has errors. For help, see the documentation for this API."
        }
    ]
}

 

**Attempts to Resolve**:
- Verified that the OAuth token is active and has the necessary permissions.
- Ensured all required `condition`, `availability`, and `product` fields are provided, with attention to details like `brand`, `title`, and `SKU`.
- Double-checked for correct use of enumeration values (e.g., `condition` field).
- Looked into whether the SKU included in the URL might be the issue.

**Questions**:
1. Is including the SKU in the endpoint URL correct, or should it only be part of the payload?
2. Are there known issues or recent changes to the `conditionDescriptors` handling for sports trading cards that could lead to this error?
3. Could the `Invalid request` error pertain to the structure or content of the payload that isn't immediately apparent from the documentation?
4. Any suggestions or insights into what might be causing the `2004: Invalid request` error, based on the information provided?

I would greatly appreciate any guidance, insights, or suggestions you could share to help resolve this issue.

Thank you in advance for your assistance!

altxyzofficial
altxyzofficial
Posted 2 years ago·Last reply 2 years ago
                                       
         
4 comments

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
               
shipscript

shipscript

·2 years ago
111View listings

@altxyzofficial 

 

I have not used the inventory API, so this is just a general observation.

I do see a problem surrounding conditionDescriptors, but I don't know if this is the only issue.

For CCGs that are graded, the condition is 2750 (I assume either the number or the enumeration would work, but don't know that as a fact). The conditionDescriptors consist of one additionalInfo that is the certification number, and two name/value pairs for the company and the grade. These NV pairs are numerical IDs. 

 

eBay has these numerical IDs somewhere, and I got tired of looking for them for sellers who were bulk updating their listings through a CSV upload, so created a spreadsheet cheat sheet here:

https://www.shipscript.com/ebayhelp/sellerhub/example_card_revisions.htm

 

Below is the JSON structure for the createOrReplaceInventoryItem call, as shown on this page:

https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/createOrReplaceInventoryItem  

 

"condition" : "ConditionEnum : [NEW,LIKE_NEW,NEW_OTHER...]",
"conditionDescription" : "string",
"conditionDescriptors" : [
  { /* ConditionDescriptor */
    "additionalInfo" : "string",
    "name" : "string",
    "values" : [
      "string"
    ]
  }
],

 

Scroll down to "Request Fields" on the inventory page to read the highlighted notes about conditionDescriptors and trading cards:

 

"This string provides the name of a condition descriptor. A numeric ID is passed in this field. This numeric ID maps to the name of a condition descriptor. "

 

Both the name and the value are numeric IDs, thus I would refer you back to the cheat sheet that I made.  Notice that "values" is plural and is an array, but can not be an array in trading cards, so I'm not sure whether you need the array designation in  the JSON representation below.

 

        "conditionDescriptors": [
            {
            "additionalInfo": "55753296"
            },
            {
            "name": "27501",
            "values": ["275010"]
            },
            {
            "name": "27502",
            "values": ["275022"]
            }
        ]

 

As I said, I've not used the Inventory API, so take this as a suggestion of where to start experimenting. I also wonder how the inventory upload could work without a Category ID to process the trading card conditionDescriptors.

 

 

 

                                       
altxyzofficial

altxyzofficial

OP2 years ago

this might be it, i pinpointed the issue to conditionDescriptors. Will try it out tomorrow and update, Thanks for the input.

                                       
znts-wholesale-global

znts-wholesale-global

·2 years ago
1574View listings

Following payload has been working fine for me, try to compare and see the difference.

 

https://api.ebay.com/sell/inventory/v1/inventory_item/4002261

 

 

 

{ "sku": "4002261", "product": { "title": "Shock Strut Spring Assembly 2004-2008 NISSAN-MAXIMA 84002261", "aspects": { "Brand": [ "dssadsa" ], "Type": [ "Other Vintage Auto Brochures" ], "Color": [ "See pictures" ], "Item Height": [ "0 cm" ], "Style": [ "Modern" ], "MPN": [ "002261" ], "Material": [ "See description" ], "Item Length": [ "0 cm" ], "Item Depth": [ "0 cm" ], "Item Width": [ "0 cm" ] }, "brand": "ZNTS", "mpn": "GT-84002261", "imageUrls": [ "https://img-accelerate/Resources/GoodsImages/2020/202008/44861260/2008241833370241.jpg" ] }, "condition": "NEW", "availability": { "shipToLocationAvailability": { "quantity": 1, "allocationByFormat": { "auction": 0, "fixedPrice": 1 } } } }

 

 

Your "aspects" does not look correct to me, so I would recommend, take my payload and make changes and then see where it fails.

 

                                       
altxyzofficial

altxyzofficial

OP2 years ago

Thanks for helping out. I tried those and seems like the issue is around conditionDescriptors, I am not able to pinpoint what the issue there is though

                                       
                                                                                 
  •                                                              
  •                                                              
  •