# Mobile · Automation

Loops, missions and routines as the mobile app drives them, including the tokenised routine trigger.

Playground

Send these requests to your own running server. Values stay in this browser.

Not connected

Base URL  Directory _optional_  Bearer token _optional_ 

 

How this works

Start a server with `nikcli serve --hostname 127.0.0.1 --port 4096`. Requests go straight from this page to that address — the browser allows it because loopback counts as a secure origin, and the server allows it because `nikcli-ai.dev` is in its CORS allowlist.

To try things without touching your real sessions or config, start the server with `NIKCLI_TEST_HOME` pointed at a throwaway directory — see [the guided tour](/docs/guides/api-tour).

## Operations

36 endpoints, generated from the server's own [OpenAPI document](/docs/api). Every path also accepts the `directory` and `workspace` query parameters that select which instance handles the request.

<table class="api-index not-prose"><tbody><tr><td class="api-index-method"><span class="api-method api-method-get">get</span></td><td><a href="#op-get-mobile-loops">/mobile/loops</a></td><td class="api-index-id">mobile.loop.list</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-mobile-loops">/mobile/loops</a></td><td class="api-index-id">mobile.loop.create</td></tr><tr><td class="api-index-method"><span class="api-method api-method-get">get</span></td><td><a href="#op-get-mobile-loops-templates">/mobile/loops/templates</a></td><td class="api-index-id">mobile.loop.templates</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-mobile-loops-generate">/mobile/loops/generate</a></td><td class="api-index-id">mobile.loop.generate</td></tr><tr><td class="api-index-method"><span class="api-method api-method-get">get</span></td><td><a href="#op-get-mobile-loops-runs-recent">/mobile/loops/runs/recent</a></td><td class="api-index-id">mobile.loop.runs.recent</td></tr><tr><td class="api-index-method"><span class="api-method api-method-get">get</span></td><td><a href="#op-get-mobile-loops-id">/mobile/loops/{id}</a></td><td class="api-index-id">mobile.loop.get</td></tr><tr><td class="api-index-method"><span class="api-method api-method-patch">patch</span></td><td><a href="#op-patch-mobile-loops-id">/mobile/loops/{id}</a></td><td class="api-index-id">mobile.loop.update</td></tr><tr><td class="api-index-method"><span class="api-method api-method-delete">delete</span></td><td><a href="#op-delete-mobile-loops-id">/mobile/loops/{id}</a></td><td class="api-index-id">mobile.loop.delete</td></tr><tr><td class="api-index-method"><span class="api-method api-method-get">get</span></td><td><a href="#op-get-mobile-loops-id-runs">/mobile/loops/{id}/runs</a></td><td class="api-index-id">mobile.loop.runs</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-mobile-loops-id-run">/mobile/loops/{id}/run</a></td><td class="api-index-id">mobile.loop.run</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-mobile-loops-id-abort">/mobile/loops/{id}/abort</a></td><td class="api-index-id">mobile.loop.abort</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-mobile-loops-id-toggle">/mobile/loops/{id}/toggle</a></td><td class="api-index-id">mobile.loop.toggle</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-mobile-loops-id-pause">/mobile/loops/{id}/pause</a></td><td class="api-index-id">mobile.loop.pause</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-mobile-loops-id-resume">/mobile/loops/{id}/resume</a></td><td class="api-index-id">mobile.loop.resume</td></tr><tr><td class="api-index-method"><span class="api-method api-method-get">get</span></td><td><a href="#op-get-mobile-routines">/mobile/routines</a></td><td class="api-index-id">mobile.routine.list</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-mobile-routines">/mobile/routines</a></td><td class="api-index-id">mobile.routine.create</td></tr><tr><td class="api-index-method"><span class="api-method api-method-get">get</span></td><td><a href="#op-get-mobile-routines-id">/mobile/routines/{id}</a></td><td class="api-index-id">mobile.routine.get</td></tr><tr><td class="api-index-method"><span class="api-method api-method-patch">patch</span></td><td><a href="#op-patch-mobile-routines-id">/mobile/routines/{id}</a></td><td class="api-index-id">mobile.routine.update</td></tr><tr><td class="api-index-method"><span class="api-method api-method-delete">delete</span></td><td><a href="#op-delete-mobile-routines-id">/mobile/routines/{id}</a></td><td class="api-index-id">mobile.routine.delete</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-mobile-routines-id-run">/mobile/routines/{id}/run</a></td><td class="api-index-id">mobile.routine.run</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-mobile-routines-id-pause">/mobile/routines/{id}/pause</a></td><td class="api-index-id">mobile.routine.pause</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-mobile-routines-id-resume">/mobile/routines/{id}/resume</a></td><td class="api-index-id">mobile.routine.resume</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-mobile-routines-trigger-token">/mobile/routines/trigger/{token}</a></td><td class="api-index-id">mobile.routine.trigger</td></tr><tr><td class="api-index-method"><span class="api-method api-method-get">get</span></td><td><a href="#op-get-mobile-missions">/mobile/missions</a></td><td class="api-index-id">mobile.mission.list</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-mobile-missions">/mobile/missions</a></td><td class="api-index-id">mobile.mission.create</td></tr><tr><td class="api-index-method"><span class="api-method api-method-get">get</span></td><td><a href="#op-get-mobile-missions-templates">/mobile/missions/templates</a></td><td class="api-index-id">mobile.mission.templates</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-mobile-missions-generate">/mobile/missions/generate</a></td><td class="api-index-id">mobile.mission.generate</td></tr><tr><td class="api-index-method"><span class="api-method api-method-get">get</span></td><td><a href="#op-get-mobile-missions-execs-recent">/mobile/missions/execs/recent</a></td><td class="api-index-id">mobile.mission.execs.recent</td></tr><tr><td class="api-index-method"><span class="api-method api-method-get">get</span></td><td><a href="#op-get-mobile-missions-id">/mobile/missions/{id}</a></td><td class="api-index-id">mobile.mission.get</td></tr><tr><td class="api-index-method"><span class="api-method api-method-patch">patch</span></td><td><a href="#op-patch-mobile-missions-id">/mobile/missions/{id}</a></td><td class="api-index-id">mobile.mission.update</td></tr><tr><td class="api-index-method"><span class="api-method api-method-delete">delete</span></td><td><a href="#op-delete-mobile-missions-id">/mobile/missions/{id}</a></td><td class="api-index-id">mobile.mission.delete</td></tr><tr><td class="api-index-method"><span class="api-method api-method-get">get</span></td><td><a href="#op-get-mobile-missions-id-execs">/mobile/missions/{id}/execs</a></td><td class="api-index-id">mobile.mission.execs</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-mobile-missions-id-start">/mobile/missions/{id}/start</a></td><td class="api-index-id">mobile.mission.start</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-mobile-missions-id-pause">/mobile/missions/{id}/pause</a></td><td class="api-index-id">mobile.mission.pause</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-mobile-missions-id-cancel">/mobile/missions/{id}/cancel</a></td><td class="api-index-id">mobile.mission.cancel</td></tr><tr><td class="api-index-method"><span class="api-method api-method-post">post</span></td><td><a href="#op-post-mobile-missions-id-feature-featureID">/mobile/missions/{id}/feature/{featureID}</a></td><td class="api-index-id">mobile.mission.feature.mutate</td></tr></tbody></table>

