Write one source file

PUT
/v1/agents/{id}/source/file

Creates or replaces one file of the working copy. A file over the plan's size limit, a tree over the file-count or size limit, or a workspace over its source limit is refused with 413 and the limit named. Nothing is billed for source storage yet; it is measured per day.

Requires an API key with the workspace:write scope.

Authorization

apiKey
headerAuthorizationBearer <token>

A secret API key from the dashboard (Developers → API keys): vl_live_…, or vl_test_… for test mode. Each operation says which scope the key needs.

Path Parameters

id*string

The agent id.

Request Body

application/json
  1. body
path*string

The file, relative to the project root, with / between folders; no leading slash and no . or .. parts.

Length1 <= length <= 512
content*string

The file's content.

encoding?string

utf8 (the default) when content is the text itself, or base64 for a file that is not text.

Default"utf8"
Value in"utf8""base64"

Response Body

The file written

application/json
  1. response
file*
created*boolean
totalBytes*integer
Range0 <= value
Example Request
curl -X PUT "https://api.vlayers.ai/v1/agents/$AGENT_ID/source/file" \  -H "Authorization: Bearer $VOICELAYER_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "path": "src/index.ts",    "content": "export const hello = 1;"  }'
Example Response
{  "file": {    "path": "src/index.ts",    "sizeBytes": 31,    "sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",    "updatedAt": "2026-10-20T15:04:05.000Z"  },  "created": true,  "totalBytes": 31}