> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/recovery/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/recovery/_mcp/server.

# Create or update job

POST /v1/jobs
Content-Type: application/json

Create a new job or update an existing one. If a job with the same heimdall_job_id exists, it will be updated; otherwise, a new job will be created.

Reference: https://docs.nvidia.com/recovery/gateway-reference/heimdall-service/createorupdatejob

## Request

### Body (application/json)

This endpoint expects a v1CreateOrUpdateJobRequest.

- `workflowId` (string, required) — The workflow ID this job belongs to.
- `heimdallJobId` (string, optional) — The UUID for the job. If not provided, will be computed from job_id and attempt_index.
- `jobId` (string, optional) — Scheduler-specific job identifier.
- `attemptIndex` (integer, optional) — The attempt index for this job.
- `jobName` (string, optional) — The name of the job.
- `allocatedNodes` (list of string, optional) — List of nodes allocated to the job.
- `gpuCountPerNode` (integer, optional) — Number of GPUs per node.
- `nodeConstraints` (v1NodeConstraints, optional) — NodeConstraints defines node scheduling constraints for jobs.
- `additionalProperties` (v1JobAdditionalProperties, optional) — JobAdditionalProperties contains additional configuration properties for jobs.
- `state` (enum, optional, default: JOB_STATUS_UNSPECIFIED) — JobStatus represents the state of a job. - JOB_STATUS_UNSPECIFIED: The status is not specified. - JOB_STATUS_PENDING: The job has been created but is not started yet due to being queued, waiting for resources or is pulling container images etc... - JOB_STATUS_RUNNING: The job is scheduled and has started running. - JOB_STATUS_STOPPED: A stopped job is no longer running or using resources. - JOB_STATUS_COMPLETED: The job completed without reporting an error. - JOB_STATUS_FAILED: The job exited with an error status. - JOB_STATUS_CANCELLED: Job was cancelled by the user or system. - JOB_STATUS_DELETED: The job is deleted.
  - Allowed values: `JOB_STATUS_UNSPECIFIED`, `JOB_STATUS_PENDING`, `JOB_STATUS_RUNNING`, `JOB_STATUS_STOPPED`, `JOB_STATUS_COMPLETED`, `JOB_STATUS_FAILED`, `JOB_STATUS_CANCELLED`, `JOB_STATUS_DELETED`
- `schedulerMetadata` (V1CreateOrUpdateJobRequestSchedulerMetadata, optional) — Scheduler-specific metadata (e.g., CRD kind, namespace, labels, annotations).
- `recoveryConfig` (v1JobRecoveryConfig, optional) — JobRecoveryConfig contains typed recovery policy for scheduler jobs.

## Response

### 200

A successful response.

- `job` (v1Job, optional) — Job represents a job tracked by the Advisor, including both actual (observed) and desired (advisor-set) states.

## Types

### v1NodeConstraints

NodeConstraints defines node scheduling constraints for jobs.

- `exclusions` (list of string, optional) — List of nodes to exclude from job scheduling.
- `inclusions` (list of string, optional) — List of nodes to explicitly include for job scheduling.

### v1JobAdditionalProperties

JobAdditionalProperties contains additional configuration properties for jobs.

- `maxRequeueTimes` (integer, optional) — Maximum number of times a job can be requeued. -1 means unlimited.
- `enableNvrx` (boolean, optional) — Whether NVRX is enabled for this job.

### V1CreateOrUpdateJobRequestSchedulerMetadata

Scheduler-specific metadata (e.g., CRD kind, namespace, labels, annotations).

### v1JobRecoveryConfig

JobRecoveryConfig contains typed recovery policy for scheduler jobs.

- `autoResumeMode` (enum, optional, default: AUTO_RESUME_MODE_UNSPECIFIED) — AutoResumeMode defines how the system should resume a recoverable job. - AUTO_RESUME_MODE_UNSPECIFIED: No job-level auto-resume mode was specified. - AUTO_RESUME_MODE_REQUEUE: Requeue the same scheduler job to resume progress. - AUTO_RESUME_MODE_SINGLETON_DEPENDENCY: Use singleton dependency jobs to resume progress.
  - Allowed values: `AUTO_RESUME_MODE_UNSPECIFIED`, `AUTO_RESUME_MODE_REQUEUE`, `AUTO_RESUME_MODE_SINGLETON_DEPENDENCY`
- `maxRequeueTimes` (integer, optional) — Maximum number of times a job can be requeued. Must be positive when present.
- `requeueOnCompletion` (boolean, optional) — Whether normal completion should trigger requeue. Presence overrides the system default.
- `anomalyDetectionConfig` (v1JobAnomalyDetectionConfig, optional) — JobAnomalyDetectionConfig contains per-job log detection controls.
- `dagDependencies` (list of v1JobDagDependency, optional) — Parent gates that must be satisfied before this job becomes eligible.
- `dagAction` (enum, optional, default: DAG_ACTION_UNSPECIFIED) — DagAction defines what Job Manager should request after all dependencies are satisfied. - DAG_ACTION_UNSPECIFIED: No DAG action was specified. - DAG_ACTION_RELEASE: Release the held child so it becomes scheduler-eligible.
  - Allowed values: `DAG_ACTION_UNSPECIFIED`, `DAG_ACTION_RELEASE`
- `environment` (string, optional) — Optional APS routing environment preserved exactly from the scheduler job.
- `logFilePathsSharedAcrossAttempts` (boolean, optional) — Whether requeued attempts intentionally write to the same log files.

### v1Job

Job represents a job tracked by the Advisor, including both actual (observed) and desired (advisor-set) states.

