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

# List task jobs

> Fetch paginated run/chat history for a task.

Use this endpoint to load task history incrementally. It returns jobs in chronological order and includes `nextCursor` when older entries are available.


## OpenAPI

````yaml /openapi.json GET /tasks/{taskIdOrSlug}/jobs
openapi: 3.0.3
info:
  title: Twill API
  version: 1.0.0
  description: Programmatically create and manage Twill tasks via REST API.
servers:
  - url: https://twill.ai/api/v1
security:
  - bearerAuth: []
tags:
  - name: Tasks
    description: Create and manage tasks.
paths:
  /tasks/{taskIdOrSlug}/jobs:
    get:
      tags:
        - Tasks
      summary: List task jobs
      description: >-
        List jobs for a task in chronological order. Useful for loading task
        chat/run history.
      operationId: listTaskJobs
      parameters:
        - name: taskIdOrSlug
          in: path
          required: true
          schema:
            type: string
          description: Task id (UUID) or task slug.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 30
          description: 'Number of jobs to return (max: 100).'
        - name: cursor
          in: query
          required: false
          schema:
            type: string
          description: Opaque pagination cursor returned by a previous call.
      responses:
        '200':
          description: Task jobs list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListTaskJobsResponse'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '429':
          $ref: '#/components/responses/RateLimitedError'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    ListTaskJobsResponse:
      type: object
      required:
        - jobs
        - nextCursor
      properties:
        jobs:
          type: array
          items:
            $ref: '#/components/schemas/TaskJobItem'
        nextCursor:
          type: string
          nullable: true
          description: Opaque cursor to request the next page of older jobs.
    TaskJobItem:
      type: object
      required:
        - id
        - status
        - type
        - agentProvider
        - input
        - finalAnswer
        - plan
        - planOutcome
        - error
        - createdAt
        - completedAt
      properties:
        id:
          type: string
        status:
          $ref: '#/components/schemas/JobStatus'
        type:
          type: string
        agentProvider:
          type: string
          nullable: true
        input:
          type: string
          nullable: true
          description: Extracted text from the original user input message.
        finalAnswer:
          type: string
          nullable: true
        plan:
          type: string
          nullable: true
        planOutcome:
          type: string
          nullable: true
        error:
          type: string
          nullable: true
        createdAt:
          type: string
          format: date-time
        completedAt:
          type: string
          format: date-time
          nullable: true
    ApiErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details: {}
    JobStatus:
      type: string
      enum:
        - PENDING
        - IN_PROGRESS
        - COMPLETED
        - FAILED
        - CANCELLED
  responses:
    ValidationError:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          examples:
            invalidBody:
              value:
                error:
                  code: validation_error
                  message: Invalid request body
                  details:
                    issues:
                      - field: command
                        message: command is required
    UnauthorizedError:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            error:
              code: unauthorized
              message: Invalid or missing API key
    NotFoundError:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            error:
              code: not_found
              message: Task not found
    RateLimitedError:
      description: Too many requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            error:
              code: rate_limited
              message: Rate limit exceeded. Max 100 requests per minute.
    InternalError:
      description: Server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            error:
              code: internal_error
              message: Server error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````