> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getcliq.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Resume a run from a phase

> Runs a finished run again from one phase onwards, reusing the stored output of the
phases before it. The run keeps its id and goes back to `running`; follow it with
Stream run events. Use it to retry a failed phase without redoing the work before it.

The run must be finished (`completed`, `failed`, `cancelled` or `crashed`), the phase
must be in the team's manifest, and every phase before it must have stored output
(see `has_artifact` in List run phases).

From the CLI: `cliq run <run> <phase>`.

No credential is needed from this machine. From another host, send `Authorization: Bearer` with a dispatch token CliqHub signed for this daemon or a `cliq_tok_…` personal token of a user in the daemon's realm; this only works once the daemon is connected to CliqHub. See [Authentication](/daemon-api/overview#authentication).



## OpenAPI

````yaml /openapi/daemon-by-tag/daemon-runs.yaml post /v1/runs/resume
openapi: 3.1.0
info:
  title: cliqd API
  version: 1.9.48
  description: >-
    HTTP API of `cliqd`, the local Cliq daemon. Generated from the daemon source
    by `scripts/generate_daemon_openapi.mjs` — do not edit by hand. See the
    [overview](/daemon-api/overview).
servers:
  - url: http://127.0.0.1:4900
    description: Local daemon (default port; `CLIQ_DAEMON_PORT` changes it)
security: []
tags:
  - name: Daemon Runs
    description: >-
      Runs on this daemon. Start one with Start a run (Workspaces); everything
      after that is

      here: list runs, read a run's log, phases and tree of sub-runs, follow it
      live, supply

      the inputs a paused run is waiting for, and rerun a finished run from a
      phase.


      Wherever a body takes `run_id` you may also send the run's **name**,
      except the event

      endpoints, which need the id. Run ids are UUIDs.


      A run's life: `running` → (`awaiting_input` ↔ `running`)* → `completed`,
      `failed`,

      `cancelled` or `crashed`.
