Skip to main content

Assets - Update asset

Route URL

PUT https://playcanvas.com/api/assets/:assetId

Description

Update an existing asset's file.

note

This endpoint currently only supports updating script, html, css, text, shader and json type assets.

Unlike other REST API endpoints. The Update Asset endpoint expects data to be sent in multipart/form-data

Example

curl -H "Authorization: Bearer {accessToken}" -X PUT -F 'pow2={pow2}' -F 'file=@./script.js' "https://playcanvas.com/api/assets/{assetId}"

Parameters

NameTypeRequiredDescription
assetIdnumber✔️The id of the asset.
filefile✔️Data to update asset file with.
pow2booleanOnly used for textures and defaults to false. Resize the texture to power of two dimensions (true / false).

Response Schema

Status: 200
{
"id": int,
"modifiedAt": date,
"createdAt": date,
"state": "ready" | "processing" | "error",
"name": string,
"type": string,
"scope":{
"type": string,
"id": int
},
"source": bool,
"sourceId": bool,
"tags": list of strings,
"preload": bool,
"data": {
... asset data
},
"file": {
"hash": string,
"filename": string,
"size": int,
"url": string
},
"parent": int
}

Errors

CodeDescription
401Unauthorized
403Forbidden
404Project or Asset not found
429Too many requests

Rate Limiting

This route uses an assets rate limit.