Omnara Worktrees API

The worktrees API from Omnara — 5 operation(s) for worktrees.

GitHub OpenAPI

Operations 5

GET /api/v1/worktrees/{worktree_id} Get Worktree Endpoint #
GET /api/v1/worktrees/workspace/{workspace_id} List Workspace Worktrees #
POST /api/v1/worktrees/ensure Ensure Worktree Endpoint #
PATCH /api/v1/worktrees/session/{session_id} Set User Session Worktree #
POST /api/v1/worktrees/{worktree_id}/migrate Migrate Worktree #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/omnara-com:omnara-com-worktrees-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

omnara-com-worktrees-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Omnara Worktrees API
  description: UNSTABLE -- This API is under active development. Endpoints, request/response shapes, and authentication requirements may change without notice. Do not build production integrations against these endpoints without contacting the Omnara team first.
  version: 0.1.0-unstable
tags:
- name: worktrees
paths:
  /api/v1/worktrees/{worktree_id}:
    get:
      tags:
      - worktrees
      summary: Get Worktree Endpoint
      description: Get a worktree by ID.
      operationId: get_worktree_endpoint_api_v1_worktrees__worktree_id__get
      security:
      - HTTPBearer: []
      parameters:
      - name: worktree_id
        in: path
        required: true
        schema:
          type: string
          title: Worktree Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorktreeDescriptor'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-stability: unstable
  /api/v1/worktrees/workspace/{workspace_id}:
    get:
      tags:
      - worktrees
      summary: List Workspace Worktrees
      description: List all worktrees for a workspace.
      operationId: list_workspace_worktrees_api_v1_worktrees_workspace__workspace_id__get
      security:
      - HTTPBearer: []
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          title: Workspace Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/WorktreeDescriptor'
                title: Response List Workspace Worktrees Api V1 Worktrees Workspace  Workspace Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-stability: unstable
  /api/v1/worktrees/ensure:
    post:
      tags:
      - worktrees
      summary: Ensure Worktree Endpoint
      description: 'Ensure a worktree exists, creating if needed.


        If name is "main", returns the main worktree.

        Otherwise, creates/returns a named worktree.'
      operationId: ensure_worktree_endpoint_api_v1_worktrees_ensure_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorktreeEnsureRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorktreeDescriptor'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - HTTPBearer: []
      x-stability: unstable
  /api/v1/worktrees/session/{session_id}:
    patch:
      tags:
      - worktrees
      summary: Set User Session Worktree
      description: Set the worktree for a user session.
      operationId: set_user_session_worktree_api_v1_worktrees_session__session_id__patch
      security:
      - HTTPBearer: []
      parameters:
      - name: session_id
        in: path
        required: true
        schema:
          type: string
          title: Session Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorktreeSetRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorktreeDescriptor'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-stability: unstable
  /api/v1/worktrees/{worktree_id}/migrate:
    post:
      tags:
      - worktrees
      summary: Migrate Worktree
      description: 'Migrate a worktree to a different machine type (LOCAL or REMOTE).


        For LOCAL: Requires target_machine_id pointing to a user''s machine.

        For REMOTE: Creates a managed machine (sandbox), provisions the workspace,

        and starts sessions in the sandbox.


        The migration process:

        1. Stops any running sessions on the current machine (if migrating from local)

        2. Updates the worktree''s machine association

        3. For REMOTE: Provisions sandbox workspace and starts sessions in background


        Special case: When source=''base_ref'' and worktree_name is provided, creates a

        new worktree with that name as REMOTE from base_ref, ignoring the worktree_id.'
      operationId: migrate_worktree_api_v1_worktrees__worktree_id__migrate_post
      security:
      - HTTPBearer: []
      parameters:
      - name: worktree_id
        in: path
        required: true
        schema:
          type: string
          title: Worktree Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorktreeMigrateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorktreeMigrateResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-stability: unstable
