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

# Jobs.Query

```go theme={"system"}
func (*JobClient) Query(
    ctx context.Context,
    options ...job.QueryOption,
) iter.Seq2[*workflows.Job, error]
```

Query jobs matching the provided options.

The jobs are lazily loaded across pages and returned as a sequence of jobs.
The output sequence can be transformed into a slice of Job using [Collect](/api-reference/go/workflows/Collect) function.

## Parameters

<ParamField path="options" type="[]job.QueryOption">
  Options for querying jobs
</ParamField>

## Options

<ParamField path="job.WithTemporalExtent(temporalExtent query.TemporalExtent)">
  Filter jobs by time or job ID interval.
</ParamField>

<ParamField path="job.WithAutomationIDs(automationIDs ...uuid.UUID)">
  Filter jobs by the automations that submitted them.
</ParamField>

<ParamField path="job.WithJobStates(states ...job.State)">
  Filter jobs by job state.
</ParamField>

<ParamField path="job.WithJobName(name string)">
  Filter jobs by name.
</ParamField>

<ParamField path="job.WithTaskStates(states ...job.TaskState)">
  Filter jobs by the states of their tasks. Only jobs that have at least one task in any of the given states will be returned. Useful for finding jobs with [optional](/workflows/concepts/tasks#optional-tasks) task failures.
</ParamField>

<ParamField path="job.WithCursor(cursor *job.Cursor)">
  Start the query after the cursor returned by a previous page.
</ParamField>

<ParamField path="job.WithLimit(limit int64)">
  Limit the total number of jobs yielded by the sequence.
</ParamField>

<ParamField path="job.WithSortDirection(direction job.SortDirection)">
  Sort jobs by submission date. Use `job.Ascending` for oldest first or `job.Descending` for newest first.
</ParamField>

## Returns

A sequence of jobs.

<RequestExample>
  ```go Go theme={"system"}
  import (
    "time"
    workflows "github.com/tilebox/tilebox-go/workflows/v1"
    "github.com/tilebox/tilebox-go/workflows/v1/job"
  	"github.com/tilebox/tilebox-go/query"
  )

  interval := query.NewTimeInterval(
    time.Now().Add(-24 * time.Hour),
    time.Now(),
  )

  jobs, err := workflows.Collect(
    client.Jobs.Query(ctx,
      job.WithTemporalExtent(interval),
      job.WithJobStates(job.Running, job.Started),
    ),
  )
  ```
</RequestExample>
