Read one source file

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

Reads one file of the working copy, or of a snapshot when you pass snapshotId. Text comes back as text; pass encoding=base64 for a file that is not text (a text read of one is refused with 422).

Requires an API key with the workspace:read 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.

Query Parameters

path*string

The file, relative to the project root, with / between folders.

Length1 <= length <= 512
snapshotId?string

Read the file as it was in this snapshot.

Formatuuid
encoding?string

utf8 (the default) or base64.

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

Response Body

The file, as text or base64

application/json
  1. response
path*string
sizeBytes*integer
Range0 <= value
sha256*string
Match^[0-9a-f]{64}$
encoding*string
Value in"utf8""base64"
content*string
Example Request
curl "https://api.vlayers.ai/v1/agents/$AGENT_ID/source/file?path=src/index.ts" \  -H "Authorization: Bearer $VOICELAYER_API_KEY"
Example Response
{  "path": "src/index.ts",  "sizeBytes": 31,  "sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",  "encoding": "utf8",  "content": "export const hello = 'world';\n"}