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

# Attribution

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

Run attribution for a single FAST or SLOW pass.

Extracts the W3C trace context from the inbound request headers and starts the handler
span as its child, then delegates to ``AttributionService.attribute``.

Args:
    request (WorkloadAttributionRequest): The parsed attribution request body.
    http_request (Request): The raw request, used to read trace-propagation headers.

Returns:
    WorkloadAttributionResponse: The attribution result.

Reference: https://docs.nvidia.com/recovery/attribution-reference/attribution-v-1-attribution-post

## Request

### Body (application/json)

This endpoint expects a WorkloadAttributionRequest.

- `failure_context` (FailureContext, required) — When/how the failure was detected (design §6). detection_signal drives STRAGGLER handling on NV side.
- `phase` (enum, required) — Which pass of the two-phase attribution flow a request represents (design §8).
  - Allowed values: `fast`, `slow`
- `schema_version` (string, required)
- `scope` (WorkloadScope, required) — The nodes / ranks / time window an attribution request applies to (design §6). start_time and end_time are Optional because SlurmJobExecutionStatus.start_time / end_time may be None (correction C12): callers that know the time pass it; callers working from an in-progress job may not.
- `timeout_ms` (integer, required)
- `workload_context` (WorkloadContext, required) — Typed context FACT's AttributorInfo needs (design §6). job_end_time is DISTINCT from scope.end_time (which may be anomaly_time); it is the observed_at no-source fallback on the NV side (design §7.2).
- `workload_id` (string, required)
- `continue_session` (string, optional, nullable)
- `user_id` (string, optional, default: )

## Response

### 200

Successful Response

- `request_id` (string, required)
- `schema_version` (string, required)
- `service_identifier` (string, required)
- `service_version` (string, required)
- `attribution_session_id` (string, optional, default: )
- `attributions` (list of Attribution, optional)
- `error` (AttributionError, optional, nullable) — Informational error on a response; never changes the publish decision (design §10).
- `unattributed_targets` (list of ResourceSet, optional)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### FailureContext

When/how the failure was detected (design §6). detection_signal drives STRAGGLER handling on NV side.

- `detected_at` (datetime, required)
- `detection_signal` (string, required)

### WorkloadScope

The nodes / ranks / time window an attribution request applies to (design §6). start_time and end_time are Optional because SlurmJobExecutionStatus.start_time / end_time may be None (correction C12): callers that know the time pass it; callers working from an in-progress job may not.

- `nodes` (list of string, required)
- `end_time` (datetime, optional, nullable)
- `ranks` (list of integer, optional)
- `start_time` (datetime, optional, nullable)

### WorkloadContext

Typed context FACT's AttributorInfo needs (design §6). job_end_time is DISTINCT from scope.end_time (which may be anomaly_time); it is the observed_at no-source fallback on the NV side (design §7.2).

- `attempt_index` (integer, required)
- `workflow_id` (string, required)
- `anomaly_uuid` (string, optional, default: )
- `cluster` (string, optional, default: )
- `command` (string, optional, default: )
- `job_end_time` (datetime, optional, nullable)
- `node_count` (integer, optional, nullable)
- `state` (string, optional, default: )
- `total_gpu_count` (integer, optional, nullable)
- `workload_name` (string, optional, default: )

### Attribution

A single attributed finding against a resource set (design §6).

- `error_category` (enum, required) — Category of an attributed error, spoken in workload vocabulary (design §6).
  - Allowed values: `hardware`, `system_software`, `application`, `ambiguous`, `unattributed`, `insufficient_telemetry`
- `observed_at` (datetime, required)
- `resource_set` (ResourceSet, required) — A resource an attribution targets: a single Node (value=hostname) or AllJobResources (value=None).
- `confidence` (double, optional, nullable)
- `error_detail` (string, optional, default: )
- `evidence_excerpt` (string, optional, default: )
- `evidence_references` (list of string, optional)
- `recommended_action` (string, optional, nullable)
- `symptom` (string, optional, default: )

### AttributionError

Informational error on a response; never changes the publish decision (design §10).

- `type` (enum, required) — Informational error type on a response; never changes the publish decision (design §10).
  - Allowed values: `timeout`, `insufficient_telemetry`, `service_error`, `no_attribution_available`
- `message` (string, optional, default: )

### ResourceSet

A resource an attribution targets: a single Node (value=hostname) or AllJobResources (value=None).

- `kind` (enum, required) — Kind of resource an attribution targets (design §6).
  - Allowed values: `Node`, `AllJobResources`
- `value` (string, optional, nullable)

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `ctx` (ValidationErrorCtx, optional)
- `input` (any, optional)

### ValidationErrorLocItems

### ValidationErrorCtx

## Examples

**Request**

