Replace Asset Content
POST/api/v1/assets/:asset_id/content/original/replace
API to replace the original content file of an asset while keeping the Asset ID unchanged.
This endpoint is served on https://upload.filespin.io — not the standard https://app.filespin.io host used by the rest of the API. Make sure your client targets the upload host for this request.
Note: For replacing files from within web pages, use the File Picker in Replace mode. To add or update custom metadata for the asset during replace, see Adding metadata to the asset.
Who can replace
The asset's owner needs upload permission; anyone else needs edit access to the asset. (A user who can only view a shared asset cannot replace it.)
Formats during a replace
The current formats stay available while the new ones are generated and are then overwritten in place; formats the new file will not produce are deleted. CDN links are refreshed when processing finishes.
With content versioning
If the account has turned on content versioning, the replacement is stored as a version:
-
Keep history: it goes live at once and the previous file is kept as a previous version.
-
Release approval: it does not change the asset. The response carries
"status": "PENDING_APPROVAL"and the version number, at the top level and on the file; the current file keeps serving until someone makes the version live. Metadata sent with the replace is applied when it goes live. Only one version can wait at a time: a second replace returns409with"code": "version_pending"and the waiting version's number.Send the optional form field
needed_by(ISO 8601 date such as2026-11-02, or a date-time; UTC when no zone is given) to say when the version is needed live. It orders the release queue and the daily summary sent to the account's release roles. An invalid value is refused with400before anything is stored.
{
"files": [{"id": "99d819953914402babbdeb68337ea6a3", "name": "sample-v2.jpg", "size": 60892,
"checksum": "cd1b78e4686ae1a3cfb461a1085545f0", "content_type": "image/jpeg",
"status": "PENDING_APPROVAL", "version": 5}],
"success": true,
"provider": "local",
"status": "PENDING_APPROVAL",
"version": 5
}
Any change of the asset's live content fires the asset.replaced webhook.
Refusing stale replaces (expected_version)
Send the optional form field expected_version with the versions.live you read from Get Data. If the asset's file was replaced since, nothing is stored and the response is 409:
{
"status": "ERROR",
"code": "stale_version",
"message": "Asset 99d819953914402babbdeb68337ea6a3 is at content version 4, not 3. Re-read the asset and retry.",
"current_version": 4
}
expected_version must be a positive whole number; anything else is refused with 400. Without it the replace behaves as before. See Retries and conflicts.
HTTP RESPONSE
| Key | Value | Description |
|---|---|---|
files | JSON | List of files |
id | string | Asset ID, 32 character alphanumeric UUID |
name | string | File name |
size | integer | Size of file in bytes |
checksum | string | MD5 checksum |
content_type | string | MIME type |
provider | string | always "local" to indicate local upload |
success | boolean | true if upload completed, false otherwise |
metadata | JSON | Only returned for custom plans. Applies to image uploads. Where available, Exiftool tag values for 'ColorMode', 'ColorSpace', 'Orientation', 'Make' and 'Model' are returned. 'Width' and 'Height' are always returned |
Response JSON
{
"files": [
{
"id": "99d819953914402babbdeb68337ea6a3",
"name": "sample.jpg",
"size": 8836363,
"checksum": "5f5f26bd7c0f62c6e02e44c73d09734e",
"content_type": "image/jpeg",
"metadata": {
"Make": "Apple",
"ColorSpace": "sRGB",
"Model": "iPhone 3G",
"Orientation": "Horizontal (normal)",
"width": 1200,
"height": 800
}
}
],
"success": true,
"provider": "local"
}
Request
Responses
- 200
- 202
- 400
- 401
- 403
- 404
- 409
- 500
Asset content replaced successfully
Accepted. With release approval on, the body carries "status": "PENDING_APPROVAL" and version
needed_by is not an ISO 8601 date or date-time, or expected_version is not a positive whole number
Unauthorized
Forbidden - edit access (or, for the asset's owner, upload permission) required
Asset not found
Nothing was replaced. Either a version of this asset is already waiting for release ("code": "version_pending", with its version), or expected_version does not match the asset's live content version because the file was replaced since you read it ("code": "stale_version", with current_version; re-read the asset and retry).
Internal server error