worktrees

Ensure Worktree Endpoint

Ensure a worktree exists, creating if needed.

If name is "main", returns the main worktree. Otherwise, creates/returns a named worktree.

post/api/v1/worktrees/ensure

Request

  • Base URL
    https://docs.omnara.com (the document declares no server; this is the origin it was published from)
  • Auth
    HTTP bearer

Request body

WorktreeEnsureRequest required

Request to ensure a worktree exists, creating if needed.

workspace_id, string required

Workspace ID to create worktree in

name, string nullable

Worktree name (null for main worktree)

path, string nullable

Filesystem path for the worktree (null for main worktree)

Response

Successful Response

WorktreeDescriptor required

Serialized worktree entity returned to API clients.

id, string required

Unique worktree identifier

workspace_id, string required

Parent workspace identifier

name, string nullable

Worktree name (null for the main worktree)

is_main, boolean required

Whether this is the main/default worktree for the workspace

path, string nullable

Filesystem path for the worktree on the machine

worktree_type, 'LOCAL' | 'REMOTE' nullable

Type of worktree: LOCAL (user machine) or REMOTE (sandbox)

user_machine_path, SharedSchemasWorktreeUserMachinePathDescriptor nullable

Machine path information associated with a LOCAL worktree.

managed_machine_id, string nullable

Managed machine ID if worktree_type is REMOTE

last_heartbeat_at, string date-time nullable

Most recent liveness heartbeat received from the sandbox container (REMOTE only).

last_synced_checkpoint_id, string nullable

ID of the last checkpoint that was successfully synced to cloud storage. This may differ from current_checkpoint_id if a recent checkpoint failed to sync.

checkpoint_restore_pending, boolean

Whether a checkpoint needs to be restored on next local session start

current_checkpoint_id, string nullable

Identifier of the current checkpoint for this worktree

checkpoint_metadata, object nullable

Metadata associated with the current checkpoint (e.g., commit info)

created_at, string date-time required

Timestamp when the worktree was created

updated_at, string date-time required

Timestamp when the worktree was last updated

Changes

No recorded changes to this operation across all 1 revision of this API.