> This page is for version 1.0.0 (Latest) (default).
> For other versions, use one of these documentation indexes:
> - 1.0.0 (Latest) (default): https://docs.nvidia.com/nim/harmonizer/1.0.0/llms.txt

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

# Run Harmonizer processing

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

Reference: https://docs.nvidia.com/nim/harmonizer/openapi/process-v-1-infer-post

## Request

### Body (application/json)

This endpoint expects a ProcessRequest.

- `images` (list of ProcessImage, required) — One or more images to process.
- `request_id` (string, optional, nullable) — Optional client correlation identifier.
- `parameters` (ProcessParameters, optional) — Optional. If omitted, output_format='png', context_length=0, and return_policy='all' are applied.

## Response

### 200

Successful Response

- `outputs` (list of ProcessOutput, required) — Results selected by return_policy. Every result preserves its corresponding input image's width and height.
- `request_id` (string, optional, nullable) — Correlation identifier from the request, when provided.

## Errors

### 400 Bad Request Error

Invalid request

- `error` (NIMErrorDetail, required) — Structured error details.

### 500 Internal Server Error

Internal server error

- `error` (NIMErrorDetail, required) — Structured error details.

### 503 Service Unavailable Error

Backend unavailable

- `error` (NIMErrorDetail, required) — Structured error details.

## Types

### ProcessImage

One input image, supplied as either encoded image data or a raw tensor.

- `id` (string, optional, nullable) — Optional client-supplied identifier copied to the corresponding output.
- `data` (string, optional, nullable) — PNG or JPEG bytes. HTTP JSON uses a base64-encoded string (data URI prefixes are accepted); gRPC uses bytes. Exactly one of data or tensor must be non-null.
- `tensor` (RawTensor-Input, optional, nullable) — Raw uint8 RGB input. Exactly one of data or tensor must be non-null.

### ProcessParameters

Optional processing controls; every field has a server default.

- `output_format` (enum, optional, default: png) — Output representation. Defaults to PNG-encoded images.
  - Allowed values: `png`, `jpeg`, `raw_tensor`
- `context_length` (enum, optional, default: 0) — Number of leading temporal context frames. Defaults to 0.
  - Allowed values: `0`, `4`
- `return_policy` (enum, optional, default: all) — Selects which processed frames are returned. Defaults to all.
  - Allowed values: `all`, `exclude_context`, `last`

### ProcessOutput

One result at the corresponding input image's original dimensions. HTTP JSON serializes both ``image`` and ``tensor`` keys and exactly one is non-null. The gRPC response represents the same choice with a protobuf ``oneof``.

- `image` (EncodedImage, required, nullable) — Non-null for png or jpeg output and null for raw_tensor output. The width and height equal the corresponding input dimensions.
- `tensor` (RawTensor-Output, required, nullable) — Non-null for raw_tensor output and null for png or jpeg output. Values are tightly packed uint8 RGB in HWC layout with shape [height, width, 3]; height and width equal the corresponding input dimensions.
- `id` (string, optional, nullable) — Identifier copied from the corresponding input image, when provided.

### NIMErrorDetail

Structured details returned in the HTTP ``error`` envelope.

- `message` (string, required) — Human-readable error message.
- `type` (string, required) — Stable error type name.
- `code` (integer, required) — HTTP status code associated with the error.

### RawTensor-Input

A tightly packed unsigned 8-bit RGB tensor. HTTP JSON carries ``data`` as base64 while gRPC carries the same bytes natively. Inputs may use HWC or CHW layout. Raw-tensor outputs always use HWC layout and shape ``[height, width, 3]``.

- `data` (string, required) — Tightly packed uint8 RGB values in the range [0, 255]. HTTP JSON uses a base64-encoded string; gRPC uses bytes.
- `shape` (list of integer, required) — Tensor dimensions. Interpret as [height, width, 3] for HWC or [3, height, width] for CHW. Harmonizer outputs always use HWC.
- `layout` (enum, optional, default: HWC) — Tensor memory layout. Harmonizer outputs always use HWC.
  - Allowed values: `HWC`, `CHW`

### EncodedImage

PNG- or JPEG-encoded output at the corresponding input dimensions.

- `data` (string, required) — Encoded image bytes. HTTP JSON uses a base64-encoded string; gRPC uses bytes.
- `mime_type` (enum, required) — Media type selected by output_format.
  - Allowed values: `image/png`, `image/jpeg`
- `width` (integer, required) — Output width in pixels; equal to the corresponding input width.
- `height` (integer, required) — Output height in pixels; equal to the corresponding input height.

### RawTensor-Output

A tightly packed unsigned 8-bit RGB tensor. HTTP JSON carries ``data`` as base64 while gRPC carries the same bytes natively. Inputs may use HWC or CHW layout. Raw-tensor outputs always use HWC layout and shape ``[height, width, 3]``.

- `data` (string, required) — Tightly packed uint8 RGB values in the range [0, 255]. HTTP JSON uses a base64-encoded string; gRPC uses bytes.
- `shape` (list of integer, required) — Tensor dimensions. Interpret as [height, width, 3] for HWC or [3, height, width] for CHW. Harmonizer outputs always use HWC.
- `layout` (enum, optional, default: HWC) — Tensor memory layout. Harmonizer outputs always use HWC.
  - Allowed values: `HWC`

## Examples

**Request**

```json
{
  "images": [
    {}
  ]
}
```

**Response**

```json
{
  "outputs": [
    {
      "image": {
        "data": "string",
        "mime_type": "image/png",
        "width": 1,
        "height": 1
      },
      "tensor": {
        "data": "string",
        "shape": [
          1
        ],
        "layout": "HWC"
      },
      "id": "string"
    }
  ],
  "request_id": "string"
}
```

**SDK Code**

```python
import requests

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

payload = { "images": [{}] }
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

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

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/infer"

	payload := strings.NewReader("{\n  \"images\": [\n    {}\n  ]\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/infer")

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  \"images\": [\n    {}\n  ]\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/infer")
  .header("Content-Type", "application/json")
  .body("{\n  \"images\": [\n    {}\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

```csharp
using RestSharp;

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

```swift
import Foundation

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

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

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