Skip to content

Replace media

POST/admin/v1/stores/{store_id}/media/{media_id}/replacement
  • products:write
  • content:write
  • Idempotency-Key supported

Reserve new bytes under the same media ID, so everything that uses the file shows the new one. Send the file to the files edge as upload says, then call …/replacement/complete with the edge's receipt. The new file must be the same kind.

Path parameters

  • store_idstringrequired

    The store's ID, like store_01k8qs5s…. Apps get it with the install, in the OAuth redirect and the token response.

  • media_idstringrequired

    The media's ID, like med_01k8qs5s….

Headers

  • Idempotency-Keystring

    Send the same key to retry safely: the first answer is replayed for 24 hours.

  • shop-api-versionYYYY-MM

    The version to answer in. Without it, your app’s pinned version, else the newest.

Body

  • filenamestringrequired
  • content_typestringrequired
  • size_bytesintegerrequired

Returns

201 Replacement slot created.

Errors

  • 404not_foundNo such media.
  • 409The file isn't uploaded yet.
  • 422validation_failedUnsupported type, size or name, or another kind of file.