Admin API "Asset" PUT method - Create a section file not working

Shopify Partner
180 37 36



I'm trying to test this endpoint to create a file in the sections folder of a selected theme. But I keep getting a non successful response.


This is the endpoint I'm working on:




app.put('/api/sections/install', async (_req, res) => {
  try {
    const session = res.locals.shopify.session
    const asset = new{ session: session })
    asset.theme_id = 97567768712
    asset.key = 'sections/test-section.liquid'
    asset.value = '<h1>This is a test section created from api</h1>'
      update: true,
    res.status(200).send({ value: asset.value, id: asset.theme_id })
  } catch (error) {
    res.status(400).send({ message: error.message })





The portion of the code that is causing the error is:




  update: true,





Please help, I have spent hours trying and searching for an answer but not getting anywhere.

Thank you in advance,

❤️ Enjoyed my Shopify customization assistance? If I've helped you achieve your goals, consider showing your appreciation with a coffee tip! It means the world to me! ️ Thank you!
Buy me a coffee here
Replies 3 (3)

Shopify Partner
2 0 1

Having a similar issue here, but with saving order updates. Any help out there???

Shopify Partner
11 0 1

I have exact similar issue. I want to update the file so that I use PUT request of asset api  and i face the error with this portion  
      update: true,
}) ;

have you found any solution?  @dannyelo 

Shopify Partner
20 0 12

Hi @dannyelo,


Seems that we have a similar problem. I have posted a workaround while we're waiting for them to fix this. I have reached out to the Shopify Partner regarding this issue and I do recommend you to send out a ticket as well.

Please refer to this link for the workaround:


Hope that helps!