Skip to content

Files

Project source files are stored in a native git-backed working tree. Every file operation targets a branch (default main) — pass ?branch= (or a branch body field) to work on another branch. Writes are atomic: concurrent writers never lose updates.

GET /api/v1/projects/{id}/files

Query: content=true to include file bodies, branch (default main). Returns { files } where each entry is { path, size, locked, content? }.

Terminal window
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 bodies
GET /api/v1/projects/{id}/files/{path}

Returns { path, content, locked }.

await client.files.read(projectId, 'src/app/page.tsx')
POST /api/v1/projects/{id}/files/batch

Write one or many files in a single atomic operation. Body: files — an array of { path, content, locked? } — and optional branch. Creates files that don’t exist. Returns { written }.

Terminal window
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 },
})
POST /api/v1/projects/{id}/files/move

Body: from, to (required), optional branch. Returns { from, to }.

await client.files.move(projectId, 'src/old.ts', 'src/new.ts')
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')