---
title: "Jobs.Submit"
description: "Submit a job."
image: "https://tilebox.com/images/tilebox-docs-social-preview.png"
---

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

# Jobs.Submit

```go
func (*JobClient) Submit(
    ctx context.Context,
    jobName string,
    tasks []workflows.Task,
    options ...job.SubmitOption
) (*workflows.Job, error)
```

Submit a job.

## Parameters

**jobName**

type: string

The name of the job

**tasks**

type: []Task

The root task for the job. This task is executed first and can submit subtasks to manage the entire workflow. A job can have optionally consist of multiple root tasks.

**options**

type: []job.SubmitOption

Options for the job

## Options

**WithMaxRetries(maxRetries int64)**

default: 0

Set the maximum number of [retries](/docs/workflows/concepts/tasks#retry-handling) for the subtask in case it fails

**WithClusterSlug(clusterSlug string)**

default: 

The [cluster](/docs/workflows/concepts/clusters#managing-clusters) to run the root task on. If not provided, the default cluster is used.

**job.WithWorkflowID(workflowID uuid.UUID)**

Select the workflow to run for all root tasks. Resolve its reference with `client.Workflows.Get` and pass its `ID`. Omit this option for a direct runner. Omission leaves roots unscoped, including when submitting a new job from inside a task. A zero UUID is rejected. See [Workflow scope](/docs/workflows/concepts/tasks#workflow-scope).

## Returns

A job object.

<h2 id="request-example">Usage example</h2>

Submit to the deployed `my-workflow` workflow:

```go
import "github.com/tilebox/tilebox-go/workflows/v1/job"

workflow, err := client.Workflows.Get(ctx, "my-workflow")
if err != nil {
    return err
}

submittedJob, err := client.Jobs.Submit(ctx,
    "My job",
    []workflows.Task{rootTask},
    job.WithWorkflowID(workflow.ID),
)
```

For a direct runner, omit the workflow lookup and `job.WithWorkflowID` option.

Source: https://tilebox.com/docs/api-reference/go/workflows/Jobs.Submit/index.mdx