```json
{
  "failure_context": {
    "detected_at": "2024-01-15T09:30:00Z",
    "detection_signal": "string"
  },
  "phase": "fast",
  "schema_version": "string",
  "scope": {
    "nodes": [
      "string"
    ]
  },
  "timeout_ms": 1,
  "workload_context": {
    "attempt_index": 1,
    "workflow_id": "string"
  },
  "workload_id": "string"
}
```

**Response**

```json
{
  "request_id": "string",
  "schema_version": "string",
  "service_identifier": "string",
  "service_version": "string",
  "attribution_session_id": "",
  "attributions": [
    {
      "error_category": "hardware",
      "observed_at": "2024-01-15T09:30:00Z",
      "resource_set": {
        "kind": "Node",
        "value": "string"
      },
      "confidence": 1.1,
      "error_detail": "",
      "evidence_excerpt": "",
      "evidence_references": [
        "string"
      ],
      "recommended_action": "string",
      "symptom": ""
    }
  ],
  "error": {
    "type": "timeout",
    "message": ""
  },
  "unattributed_targets": [
    {
      "kind": "Node",
      "value": "string"
    }
  ]
}
```

**SDK Code**

```python
import requests

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

payload = {
    "failure_context": {
        "detected_at": "2024-01-15T09:30:00Z",
        "detection_signal": "string"
    },
    "phase": "fast",
    "schema_version": "string",
    "scope": { "nodes": ["string"] },
    "timeout_ms": 1,
    "workload_context": {
        "attempt_index": 1,
        "workflow_id": "string"
    },
    "workload_id": "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/attribution';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"failure_context":{"detected_at":"2024-01-15T09:30:00Z","detection_signal":"string"},"phase":"fast","schema_version":"string","scope":{"nodes":["string"]},"timeout_ms":1,"workload_context":{"attempt_index":1,"workflow_id":"string"},"workload_id":"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/attribution"

	payload := strings.NewReader("{\n  \"failure_context\": {\n    \"detected_at\": \"2024-01-15T09:30:00Z\",\n    \"detection_signal\": \"string\"\n  },\n  \"phase\": \"fast\",\n  \"schema_version\": \"string\",\n  \"scope\": {\n    \"nodes\": [\n      \"string\"\n    ]\n  },\n  \"timeout_ms\": 1,\n  \"workload_context\": {\n    \"attempt_index\": 1,\n    \"workflow_id\": \"string\"\n  },\n  \"workload_id\": \"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/attribution")

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  \"failure_context\": {\n    \"detected_at\": \"2024-01-15T09:30:00Z\",\n    \"detection_signal\": \"string\"\n  },\n  \"phase\": \"fast\",\n  \"schema_version\": \"string\",\n  \"scope\": {\n    \"nodes\": [\n      \"string\"\n    ]\n  },\n  \"timeout_ms\": 1,\n  \"workload_context\": {\n    \"attempt_index\": 1,\n    \"workflow_id\": \"string\"\n  },\n  \"workload_id\": \"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/attribution")
  .header("Content-Type", "application/json")
  .body("{\n  \"failure_context\": {\n    \"detected_at\": \"2024-01-15T09:30:00Z\",\n    \"detection_signal\": \"string\"\n  },\n  \"phase\": \"fast\",\n  \"schema_version\": \"string\",\n  \"scope\": {\n    \"nodes\": [\n      \"string\"\n    ]\n  },\n  \"timeout_ms\": 1,\n  \"workload_context\": {\n    \"attempt_index\": 1,\n    \"workflow_id\": \"string\"\n  },\n  \"workload_id\": \"string\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/attribution', [
  'body' => '{
  "failure_context": {
    "detected_at": "2024-01-15T09:30:00Z",
    "detection_signal": "string"
  },
  "phase": "fast",
  "schema_version": "string",
  "scope": {
    "nodes": [
      "string"
    ]
  },
  "timeout_ms": 1,
  "workload_context": {
    "attempt_index": 1,
    "workflow_id": "string"
  },
  "workload_id": "string"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/v1/attribution");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"failure_context\": {\n    \"detected_at\": \"2024-01-15T09:30:00Z\",\n    \"detection_signal\": \"string\"\n  },\n  \"phase\": \"fast\",\n  \"schema_version\": \"string\",\n  \"scope\": {\n    \"nodes\": [\n      \"string\"\n    ]\n  },\n  \"timeout_ms\": 1,\n  \"workload_context\": {\n    \"attempt_index\": 1,\n    \"workflow_id\": \"string\"\n  },\n  \"workload_id\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "failure_context": [
    "detected_at": "2024-01-15T09:30:00Z",
    "detection_signal": "string"
  ],
  "phase": "fast",
  "schema_version": "string",
  "scope": ["nodes": ["string"]],
  "timeout_ms": 1,
  "workload_context": [
    "attempt_index": 1,
    "workflow_id": "string"
  ],
  "workload_id": "string"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/attribution")! 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()
```