Files
Project source files are stored in a native git-backed working tree on the project’s main branch. Writes are atomic: concurrent writers never lose updates. Use Versions to checkpoint and restore the tree.
List files
Section titled “List files”GET /api/v1/projects/{id}/filesQuery: content=true to include file bodies. Returns { files } where each entry is { path, size, locked, content? }.
curl "https://www.frontend.co/api/v1/projects/$ID/files" \ -H "Authorization: Bearer $FRONTEND_API_KEY"await client.files.list(projectId) // { content: true } to include bodiesRead a file
Section titled “Read a file”GET /api/v1/projects/{id}/files/{path}Returns { path, content, locked }.
await client.files.read(projectId, 'src/app/page.tsx')Write files
Section titled “Write files”POST /api/v1/projects/{id}/files/batchWrite one or many files in a single atomic operation. Body: files — an array of { path, content, locked? }. Creates files that don’t exist. Returns { written }.
curl -X POST "https://www.frontend.co/api/v1/projects/$ID/files/batch" \ -H "Authorization: Bearer $FRONTEND_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "files": [{ "path": "src/lib/utils.ts", "content": "export const x = 1" }] }'await client.files.write(projectId, 'src/lib/utils.ts', code)await client.files.writeMany(projectId, { 'src/a.ts': { content: '…' }, 'src/b.ts': { content: '…', locked: true },})Move a file
Section titled “Move a file”POST /api/v1/projects/{id}/files/moveBody: from, to (required). Returns { from, to }.
await client.files.move(projectId, 'src/old.ts', 'src/new.ts')Delete a file
Section titled “Delete a file”DELETE /api/v1/projects/{id}/files/{path}Deletes a file (a directory path deletes the subtree). Returns { path }.
await client.files.delete(projectId, 'src/unused.ts')