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

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/fleet-intel/llms.txt.

# Create a notification preference

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

Create a notification preference. The public path remains notification\_preferences
for compatibility; each row is id-addressable and applies one configuration (alert statuses, scope,
notification targets) to one or more components. The settings apply equally to every
component listed. To give a component different settings, create a separate preference.

notifiedOn: array of alert statuses to notify on. Valid values: Critical, Warning, Resolved.
If notifiedOn is empty or omitted, defaults to all three: \[Critical, Warning, Resolved].

Channel config structures:

* email:   \{"recipients": \["[addr@example.com](mailto:addr@example.com)", ...]}  (at least one required)
* slack:   \{"recipients": \["[channel@workspace.slack.com](mailto:channel@workspace.slack.com)", ...]}  (at least one required)
* webhook: \{"customerID": "cust-acme" (optional), "orgName": "0000000000000000" (optional), "webhookIDs": \["wh\_abc123", ...]}  (at least one webhook ID required; customerID defaults to the current customer when omitted; orgName is round-tripped for UI display only)

Reference: https://docs.nvidia.com/fleet-intel/api-explorer/notification-preferences/post-v-1-notification-preferences

## Request

### Body (application/json)

This endpoint expects a models.NotificationPreferenceRequest.

- `components` (list of string, required) — Components this preference applies to (e.g. GPU, CPU, NVLink). At least one; all settings below apply equally to every listed component.
- `notificationTargets` (list of models.NotificationTarget, required) — At least one notification target is required. Config structure depends on channel — see EmailNotificationConfig, SlackNotificationConfig, WebhookNotificationConfig.
- `active` (boolean, optional) — Active flag: when false, this preference is temporarily paused (other preferences covering the same component still fire). If omitted on create, defaults to true. If omitted on update, the existing value is preserved.
- `notifiedOn` (list of string, optional) — Alert statuses to notify on. Valid values: Critical, Warning, Resolved. If empty or omitted, defaults to all three: [Critical, Warning, Resolved].
- `scope` (models.NotificationScope, optional) — Optional scope to narrow which nodes trigger notifications. If omitted or null, all nodes for this component trigger notifications.

## Response

### 201

Created - returns the new preference id

- `id` (string, required)

## Errors

### 400 Bad Request Error

Bad Request - Invalid body, missing/unknown components or targets, invalid channel/config

- `details` (string, optional) — Detailed error information
- `error` (string, optional) — Error message or type
- `requestStatus` (models.KASRequestStatus, optional) — RequestStatus contains KAS-specific error details This is added to reflect the field in OpenAPI docs for UI reference and not populated by our code If KAS returns an error, the request will not be forwarded to the backend

### 401 Unauthorized Error

Unauthorized

- `details` (string, optional) — Detailed error information
- `error` (string, optional) — Error message or type
- `requestStatus` (models.KASRequestStatus, optional) — RequestStatus contains KAS-specific error details This is added to reflect the field in OpenAPI docs for UI reference and not populated by our code If KAS returns an error, the request will not be forwarded to the backend

### 403 Forbidden Error

Forbidden - UAM authorization denied

- `details` (string, optional) — Detailed error information
- `error` (string, optional) — Error message or type
- `requestStatus` (models.KASRequestStatus, optional) — RequestStatus contains KAS-specific error details This is added to reflect the field in OpenAPI docs for UI reference and not populated by our code If KAS returns an error, the request will not be forwarded to the backend

### 499 Client Closed Request Error

Client Closed Request - request was canceled by the client

- `details` (string, optional) — Detailed error information
- `error` (string, optional) — Error message or type
- `requestStatus` (models.KASRequestStatus, optional) — RequestStatus contains KAS-specific error details This is added to reflect the field in OpenAPI docs for UI reference and not populated by our code If KAS returns an error, the request will not be forwarded to the backend

### 500 Internal Server Error

Internal Server Error

- `details` (string, optional) — Detailed error information
- `error` (string, optional) — Error message or type
- `requestStatus` (models.KASRequestStatus, optional) — RequestStatus contains KAS-specific error details This is added to reflect the field in OpenAPI docs for UI reference and not populated by our code If KAS returns an error, the request will not be forwarded to the backend

### 503 Service Unavailable Error

Service Unavailable - Database temporarily unavailable

- `details` (string, optional) — Detailed error information
- `error` (string, optional) — Error message or type
- `requestStatus` (models.KASRequestStatus, optional) — RequestStatus contains KAS-specific error details This is added to reflect the field in OpenAPI docs for UI reference and not populated by our code If KAS returns an error, the request will not be forwarded to the backend

## Types

### models.NotificationTarget

- `channel` (enum, required) — Channel type: email, slack, or webhook
  - Allowed values: `email`, `slack`, `webhook`
- `config` (map from string to any, required) — Channel-specific configuration (see EmailNotificationConfig, SlackNotificationConfig, WebhookNotificationConfig)

### models.NotificationScope

Optional scope to narrow which nodes trigger notifications. If omitted or null, all nodes for this component trigger notifications.

- `type` (enum, optional) — Scope type: all, nodes, node_groups, compute_zones, or tags
  - Allowed values: `all`, `compute_zones`, `node_groups`, `tags`, `nodes`
- `values` (list of string, optional) — Scope values: UUIDs for nodes/node_groups/compute_zones, or tag name strings for tags. At least one value is required for all types except "all".

### models.KASRequestStatus

RequestStatus contains KAS-specific error details This is added to reflect the field in OpenAPI docs for UI reference and not populated by our code If KAS returns an error, the request will not be forwarded to the backend

- `requestId` (string, optional) — Request ID for tracing
- `statusCode` (string, optional) — Status code from KAS
- `statusDescription` (string, optional) — Status description from KAS

## Examples

**Request**

```json
{
  "components": [
    "GPU",
    "NVLink"
  ],
  "notificationTargets": [
    {
      "channel": "email",
      "config": {}
    }
  ]
}
```

**Response**

```json
{
  "id": "6f1c2d3e-4a5b-6c7d-8e9f-0a1b2c3d4e5f"
}
```

**SDK Code**

```python
import requests

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

payload = {
    "components": ["GPU", "NVLink"],
    "notificationTargets": [
        {
            "channel": "email",
            "config": {}
        }
    ]
}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript
const url = 'https://api.example.com/v1/notification_preferences';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"components":["GPU","NVLink"],"notificationTargets":[{"channel":"email","config":{}}]}'
};

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

	payload := strings.NewReader("{\n  \"components\": [\n    \"GPU\",\n    \"NVLink\"\n  ],\n  \"notificationTargets\": [\n    {\n      \"channel\": \"email\",\n      \"config\": {}\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/notification_preferences")

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  \"components\": [\n    \"GPU\",\n    \"NVLink\"\n  ],\n  \"notificationTargets\": [\n    {\n      \"channel\": \"email\",\n      \"config\": {}\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/notification_preferences")
  .header("Content-Type", "application/json")
  .body("{\n  \"components\": [\n    \"GPU\",\n    \"NVLink\"\n  ],\n  \"notificationTargets\": [\n    {\n      \"channel\": \"email\",\n      \"config\": {}\n    }\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/notification_preferences', [
  'body' => '{
  "components": [
    "GPU",
    "NVLink"
  ],
  "notificationTargets": [
    {
      "channel": "email",
      "config": {}
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

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

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "components": ["GPU", "NVLink"],
  "notificationTargets": [
    [
      "channel": "email",
      "config": []
    ]
  ]
] as [String : Any]

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

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