Skip to content

Versions

A version is a checkpoint of all of a project’s files on its main branch. Under the hood every version is a commit in the project’s native git store, so ids are commit SHAs. Creating a version also syncs to a connected GitHub repository when one is linked.

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

Returns the latest 50 versions, newest first: { versions } — each { id, message, author_id, created_at }.

Terminal window
curl "https://www.frontend.co/api/v1/projects/$ID/versions" \
-H "Authorization: Bearer $FRONTEND_API_KEY"
const versions = await client.versions.list(projectId)
POST /api/v1/projects/{id}/versions

Snapshots all current project files (there is no staging index). Body: message (required). Returns { version: { id, message } } with 201.

Terminal window
curl -X POST "https://www.frontend.co/api/v1/projects/$ID/versions" \
-H "Authorization: Bearer $FRONTEND_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "message": "Before refactor" }'
const { id } = await client.versions.create(projectId, 'Before refactor')
GET /api/v1/projects/{id}/versions/{versionId}

Returns the version plus the project files as they were at that point: { version: { id, message, author_id, created_at, files } }.

const version = await client.versions.get(projectId, id)
POST /api/v1/projects/{id}/versions/{versionId}/restore

Makes that version’s files current again. The restore is recorded as a new version on main, so nothing is lost. Returns { restored, version: { id } } where restored is the id you passed and version.id is the new version.

await client.versions.restore(projectId, id)