### Loops

get /mobile/loops [#](#op-get-mobile-loops) `mobile.loop.list`

Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| directory | query | string | optional |
| workspace | query | string | optional |

Responses

200 Success application/json

{
  loops: ({
    id: string
    name: string
    stages: [LoopStage](#schema-LoopStage)\[\]
    trigger: [LoopTrigger](#schema-LoopTrigger)
    maxRuns?: 
      | number
      | "Infinity" | "-Infinity" | "NaN"
    timeoutMs?: 
      | number
      | "Infinity" | "-Infinity" | "NaN"
    createPR?: boolean
    sandbox?: boolean
    worktree?: [LoopWorktree](#schema-LoopWorktree)
    paused?: boolean
    enabled: boolean
    createdAt: 
      | number
      | "Infinity" | "-Infinity" | "NaN"
  })\[\]
  runtimes: ({
    loopID: string
    status: 
      | "idle"
      | "running"
      | "paused"
      | "error"
      | "cancelling"
    runs: 
      | number
      | "Infinity" | "-Infinity" | "NaN"
    lastRunAt?: 
      | 
      | number
      | "Infinity" | "-Infinity" | "NaN"
      | null
    lastError?: string | null
    sessionID?: string | null
  })\[\]
}

Example response from schema

{
  "loops": \[
    {
      "id": "",
      "name": "",
      "stages": \[\],
      "trigger": {
        "kind": null
      },
      "maxRuns": 0,
      "timeoutMs": 0,
      "createPR": false,
      "sandbox": false,
      "worktree": {
        "name": null,
        "branch": null,
        "directory": null
      },
      "paused": false,
      "enabled": false,
      "createdAt": 0
    }
  \],
  "runtimes": \[
    {
      "loopID": "",
      "status": "idle",
      "runs": 0,
      "lastRunAt": 0,
      "lastError": "",
      "sessionID": ""
    }
  \]
}

Generated from the response schema — field values are placeholders, the shape is real.

SDK example

mobile.loop.list

ts 

1

2

3

4

5

6

```
import { createNikcliClient } from "@nikcli-ai/sdk/httpapi"

const client = createNikcliClient()
await client.mobile.loop.list({
  ...
})
```

Try it

directory _query_  workspace _query_

---

Source: https://nikcli-ai.dev/docs/api/mobile-automation
