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

# Get a flow execution

> Follow a flow execution's progress and read each node's output.



## OpenAPI

````yaml api-reference/openapi.yaml GET /v1/flows/{flow_id}/executions/{execution_id}
openapi: 3.0.3
info:
  title: QX API
  version: '1.0'
  description: >-
    Run what you build in QX from your own code. Message agents, execute flows
    and grids, and read their results.
servers:
  - url: https://api.qxlabs.com
security:
  - bearerAuth: []
tags:
  - name: Agents
    description: >-
      Message agents through OpenAI's Responses API, so OpenAI's SDKs work with
      a QX API key.
  - name: Flows
    description: Execute flows and follow their executions.
  - name: Grids
    description: Execute grids, follow their executions and read their rows.
paths:
  /v1/flows/{flow_id}/executions/{execution_id}:
    get:
      tags:
        - Flows
      summary: Get a flow execution
      description: >
        Returns an execution's status and progress, and the output of each node
        so far.

        Poll it every few seconds until `status` is `completed`, `error` or
        `cancelled`.
      operationId: getFlowExecution
      parameters:
        - name: flow_id
          in: path
          required: true
          schema:
            type: string
          description: The flow's ID
          example: c71a5f0e1d2b4a7e9a513f6f0d2b8e10
        - name: execution_id
          in: path
          required: true
          schema:
            type: string
          description: The execution's ID, from the execute endpoint or the app
          example: 9b2e4d713a5c4f8bb6e21c7d9a0f3e58
      responses:
        '200':
          description: The execution
          content:
            application/json:
              schema:
                type: object
                properties:
                  execution_id:
                    type: string
                  flow_id:
                    type: string
                  status:
                    type: string
                    enum:
                      - initializing
                      - processing
                      - completed
                      - error
                      - paused
                      - cancelled
                  progress:
                    type: object
                    description: >
                      `finished_nodes` counts completed nodes. Nodes on a branch
                      that wasn't taken never execute, so `finished_nodes` can
                      stay below `total_nodes` when the execution completes.
                    properties:
                      finished_nodes:
                        type: integer
                      total_nodes:
                        type: integer
                  credits_consumed:
                    type: integer
                    description: Credits the execution has used so far
                  nodes:
                    type: array
                    description: >
                      One entry per node that has started, in execution order.
                      The Output node's `output` holds the flow's final values.

                      A batch node's outputs are lists with one entry per item,
                      and the list can grow while the node is processing.

                      Export nodes output a file key, not the file.
                    items:
                      type: object
                      properties:
                        node_id:
                          type: string
                        type:
                          type: string
                        label:
                          type: string
                          nullable: true
                        status:
                          type: string
                          description: The same values as the execution's `status`
                        output:
                          type: object
                          description: The node's output so far, empty until it has some
                        credits_consumed:
                          type: integer
                        error:
                          type: string
                          nullable: true
                          description: The node's error message, if it failed
              example:
                execution_id: 9b2e4d713a5c4f8bb6e21c7d9a0f3e58
                flow_id: c71a5f0e1d2b4a7e9a513f6f0d2b8e10
                status: processing
                progress:
                  finished_nodes: 1
                  total_nodes: 3
                credits_consumed: 0
                nodes:
                  - node_id: UserInputNodex7q2m9ka4
                    type: UserInputNode
                    label: Company details
                    status: completed
                    output:
                      company_name: Acme
                      size: 51-500
                    credits_consumed: 0
                    error: null
                  - node_id: LLMNodek3x9m2pqa1
                    type: LLMNode
                    label: Write summary
                    status: processing
                    output: {}
                    credits_consumed: 0
                    error: null
        '400':
          description: The execution belongs to a different flow
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: The flow is in your org but isn't shared with you
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: There's no such flow or execution
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Read rate limit exceeded for flows endpoints
      x-codeSamples:
        - lang: bash
          label: cURL
          source: >
            curl
            https://api.qxlabs.com/v1/flows/c71a5f0e1d2b4a7e9a513f6f0d2b8e10/executions/9b2e4d713a5c4f8bb6e21c7d9a0f3e58
            \
              -H "Authorization: Bearer <YOUR_QX_API_KEY>"
        - lang: python
          label: Python
          source: >
            import time


            import requests


            headers = {"Authorization": "Bearer <YOUR_QX_API_KEY>"}

            url =
            "https://api.qxlabs.com/v1/flows/c71a5f0e1d2b4a7e9a513f6f0d2b8e10/executions/9b2e4d713a5c4f8bb6e21c7d9a0f3e58"


            # Poll until the execution has finished

            while True:
                execution = requests.get(url, headers=headers).json()
                if execution["status"] in ("completed", "error", "cancelled"):
                    break
                time.sleep(3)
            for node in execution["nodes"]:
                print(node["label"] or node["type"], node["status"], node["output"])
        - lang: typescript
          label: TypeScript
          source: >
            const headers = { Authorization: "Bearer <YOUR_QX_API_KEY>" };

            const url =
            "https://api.qxlabs.com/v1/flows/c71a5f0e1d2b4a7e9a513f6f0d2b8e10/executions/9b2e4d713a5c4f8bb6e21c7d9a0f3e58";


            // Poll until the execution has finished

            let execution;

            while (true) {
              execution = await (await fetch(url, { headers })).json();
              if (["completed", "error", "cancelled"].includes(execution.status)) break;
              await new Promise((resolve) => setTimeout(resolve, 3000));
            }

            for (const node of execution.nodes) {
              console.log(node.label ?? node.type, node.status, node.output);
            }
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
          description: What went wrong
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Your QX API key. The `X-API-Key` header works too

````

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