> For clean Markdown of any page, append `.md` to the page URL. > For a complete documentation index, see https://docs.sarvam.ai/llms.txt. > For full documentation content in one file, see https://docs.sarvam.ai/llms-full.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server. # Create notification rule POST https://apps.sarvam.ai/api/analytics/v1/{org_id}/{workspace_id}/boards/{board_id}/notifications Content-Type: application/json Creates a rule that runs `widget_id` on a cron schedule and delivers the result by email, Slack, or both. `widget_id` must name a widget on this board. Reference: https://docs.sarvam.ai/api-reference/boards/notifications/create ## Request ### Path parameters - `org_id` (string, required) — Organization ID - `workspace_id` (string, required) — Workspace ID - `board_id` (string, required) ### Headers - `X-API-Key` (string, required) — Your workspace API key. ### Body (application/json) This endpoint expects a CreateNotificationRuleRequest. - `widget_id` (string, required) — Widget whose result is delivered on this schedule - `cron` (string, required) — Five-field cron expression evaluated in Asia/Kolkata. The minimum interval is one hour. - `name` (string, optional, nullable) — Label for the rule - `email_recipients` (list of string, optional, nullable) — Email addresses to deliver to. At least one of this or `slack_webhook_url` is required. - `slack_webhook_url` (string, optional, nullable) — Slack incoming-webhook URL. Write-only: never returned by any endpoint. - `slack_channel_name` (string, optional, nullable) — Display label for the Slack destination ## Response ### 201 Successful Response - `rule_id` (string, required) — Rule identifier, used as `{rule_id}` in nested routes - `widget_id` (string, required) — Widget whose result this rule delivers - `cron` (string, required) — Five-field cron expression, evaluated in Asia/Kolkata - `enabled` (boolean, required) — False while the schedule is paused - `created_at` (datetime, required) — Creation time, UTC, RFC 3339 - `updated_at` (datetime, required) — Last change time, UTC, RFC 3339 - `name` (string, optional, nullable) — Label for the rule, or null when unnamed - `next_run_at` (datetime, optional, nullable) — Next scheduled delivery, UTC. Null when the rule is disabled. - `email_recipients` (list of string, optional, nullable) — Configured email recipients - `slack_channel_name` (string, optional, nullable) — Slack destination label, when one is configured - `slack_configured` (boolean, optional, default: false) — True when a Slack webhook is set. The URL itself is never returned. ## Errors ### 400 Bad Request Error Request failed validation - `error` (ErrorBody, required) — Details of the error that occurred. ### 401 Unauthorized Error Missing or invalid credentials - `error` (ErrorBody, required) — Details of the error that occurred. ### 403 Forbidden Error Credentials are not scoped to this org and workspace - `error` (ErrorBody, required) — Details of the error that occurred. ### 404 Not Found Error No such resource in this workspace - `error` (ErrorBody, required) — Details of the error that occurred. ### 422 Unprocessable Entity Error Validation Error - `detail` (list of ValidationError, optional) ### 429 Too Many Requests Error Rate limit exceeded. Honour the `Retry-After` response header before retrying. - `error` (ErrorBody, required) — Details of the error that occurred. ### 500 Internal Server Error Unexpected server error - `error` (ErrorBody, required) — Details of the error that occurred. ## Types ### ErrorBody Details of the error that occurred. - `code` (string, required) — A service-specific error code. - `message` (string, required) — A human-readable description of the error. ### ValidationError - `loc` (list of ValidationErrorLocItems, required) - `msg` (string, required) - `type` (string, required) ### ValidationErrorLocItems ## Examples **Request** ```json { "widget_id": "a4c9e0f7-31b8-4d6a-9e25-7f0b3c81d46e", "cron": "30 3 * * *", "name": "Daily connectivity to ops", "email_recipients": [ "ops@example.com" ], "slack_webhook_url": "https://example.com/integrations/slack/webhook", "slack_channel_name": "#agent-ops" } ``` **Response** ```json { "rule_id": "9e3f61d0-4a28-4c75-b13e-6d8025af7c94", "widget_id": "a4c9e0f7-31b8-4d6a-9e25-7f0b3c81d46e", "cron": "30 3 * * *", "enabled": true, "created_at": "2026-09-05T07:40:12Z", "updated_at": "2026-09-05T07:40:12Z", "name": "Daily connectivity to ops", "next_run_at": "2026-09-16T22:00:00Z", "email_recipients": [ "ops@example.com" ], "slack_channel_name": "#agent-ops", "slack_configured": true } ``` **SDK Code** ```python import requests url = "https://apps.sarvam.ai/api/analytics/v1/org_id/workspace_id/boards/board_id/notifications" payload = { "widget_id": "a4c9e0f7-31b8-4d6a-9e25-7f0b3c81d46e", "cron": "30 3 * * *", "name": "Daily connectivity to ops", "email_recipients": ["ops@example.com"], "slack_webhook_url": "https://example.com/integrations/slack/webhook", "slack_channel_name": "#agent-ops" } headers = { "X-API-Key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://apps.sarvam.ai/api/analytics/v1/org_id/workspace_id/boards/board_id/notifications'; const options = { method: 'POST', headers: {'X-API-Key': '', 'Content-Type': 'application/json'}, body: '{"widget_id":"a4c9e0f7-31b8-4d6a-9e25-7f0b3c81d46e","cron":"30 3 * * *","name":"Daily connectivity to ops","email_recipients":["ops@example.com"],"slack_webhook_url":"https://example.com/integrations/slack/webhook","slack_channel_name":"#agent-ops"}' }; 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://apps.sarvam.ai/api/analytics/v1/org_id/workspace_id/boards/board_id/notifications" payload := strings.NewReader("{\n \"widget_id\": \"a4c9e0f7-31b8-4d6a-9e25-7f0b3c81d46e\",\n \"cron\": \"30 3 * * *\",\n \"name\": \"Daily connectivity to ops\",\n \"email_recipients\": [\n \"ops@example.com\"\n ],\n \"slack_webhook_url\": \"https://example.com/integrations/slack/webhook\",\n \"slack_channel_name\": \"#agent-ops\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-API-Key", "") 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://apps.sarvam.ai/api/analytics/v1/org_id/workspace_id/boards/board_id/notifications") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["X-API-Key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"widget_id\": \"a4c9e0f7-31b8-4d6a-9e25-7f0b3c81d46e\",\n \"cron\": \"30 3 * * *\",\n \"name\": \"Daily connectivity to ops\",\n \"email_recipients\": [\n \"ops@example.com\"\n ],\n \"slack_webhook_url\": \"https://example.com/integrations/slack/webhook\",\n \"slack_channel_name\": \"#agent-ops\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://apps.sarvam.ai/api/analytics/v1/org_id/workspace_id/boards/board_id/notifications") .header("X-API-Key", "") .header("Content-Type", "application/json") .body("{\n \"widget_id\": \"a4c9e0f7-31b8-4d6a-9e25-7f0b3c81d46e\",\n \"cron\": \"30 3 * * *\",\n \"name\": \"Daily connectivity to ops\",\n \"email_recipients\": [\n \"ops@example.com\"\n ],\n \"slack_webhook_url\": \"https://example.com/integrations/slack/webhook\",\n \"slack_channel_name\": \"#agent-ops\"\n}") .asString(); ``` ```php request('POST', 'https://apps.sarvam.ai/api/analytics/v1/org_id/workspace_id/boards/board_id/notifications', [ 'body' => '{ "widget_id": "a4c9e0f7-31b8-4d6a-9e25-7f0b3c81d46e", "cron": "30 3 * * *", "name": "Daily connectivity to ops", "email_recipients": [ "ops@example.com" ], "slack_webhook_url": "https://example.com/integrations/slack/webhook", "slack_channel_name": "#agent-ops" }', 'headers' => [ 'Content-Type' => 'application/json', 'X-API-Key' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://apps.sarvam.ai/api/analytics/v1/org_id/workspace_id/boards/board_id/notifications"); var request = new RestRequest(Method.POST); request.AddHeader("X-API-Key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"widget_id\": \"a4c9e0f7-31b8-4d6a-9e25-7f0b3c81d46e\",\n \"cron\": \"30 3 * * *\",\n \"name\": \"Daily connectivity to ops\",\n \"email_recipients\": [\n \"ops@example.com\"\n ],\n \"slack_webhook_url\": \"https://example.com/integrations/slack/webhook\",\n \"slack_channel_name\": \"#agent-ops\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "X-API-Key": "", "Content-Type": "application/json" ] let parameters = [ "widget_id": "a4c9e0f7-31b8-4d6a-9e25-7f0b3c81d46e", "cron": "30 3 * * *", "name": "Daily connectivity to ops", "email_recipients": ["ops@example.com"], "slack_webhook_url": "https://example.com/integrations/slack/webhook", "slack_channel_name": "#agent-ops" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://apps.sarvam.ai/api/analytics/v1/org_id/workspace_id/boards/board_id/notifications")! 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() ```