> ## 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.

# Client.Jobs.Query

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

Query jobs in the specified interval.

The jobs are lazily loaded and returned as a sequence of Jobs.
The jobs are returned sorted by creation time in reverse order.
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="WithTemporalExtent(temporalExtent query.TemporalExtent)" required>
  Specify the time interval for which data should be queried.
  Right now, a temporal extent is required for every query.
</ParamField>

<ParamField path="WithAutomationID(automationID uuid.UUID)">
  Specify the automation id for which data should be queried.
  Only jobs that were created by the specified automation will be returned.
</ParamField>

<ParamField path="WithJobStates(states ...workflows.JobState)">
  Filter jobs by their state. Only jobs in any of the given states will be returned.
</ParamField>

<ParamField path="WithName(name string)">
  Filter jobs by name. Only jobs with a matching name will be returned.
</ParamField>

<ParamField path="WithTaskStates(states ...workflows.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>

## 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),
    ),
  )
  ```
</RequestExample>
