Replace Asset File
Replace the bytes of a filled role deliberately, even when recipes and
themes use the asset. If-Match must name the digest the role holds
now (412 precondition_failed with current_sha256 when it does not,
428 without the header, 412 on an empty role — fill that with
add_asset_file), so a caller replaces what it looked at and never
what someone else put there in between. The same bytes again are a
no-op 200. The replaced digest keeps resolving through
download_asset_file?sha256= for the retention period, so exports made
before still work; it leaves the workspace's storage usage now.
Requires the write scope.
Authorization
apiKey First-party API key (sbk_live_…), presented as a Bearer token.
In: header
Path Parameters
uuidmesh on a mesh asset, texture on a texture asset, a channel role (albedo, normal, roughness, height, metallic, ao, emission, opacity, mask) on a material
Header Parameters
The digest the role holds now — files[role].sha256 of the asset you looked at, quoted or bare. Required: a stale value answers 412, a missing one 428.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Replace the bytes of a filled role; the precondition travels as If-Match.
Response Body
application/json
application/problem+json
curl -X PUT "https://example.com/v1/assets/497f6eca-6276-4993-bfeb-53cbbbba6f08/files/string" \ -H "Content-Type: application/json" \ -d '{ "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767" }'{ "name": "string", "description": "string", "tags": [], "metadata": {}, "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "slug": "string", "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9", "thumbnail_url": "string", "created_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z", "type": "string", "category": "string", "files": {}, "attachment": { "media_type": "image/png", "sha256": "a1abfd410973b0111c215baa879b9edcd739e601659ba44168269767cc2e9108", "uri": "https://assets.example.invalid/noise-mask.png" }, "format": "string", "resolution": [ 0 ], "shader_name": "string", "shader_parameters": {}, "texture_refs": [ { "semantic": "string", "file": "string", "asset": { "kind": "recipe", "slug": "rcp_4p8q1r5t7g3k9x2m", "uuid": "0199a1c0-0000-7000-8000-000000000013" }, "resolution": [ 0 ] } ], "meshes": [ { "slot": 0, "name": "string", "file": "string", "material": "string", "material_asset": { "kind": "recipe", "slug": "rcp_4p8q1r5t7g3k9x2m", "uuid": "0199a1c0-0000-7000-8000-000000000013" }, "metadata": {} } ], "materials": [ {} ], "textures": [ {} ], "stored_files": []}