ScenebrewDevelopers
API referenceLibrary

Add Asset File

POST
/v1/assets/{asset_id}/files

Fill an empty file role of an existing asset from an uploaded file (POST /v1/files), through the same ingest as create_asset (digest, deduplicated storage, quota). The role names what the file is for: mesh on a mesh asset, texture on a texture asset, a channel role (albedo, normal, roughness, height, metallic, ao, emission, opacity, mask) on a material. Works whether or not a recipe already references the asset. The same bytes again answer 200 with the unchanged digest. A role that holds different bytes is never replaced here: 409 role_filled names the recipes (with their slots) and themes using the asset under consumers — replace deliberately with replace_asset_file and If-Match, or create a new asset and rebind the slots that should use it. Of two concurrent fills with different bytes exactly one succeeds. Requires the write scope.

AuthorizationBearer <token>

First-party API key (sbk_live_…), presented as a Bearer token.

In: header

Path Parameters

asset_id*Asset Id
Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Fill an empty file role of an asset from an uploaded file.

Response Body

application/json

application/json

application/problem+json

curl -X POST "https://example.com/v1/assets/497f6eca-6276-4993-bfeb-53cbbbba6f08/files" \  -H "Content-Type: application/json" \  -d '{    "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",    "role": "string"  }'
{  "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": []}