Replace an asset's file
/assets/{id}/replaceCosts 2 rate-limit points · Rate limits
Replace the file body of an existing internal asset in place. The asset
ID and all digital-product / order links are preserved, so you don't have
to re-attach the new file: buyers downloading the asset receive the new
body automatically.
Like creating an internal asset, the response includes a single
presigned PUT URL. Upload the new file body to that URL to finish. The
previous file is removed once the replacement is committed, and any
watermarking is re-applied to the new body.
Only internal assets can be replaced. Plan storage quota is enforced on
the growth in size; the per-file ceiling is 2 GB.
Path parameters
idstringRequiredThe asset ID
Headers
X-Auth-TokenstringRequiredAPI key for authentication
Request body
assetobjectRequiredShow 3 child attributesHide child attributes
filenamestringRequiredSuggested attachment name on download for the new file.
byte_sizeintegerRequiredSize of the new file in bytes. Must be positive and at most 2 GB.
content_typestringOptional MIME type for the new file. Defaults to the asset's current content type, or
application/octet-stream.
Returns
assetobjectShow 11 child attributesHide child attributes
idstringUnique asset identifier
typestringThe asset type.
internalfor uploaded files,externalfor URL-based assets,licencefor licence key assets.One ofinternalexternallicencenamestring, nullableDisplay name of the asset.
filenamestring, nullableFilename of the asset (derived from the file or URL).
external_urlstring, nullableThe external URL for
externaltype assets.nullfor other types.content_typestring, nullableMIME type of the asset.
byte_sizeintegerFile size in bytes.
0for external and licence assets.watermark_assetbooleanWhether watermarking is enabled for this asset (PDFs only).
autogenerate_licence_keybooleanWhether a licence key is auto-generated when this asset is purchased.
created_atstringWhen the asset was created.
updated_atstringWhen the asset was last updated.
uploadobjectSingle-PUT upload handle for the new file body.
Show 4 child attributesHide child attributes
methodstringExample:PUTOne ofPUTurlstringExample:https://example.comheadersobjectexpires_atstringExample:2026-01-15T09:30:00Z
Errors
Resource not found
Validation failed
curl -X POST "https://app.filemonk.io/api/v1/external/assets/{id}/replace" \
-H "X-Auth-Token: $FILEMONK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"asset": {
"filename": "string",
"byte_size": 1,
"content_type": "string"
}
}'const res = await fetch("https://app.filemonk.io/api/v1/external/assets/{id}/replace", {
method: "POST",
headers: {
"X-Auth-Token": process.env.FILEMONK_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
"asset": {
"filename": "string",
"byte_size": 1,
"content_type": "string"
}
}),
});
const data = await res.json();import os
import requests
res = requests.post(
"https://app.filemonk.io/api/v1/external/assets/{id}/replace",
headers={"X-Auth-Token": os.environ["FILEMONK_API_KEY"]},
json={
"asset": {
"filename": "string",
"byte_size": 1,
"content_type": "string"
}
},
)
data = res.json()require "net/http"
require "json"
uri = URI("https://app.filemonk.io/api/v1/external/assets/{id}/replace")
req = Net::HTTP::Post.new(uri, "X-Auth-Token" => ENV["FILEMONK_API_KEY"], "Content-Type" => "application/json")
req.body = {
asset: {
filename: "string",
byte_size: 1,
content_type: "string"
}
}.to_json
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body){
"asset": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"type": "external",
"name": "Photoshop Brushes Pack",
"filename": "brushes-pack-v2.zip",
"external_url": "https://cdn.example.com/files/brushes-pack-v2.zip",
"content_type": "application/zip",
"byte_size": 0,
"watermark_asset": false,
"autogenerate_licence_key": false,
"created_at": "2026-01-15T09:30:00Z",
"updated_at": "2026-01-15T09:30:00Z"
},
"upload": {
"method": "PUT",
"url": "https://example.com",
"headers": {},
"expires_at": "2026-01-15T09:30:00Z"
}
}{
"error": "API key is required"
}{
"error": "Resource not found"
}