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

# Get a task



## OpenAPI

````yaml /api-reference/openapi.json get /v1/tasks/{task_id}
openapi: 3.1.0
info:
  title: GuidingHand API
  version: 1.0.0
  description: >-
    Create sessions (an invite link with a code for the person at the computer),
    run tasks on their computer with one of your agents, follow them, answer
    their questions and approvals, and fetch history and recordings.
servers:
  - url: https://guidinghand.ai
    description: Production
  - url: https://dev.guidinghand.ai
    description: Development (Stripe test mode)
security:
  - bearerAuth: []
tags:
  - name: Agents
  - name: Sessions
  - name: Tasks
  - name: Webhooks
paths:
  /v1/tasks/{task_id}:
    parameters:
      - name: task_id
        in: path
        required: true
        description: The task’s id.
        schema:
          type: string
    get:
      tags:
        - Tasks
      summary: Get a task
      operationId: getTask
      parameters:
        - name: include
          in: query
          required: false
          description: >-
            Comma-separated: `events` (everything that happened), `trace`
            (timings for support).
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Task'
        '401':
          $ref: '#/components/responses/E401'
        '404':
          $ref: '#/components/responses/E404'
components:
  schemas:
    Task:
      type: object
      properties:
        object:
          const: task
        task_id:
          type: string
        session_id:
          type: string
        agent_id:
          type: string
        status:
          $ref: '#/components/schemas/TaskStatus'
        done:
          type: boolean
        prompt:
          type: string
        result:
          type:
            - string
            - 'null'
          description: The agent’s summary when it finished.
        error:
          type:
            - string
            - 'null'
        pending:
          oneOf:
            - $ref: '#/components/schemas/Pending'
            - type: 'null'
          description: 'What the agent waits on: answer it with /respond.'
        cursor:
          type: integer
          description: The latest event’s cursor.
        metadata:
          $ref: '#/components/schemas/Metadata'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        active_seconds:
          type: integer
          description: Time spent running (not waiting on a person).
        billed_minutes:
          type:
            - integer
            - 'null'
        replay_url:
          type: string
          description: The replay in the console.
        recording:
          type: object
          properties:
            frames:
              type: integer
        events:
          type: array
          items:
            $ref: '#/components/schemas/Event'
          description: With `include=events`.
    TaskStatus:
      type: string
      enum:
        - queued
        - running
        - waiting_for_user
        - waiting_for_approval
        - completed
        - failed
        - stopped
    Pending:
      oneOf:
        - title: Question
          type: object
          properties:
            type:
              const: question
            question_id:
              type: string
            question:
              type: string
            options:
              type: array
              items:
                type: string
            customer_can_answer:
              type: boolean
              description: >-
                The person at the computer can answer it in the GuidingHand app
                too (the agent allows it and their app can). The first answer is
                used: answering after them returns 409 with `code:
                "already_answered"`.
        - title: Approval
          type: object
          properties:
            type:
              const: approval
            approval_id:
              type: string
            action:
              type: string
              description: Exactly what the agent is about to do.
            risk:
              type: string
              enum:
                - low
                - medium
                - high
            customer_can_approve:
              type: boolean
              description: >-
                The person at the computer can approve or deny it in the
                GuidingHand app too (the agent allows it and their app can). The
                first decision is used: deciding after them returns 409 with
                `code: "already_answered"`.
    Metadata:
      type: object
      additionalProperties:
        type: string
        maxLength: 500
      maxProperties: 50
      description: >-
        Your own ids and labels (e.g. a ticket or customer id), returned as
        given.
      example:
        customer_id: cus_42
    Event:
      type: object
      properties:
        cursor:
          type: integer
        type:
          type: string
          enum:
            - started
            - progress
            - thinking
            - action
            - message
            - question
            - answer
            - approval_required
            - approved
            - denied
            - completed
            - error
            - stopped
        message:
          type: string
        ts:
          type: string
          format: date-time
        data:
          type: object
          description: >-
            For `action`: `{ action: { type, x, y, text, keys, ... } }`. For
            `answer`: `{ question_id, answered_by: "customer" | "operator" }`.
            For `approved` and `denied`: `{ approval_id, answered_by, note? }`.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - message
          properties:
            type:
              type: string
              enum:
                - invalid_request
                - authentication
                - payment_required
                - permission
                - not_found
                - conflict
                - rate_limit
                - server_error
            message:
              type: string
            code:
              type: string
              description: >-
                Why an answer or decision was refused (on `/respond`):
                `already_answered` (someone answered or decided first: see
                `answered_by`) or `not_pending` (that question or approval isn’t
                open any more). The GuidingHand app hears two more, which the
                API never returns: `customer_answers_off` and
                `customer_approvals_off` (the agent keeps its questions or
                approvals for your team).
            answered_by:
              type: string
              enum:
                - customer
                - operator
              description: >-
                With `already_answered`: who answered or decided first
                (`customer`: the person at the computer).
  responses:
    E401:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    E404:
      description: Not found in this org.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: An org API key (`gh_live_…`) from Settings → API keys in the console.

````