- `workflowId` (string, required) — The workflow ID this job belongs to.
- `heimdallJobId` (string, optional) — The UUID assigned by NVIDIA Recovery.
- `jobRunId` (string, optional) — Legacy id for job for slurm systems.
- `jobId` (string, optional) — Scheduler-specific job identifier.
- `attemptIndex` (integer, optional) — The attempt index for this job.
- `nodes` (list of string, optional) — List of nodes associated with the job.
- `gpuCountPerNode` (integer, optional)
- `nodeConstraints` (v1NodeConstraints, optional) — NodeConstraints defines node scheduling constraints for jobs.
- `additionalProperties` (v1JobAdditionalProperties, optional) — JobAdditionalProperties contains additional configuration properties for jobs.
- `state` (enum, optional, default: JOB_STATUS_UNSPECIFIED) — JobStatus represents the state of a job. - JOB_STATUS_UNSPECIFIED: The status is not specified. - JOB_STATUS_PENDING: The job has been created but is not started yet due to being queued, waiting for resources or is pulling container images etc... - JOB_STATUS_RUNNING: The job is scheduled and has started running. - JOB_STATUS_STOPPED: A stopped job is no longer running or using resources. - JOB_STATUS_COMPLETED: The job completed without reporting an error. - JOB_STATUS_FAILED: The job exited with an error status. - JOB_STATUS_CANCELLED: Job was cancelled by the user or system. - JOB_STATUS_DELETED: The job is deleted.
  - Allowed values: `JOB_STATUS_UNSPECIFIED`, `JOB_STATUS_PENDING`, `JOB_STATUS_RUNNING`, `JOB_STATUS_STOPPED`, `JOB_STATUS_COMPLETED`, `JOB_STATUS_FAILED`, `JOB_STATUS_CANCELLED`, `JOB_STATUS_DELETED`
- `createdAt` (datetime, optional) — When the job was created.
- `lastSeen` (datetime, optional) — When the job was last seen.
- `updatedAt` (datetime, optional) — When the job was last updated.
- `jobName` (string, optional)
- `schedulerMetadata` (V1JobSchedulerMetadata, optional) — Scheduler metadata that is specific to the scheduler such as kubernetes namespace or job kind.
- `recoveryConfig` (v1JobRecoveryConfig, optional) — JobRecoveryConfig contains typed recovery policy for scheduler jobs.

### v1JobAnomalyDetectionConfig

JobAnomalyDetectionConfig contains per-job log detection controls.

- `logBasedCrashEnabled` (boolean, optional) — Whether Watcher log-based crash detection is enabled.
- `logBasedTimeoutEnabled` (boolean, optional) — Whether Watcher no-output detection is enabled.
- `logBasedTimeoutThresholdPretraining` (integer, optional) — No-output threshold during pre-training, in seconds. Must be positive when present.
- `logBasedTimeoutThresholdTrainingloop` (integer, optional) — No-output threshold during the training loop, in seconds. Must be positive when present.

### v1JobDagDependency

JobDagDependency identifies one parent gate for a DAG child.

- `jobId` (string, optional) — Scheduler job ID of the parent.
- `jobName` (string, optional) — Workflow-scoped job name of the parent.
- `trigger` (enum, optional, default: TRIGGER_CONDITION_UNSPECIFIED) — TriggerCondition defines the parent state that satisfies this dependency. - TRIGGER_CONDITION_UNSPECIFIED: No trigger condition was specified. - TRIGGER_CONDITION_COMPLETED: The parent must complete successfully.
  - Allowed values: `TRIGGER_CONDITION_UNSPECIFIED`, `TRIGGER_CONDITION_COMPLETED`

### V1JobSchedulerMetadata

Scheduler metadata that is specific to the scheduler such as kubernetes namespace or job kind.

## Examples

**Request**

```json
{
  "workflowId": "string"
}
```

**Response**

```json
{
  "job": {
    "workflowId": "string",
    "heimdallJobId": "string",
    "jobRunId": "string",
    "jobId": "string",
    "attemptIndex": 1,
    "nodes": [
      "string"
    ],
    "gpuCountPerNode": 1,
    "nodeConstraints": {
      "exclusions": [
        "string"
      ],
      "inclusions": [
        "string"
      ]
    },
    "additionalProperties": {
      "maxRequeueTimes": 1,
      "enableNvrx": true
    },
    "state": "JOB_STATUS_UNSPECIFIED",
    "createdAt": "2024-01-15T09:30:00Z",
    "lastSeen": "2024-01-15T09:30:00Z",
    "updatedAt": "2024-01-15T09:30:00Z",
    "jobName": "string",
    "schedulerMetadata": {},
    "recoveryConfig": {
      "autoResumeMode": "AUTO_RESUME_MODE_UNSPECIFIED",
      "maxRequeueTimes": 1,
      "requeueOnCompletion": true,
      "anomalyDetectionConfig": {
        "logBasedCrashEnabled": true,
        "logBasedTimeoutEnabled": true,
        "logBasedTimeoutThresholdPretraining": 1,
        "logBasedTimeoutThresholdTrainingloop": 1
      },
      "dagDependencies": [
        {
          "jobId": "string",
          "jobName": "string",
          "trigger": "TRIGGER_CONDITION_UNSPECIFIED"
        }
      ],
      "dagAction": "DAG_ACTION_UNSPECIFIED",
      "environment": "string",
      "logFilePathsSharedAcrossAttempts": true
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.example.com/v1/jobs"

payload = { "workflowId": "string" }
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.example.com/v1/jobs';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"workflowId":"string"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/jobs"

	payload := strings.NewReader("{\n  \"workflowId\": \"string\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/jobs")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"workflowId\": \"string\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/jobs")
  .header("Content-Type", "application/json")
  .body("{\n  \"workflowId\": \"string\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/jobs', [
  'body' => '{
  "workflowId": "string"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/v1/jobs");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"workflowId\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["workflowId": "string"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/jobs")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```