components:
  schemas:
    WorktreeMigrateRequest:
      properties:
        target_type:
          type: string
          enum:
          - LOCAL
          - REMOTE
          title: Target Type
          description: 'Target type: LOCAL (user machine) or REMOTE (sandbox)'
        target_machine_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Target Machine Id
          description: Target user machine ID (required for LOCAL, ignored for REMOTE)
        source:
          type: string
          enum:
          - checkpoint
          - base_ref
          title: Source
          description: 'Source for REMOTE migration: ''checkpoint'' uses current checkpoint, ''base_ref'' starts fresh from workspace base ref (requires sync enabled)'
          default: checkpoint
        worktree_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Worktree Name
          description: Name for new worktree when using source='base_ref'. If provided, creates a new worktree with this name instead of migrating existing one.
      additionalProperties: false
      type: object
      required:
      - target_type
      title: WorktreeMigrateRequest
      description: Request to migrate a worktree to a different machine type.
    WorktreeEnsureRequest:
      properties:
        workspace_id:
          type: string
          title: Workspace Id
          description: Workspace ID to create worktree in
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
          description: Worktree name (null for main worktree)
        path:
          anyOf:
          - type: string
          - type: 'null'
          title: Path
          description: Filesystem path for the worktree (null for main worktree)
      additionalProperties: false
      type: object
      required:
      - workspace_id
      title: WorktreeEnsureRequest
      description: Request to ensure a worktree exists, creating if needed.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    WorktreeMigrateResponse:
      properties:
        worktree:
          $ref: '#/components/schemas/WorktreeDescriptor'
          description: Updated worktree descriptor
        status:
          type: string
          const: migrated
          title: Status
          description: 'Status of the migration: ''migrated'' on success'
      additionalProperties: false
      type: object
      required:
      - worktree
      - status
      title: WorktreeMigrateResponse
      description: Response after migrating a worktree.
    shared__schemas__worktree__UserMachinePathDescriptor:
      properties:
        id:
          type: string
          title: Id
        machine_id:
          type: string
          title: Machine Id
        local_path:
          type: string
          title: Local Path
      type: object
      required:
      - id
      - machine_id
      - local_path
      title: UserMachinePathDescriptor
      description: Machine path information associated with a LOCAL worktree.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    WorktreeSetRequest:
      properties:
        worktree_id:
          type: string
          title: Worktree Id
          description: Worktree ID to associate with session
      additionalProperties: false
      type: object
      required:
      - worktree_id
      title: WorktreeSetRequest
      description: Request to set a user session's worktree.
    WorktreeDescriptor:
      properties:
        id:
          type: string
          title: Id
          description: Unique worktree identifier
        workspace_id:
          type: string
          title: Workspace Id
          description: Parent workspace identifier
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
          description: Worktree name (null for the main worktree)
        is_main:
          type: boolean
          title: Is Main
          description: Whether this is the main/default worktree for the workspace
        path:
          anyOf:
          - type: string
          - type: 'null'
          title: Path
          description: Filesystem path for the worktree on the machine
        worktree_type:
          anyOf:
          - type: string
            enum:
            - LOCAL
            - REMOTE
          - type: 'null'
          title: Worktree Type
          description: 'Type of worktree: LOCAL (user machine) or REMOTE (sandbox)'
        user_machine_path:
          anyOf:
          - $ref: '#/components/schemas/shared__schemas__worktree__UserMachinePathDescriptor'
          - type: 'null'
          description: Machine+path link when worktree_type is LOCAL
        managed_machine_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Managed Machine Id
          description: Managed machine ID if worktree_type is REMOTE
        last_heartbeat_at:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Last Heartbeat At
          description: Most recent liveness heartbeat received from the sandbox container (REMOTE only).
        last_synced_checkpoint_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Last Synced Checkpoint Id
          description: 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:
          type: boolean
          title: Checkpoint Restore Pending
          description: Whether a checkpoint needs to be restored on next local session start
          default: false
        current_checkpoint_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Current Checkpoint Id
          description: Identifier of the current checkpoint for this worktree
        checkpoint_metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Checkpoint Metadata
          description: Metadata associated with the current checkpoint (e.g., commit info)
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Timestamp when the worktree was created
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: Timestamp when the worktree was last updated
      additionalProperties: false
      type: object
      required:
      - id
      - workspace_id
      - is_main
      - created_at
      - updated_at
      title: WorktreeDescriptor
      description: Serialized worktree entity returned to API clients.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
x-stability: unstable