NomadFlow
Server

API Reference

Complete HTTP API reference for the NomadFlowCode server.

All API endpoints (except /health) require a Authorization: Bearer <token> header when auth.secret is configured. All request and response bodies use JSON with camelCase field names.

Health check

GET /health

No authentication required.

Response:

{
  "status": "ok",
  "tmuxSession": "nomadflow",
  "apiPort": 8080
}

Repositories

POST /api/list-repos

List all repositories managed by NomadFlowCode.

Request body: none (empty or {})

Response:

{
  "repos": [
    {
      "name": "my-project",
      "path": "/home/user/.nomadflowcode/repos/my-project",
      "branch": "main"
    }
  ]
}

POST /api/clone-repo

Clone a git repository into NomadFlowCode's managed directory.

Request body:

{
  "url": "https://github.com/user/repo.git",
  "token": "ghp_xxxx",
  "name": "custom-name"
}
FieldTypeRequiredDescription
urlstringyesGit clone URL
tokenstringnoGit credential token (inserted into the URL for HTTPS clones)
namestringnoCustom name for the repository directory

Response:

{
  "name": "repo",
  "path": "/home/user/.nomadflowcode/repos/repo",
  "branch": "main"
}

Features

POST /api/list-features

List all features (worktrees) for a repository.

Request body:

{
  "repoPath": "/home/user/.nomadflowcode/repos/my-project"
}

Response:

{
  "features": [
    {
      "name": "feature-a",
      "worktreePath": "/home/user/.nomadflowcode/worktrees/my-project/feature-a",
      "branch": "feature/feature-a",
      "isActive": true,
      "isMain": false
    }
  ]
}
FieldTypeDescription
namestringFeature name
worktreePathstringAbsolute path to the worktree directory
branchstringGit branch name
isActivebooleanWhether this feature's tmux window is currently selected
isMainbooleanWhether this is the main/default branch

POST /api/create-feature

Create a new feature branch with its own worktree and tmux window.

Request body:

{
  "repoPath": "/home/user/.nomadflowcode/repos/my-project",
  "featureName": "my-feature",
  "baseBranch": "main"
}
FieldTypeRequiredDefaultDescription
repoPathstringyesPath to the repository
featureNamestringyesName for the new feature
baseBranchstringno"main"Branch to base the feature on

Response:

{
  "worktreePath": "/home/user/.nomadflowcode/worktrees/my-project/my-feature",
  "branch": "feature/my-feature",
  "tmuxWindow": "my-project:my-feature"
}

POST /api/switch-feature

Switch to an existing feature's tmux window.

Request body:

{
  "repoPath": "/home/user/.nomadflowcode/repos/my-project",
  "featureName": "my-feature"
}

Response:

{
  "switched": true,
  "worktreePath": "/home/user/.nomadflowcode/worktrees/my-project/my-feature",
  "tmuxWindow": "my-project:my-feature",
  "hasRunningProcess": false
}
FieldTypeDescription
switchedbooleanWhether the switch was successful
worktreePathstringPath to the worktree
tmuxWindowstringTmux window name (repo:feature)
hasRunningProcessbooleanWhether the tmux window has a running foreground process

Terminal WebSocket

GET /terminal/ws

WebSocket proxy to the ttyd terminal. This endpoint exists because iOS WKWebView does not send Basic Auth headers on WebSocket upgrade requests.

Query parameters:

ParamRequiredDescription
tokenwhen auth.secret is setThe shared secret for authentication

Protocol: The connection uses the tty WebSocket subprotocol. Messages are forwarded bidirectionally between the client and the ttyd process.

Example:

ws://your-server:8080/terminal/ws?token=your-secret

On this page