paths:
  /v1/runs/resume:
    post:
      tags:
        - Daemon Runs
      summary: Resume a run from a phase
      description: >-
        Runs a finished run again from one phase onwards, reusing the stored
        output of the

        phases before it. The run keeps its id and goes back to `running`;
        follow it with

        Stream run events. Use it to retry a failed phase without redoing the
        work before it.


        The run must be finished (`completed`, `failed`, `cancelled` or
        `crashed`), the phase

        must be in the team's manifest, and every phase before it must have
        stored output

        (see `has_artifact` in List run phases).


        From the CLI: `cliq run <run> <phase>`.


        No credential is needed from this machine. From another host, send
        `Authorization: Bearer` with a dispatch token CliqHub signed for this
        daemon or a `cliq_tok_…` personal token of a user in the daemon's realm;
        this only works once the daemon is connected to CliqHub. See
        [Authentication](/daemon-api/overview#authentication).
      operationId: daemon_post_runs_resume
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                run_id:
                  description: Run id or run name
                  type:
                    - string
                    - number
                from_phase:
                  description: Phase to resume from
                  type:
                    - string
                    - number
              required:
                - run_id
                - from_phase
              additionalProperties: {}
            examples:
              default:
                value:
                  run_id: fix-login-timeout
                  from_phase: fix
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - data
                properties:
                  ok:
                    type: boolean
                    const: true
                  data:
                    $ref: '#/components/schemas/RunId'
              example:
                ok: true
                data:
                  run_id: 0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f
        '400':
          description: >-
            `RUN_INVALID_PHASE` — `from_phase` is not a phase of the team. The
            message lists the phases.


            `RUN_MISSING_ARTIFACT` — A phase before `from_phase` has no stored
            output, so the run cannot start after it.


            `PAYLOAD_INVALID` — The body (query string for `GET`) fails the
            request schema. `details` lists each issue.


            `BAD_REQUEST` — The body is not valid JSON or is larger than the
            route allows (10 MB; artifact uploads more).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorReply'
              examples:
                RUN_INVALID_PHASE:
                  summary: RUN_INVALID_PHASE
                  value:
                    ok: false
                    error:
                      code: RUN_INVALID_PHASE
                      message: >-
                        Phase 'fixx' not found in team manifest. Available:
                        review, fix, verify
                RUN_MISSING_ARTIFACT:
                  summary: RUN_MISSING_ARTIFACT
                  value:
                    ok: false
                    error:
                      code: RUN_MISSING_ARTIFACT
                      message: >-
                        Phase 'review' has no stored output artifact — cannot
                        resume past it
                PAYLOAD_INVALID:
                  summary: PAYLOAD_INVALID
                  value:
                    ok: false
                    error:
                      code: PAYLOAD_INVALID
                      message: >-
                        run_id: run_id is required; from_phase: from_phase is
                        required
                      details:
                        - path: run_id
                          message: run_id is required
                        - path: from_phase
                          message: from_phase is required
                BAD_REQUEST:
                  summary: BAD_REQUEST
                  value:
                    ok: false
                    error:
                      code: BAD_REQUEST
                      message: >-
                        Request body could not be read: Unexpected token } in
                        JSON at position 12
        '401':
          description: >-
            `UNAUTHORIZED` — A caller on another host sent no `Authorization:
            Bearer` token, or one that does not verify (expired, wrong
            audience).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorReply'
              examples:
                UNAUTHORIZED:
                  summary: UNAUTHORIZED
                  value:
                    ok: false
                    error:
                      code: UNAUTHORIZED
                      message: Missing or invalid Authorization Bearer token
        '403':
          description: >-
            `WEB_REQUEST_REFUSED` — The request carries an `Origin` header (it
            came from a web page).


            `HOST_NOT_LOCAL` — A loopback caller addressed a `Host` other than
            localhost (DNS rebinding guard).


            `LOCAL_ONLY` — The daemon isn't connected to CliqHub (no dispatch
            key) and the caller is on another host.


            `FORBIDDEN` — A `cliq_tok_…` token's user is not in this daemon's
            realm ACL, or the ACL is not loaded yet.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorReply'
              examples:
                WEB_REQUEST_REFUSED:
                  summary: WEB_REQUEST_REFUSED
                  value:
                    ok: false
                    error:
                      code: WEB_REQUEST_REFUSED
                      message: cliqd doesn't accept requests from web pages
                HOST_NOT_LOCAL:
                  summary: HOST_NOT_LOCAL
                  value:
                    ok: false
                    error:
                      code: HOST_NOT_LOCAL
                      message: cliqd only answers requests addressed to localhost
                LOCAL_ONLY:
                  summary: LOCAL_ONLY
                  value:
                    ok: false
                    error:
                      code: LOCAL_ONLY
                      message: >-
                        This cliqd isn't connected to CliqHub yet, so from
                        another machine it only accepts a local token (minted by
                        tokens/create on the machine running cliqd)
                FORBIDDEN:
                  summary: FORBIDDEN
                  value:
                    ok: false
                    error:
                      code: FORBIDDEN
                      message: Access denied — identity not in realm ACL
        '404':
          description: |-
            `RUN_NOT_FOUND` — No run has this id or name.

            `TEAM_NOT_FOUND` — The run's team is no longer installed.

            `NOT_FOUND` — The run's workspace has been unregistered.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorReply'
              examples:
                RUN_NOT_FOUND:
                  summary: RUN_NOT_FOUND
                  value:
                    ok: false
                    error:
                      code: RUN_NOT_FOUND
                      message: Run 'fix-login-timeout' not found
                TEAM_NOT_FOUND:
                  summary: TEAM_NOT_FOUND
                  value:
                    ok: false
                    error:
                      code: TEAM_NOT_FOUND
                      message: >-
                        Team '3f6c2a8e-6b1d-4c1e-9a57-0d2f4b8e91c4' not found in
                        catalog
                NOT_FOUND:
                  summary: NOT_FOUND
                  value:
                    ok: false
                    error:
                      code: NOT_FOUND
                      message: Workspace for run not found
        '409':
          description: >-
            `RUN_INVALID_STATE` — The run is still `running` or
            `awaiting_input`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorReply'
              examples:
                RUN_INVALID_STATE:
                  summary: RUN_INVALID_STATE
                  value:
                    ok: false
                    error:
                      code: RUN_INVALID_STATE
                      message: >-
                        Run is in state 'running' — can only resume a completed,
                        failed, or cancelled run
        '422':
          description: >-
            `TEAM_MANIFEST_INVALID` — The installed manifest of the run's team
            no longer parses.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorReply'
              examples:
                TEAM_MANIFEST_INVALID:
                  summary: TEAM_MANIFEST_INVALID
                  value:
                    ok: false
                    error:
                      code: TEAM_MANIFEST_INVALID
                      message: Team manifest failed validation
        '500':
          description: >-
            `INTERNAL_ERROR` — An unexpected daemon fault. The message names the
            request id; the cause is in the cliqd log.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorReply'
              examples:
                INTERNAL_ERROR:
                  summary: INTERNAL_ERROR
                  value:
                    ok: false
                    error:
                      code: INTERNAL_ERROR
                      message: >-
                        cliqd hit an unexpected error (request 7f3a…). Details
                        are in the cliqd log.
      security:
        - {}
        - DaemonBearer: []
components:
  schemas:
    RunId:
      type: object
      required:
        - run_id
      properties:
        run_id:
          type: string
          format: uuid
          example: 0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f
    ErrorReply:
      type: object
      description: >-
        Every failure. Switch on `error.code` — it is stable; `message` is for
        people and may change.
      required:
        - ok
        - error
      properties:
        ok:
          type: boolean
          const: false
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Stable error code. See [Errors](/daemon-api/errors).
              example: TEAM_NOT_FOUND
            message:
              type: string
              description: What went wrong and, where possible, what to do.
              example: Team 'acme/code-review' not found
            details:
              description: >-
                Structured detail when there is some: the list of schema issues
                for `PAYLOAD_INVALID`, the agent problems for
                `TEAM_AGENT_CONFIG_REQUIRED`, …
  securitySchemes:
    DaemonBearer:
      type: http
      scheme: bearer
      description: >-
        Not needed from the same machine. From another host: a dispatch JWT
        CliqHub signed for this daemon, or a `cliq_tok_…` personal token whose
        user is in the daemon's realm.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.